---
title: "CURP Validation Module"
url: "https://developer.incode.com/sdk-reference/web-sdk-2-module-curp-validation/"
section: "sdk-reference"
group: "Incode Web SDK 2 Reference / Web SDK 2 Individual Modules"
version: "v1.1"
status: "live"
---
# CURP Validation Module

:::note
This guide is specific to Web SDK 2.0. If you are still using 1.x, you can find documentation [here](/sdk-reference/web-sdk-reference).  Contact your Incode Representative for upgrade information and check if you are a candidate for this upgrade. <br /><br />Full rollout to all clients still TBD.
:::

The CURP Validation module verifies a Mexican CURP (Clave Única de Registro de Población) — either by accepting the user's CURP and validating it server-side, or by generating one from the user's identity data when missing.

> Follows the [form-based pattern](/sdk-reference/web-sdk-2-module-patterns/#1-form-based-modules) with three input variants (enter, confirm, generate). See the patterns page for the shared lifecycle.

## Tag

`<incode-curp-validation>` is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.

```ts
import '@incodetech/web/curp-validation';
import '@incodetech/web/curp-validation/styles.css';
```

## Properties

| Property   | Type                      | Required | Description                      |
| ---------- | ------------------------- | -------- | -------------------------------- |
| `config`   | `CurpValidationConfig`    | ❌       | Configuration options            |
| `onFinish` | `() => void`              | ❌       | Called when validation completes |
| `onError`  | `(error: string) => void` | ❌       | Called when an error occurs      |

## Configuration

`CurpValidationConfig` extends `FlowModuleConfig['CURP_VALIDATION']` with two manager-level options:

```typescript
type CurpValidationConfig = FlowModuleConfig['CURP_VALIDATION'] & {
  maxRetries?: number; // Maximum validation retries before auto-advancing (default: 1)
  prefillFromOcr?: boolean; // Attempt OCR pre-fill on load (default: true)
};
```

| Option           | Type      | Required | Description                                                                    |
| ---------------- | --------- | -------- | ------------------------------------------------------------------------------ |
| `maxRetries`     | `number`  | ❌       | Auto-advance after this many failed validation attempts. Default `1`.          |
| `prefillFromOcr` | `boolean` | ❌       | Pre-fill the CURP field from prior ID OCR data when available. Default `true`. |

`FlowModuleConfig['CURP_VALIDATION']` contributes two more. Both are set on the module's dashboard configuration and arrive through the orchestrator, so consumer code passes them through rather than setting them:

| Option                       | Type      | Description                                                                                     |
| ---------------------------- | --------- | ----------------------------------------------------------------------------------------------- |
| `curpDataMatch`              | `boolean` | Check the CURP against the personal data already collected in the session, not just its format. |
| `deceasedStatusVerification` | `boolean` | Check the registry's deceased status. A positive result sends the module to `failure`.          |

## State machine

`CurpValidationState` is a discriminated union over `status`:

| Status          | Description                                                                       |
| --------------- | --------------------------------------------------------------------------------- |
| `idle`          | Initial state.                                                                    |
| `loading`       | Loading prior OCR data (when `prefillFromOcr` is `true`).                         |
| `enterCurp`     | User enters their CURP.                                                           |
| `verifying`     | Backend verifying the entered CURP.                                               |
| `confirmCurp`   | Backend returned an OCR'd CURP candidate; user confirms or rejects.               |
| `generateCurp`  | No CURP available; user fills the generate form (name, DOB, gender, birth state). |
| `generating`    | Backend generating a CURP from the form.                                          |
| `generateError` | Generate failed; user can retry.                                                  |
| `success`       | CURP validated.                                                                   |
| `failure`       | Validation failed (deceased status, mismatch, etc.).                              |
| `finished`      | Terminal.                                                                         |
| `closed`        | User dismissed.                                                                   |

## API methods

The module has two input paths — verify an existing CURP, or generate one — and a separate setter for each.

| Method                  | Purpose                                                                        | Callable when                   |
| ----------------------- | ------------------------------------------------------------------------------ | ------------------------------- |
| `load()`                | Start the flow, pulling prior OCR data when `prefillFromOcr` is enabled.       | `idle`                          |
| `setCurp(curp)`         | Set the CURP the user is typing.                                               | `enterCurp`, `confirmCurp`      |
| `validateField(field)`  | Validate one field on blur. Takes `'curp'` or a key of the generate form.      | `enterCurp`, `generateCurp`     |
| `verify()`              | Submit the entered CURP for verification.                                      | `enterCurp`, `confirmCurp`      |
| `switchToGenerate()`    | Move to the generate path when the user has no CURP to enter.                  | `enterCurp`                     |
| `setGenerateForm(form)` | Update the generate form. Takes a partial, so you can set one field at a time. | `generateCurp`                  |
| `generate()`            | Submit the generate form.                                                      | `generateCurp`                  |
| `confirmGenerated()`    | Accept the generated CURP and finish.                                          | after a successful `generate()` |
| `retry()`               | Retry after a failure.                                                         | `failure`, `generateError`      |
| `close()`               | Dismiss the module.                                                            | any non-terminal state          |

Plus the universal lifecycle: `subscribe`, `getState`, `stop`.

## See also

- [Module Patterns → form-based](/sdk-reference/web-sdk-2-module-patterns/#1-form-based-modules)
- [Module: ID OCR](/sdk-reference/web-sdk-2-module-id-ocr/): provides the OCR data this module pre-fills from
- [Individual Modules](/sdk-reference/web-sdk-2-individual-modules/)