Docs / Checks

Validate a national ID

Runs the published format and check-digit rules for one national identifier. An invalid value still returns 200. This does not query a government registry.

POST/v1/validate/{country}/{type}
import { Client } from "@liveapiio/liveapi";

const client = new Client({ token: process.env.LIVEAPI_TOKEN });

const id = await client.validateId("BR", "cpf", "529.982.247-25");

Request

Send Authorization: Bearer YOUR_TOKEN. The token stays on your server. Each library reads it from the environment and calls this endpoint for you.

FieldTypeDescription
countrystringISO country code. Path parameter.
typestringIdentifier type, such as cpf. Path parameter. GET /v1/validate lists the pairs.
valuestringThe number to check. Spaces, dots, hyphens, and slashes are ignored.

Response

200 with valid: false means the format or checksum failed. That response still uses one call. Some types also return facts encoded in the number, such as a birth date.

Errors

A failed request returns { "error": { "code", "message" } } and does not use a call.

StatusCodeWhen
400invalid_requestA required field is missing or has the wrong type.
401unauthorizedThe bearer token is missing or not recognized.

We value your privacy

We use necessary cookies to run this website. With your consent, we would also like to use analytics and marketing cookies. Read our cookie policy.