Guide · For developers

Mexican identity verification in your project in minutes: one command and one prompt in Claude Code

From zero to a service that validates Mexico's CURP with OrigoID's API using its MCP server in Claude Code, and the design choices that make it fast.

OrigoID team Published on 5 min read Leer en español
In this guide
  1. Step 1: one command
  2. Step 2: one prompt
  3. Step 3: your key
  4. Why it is fast
  5. The same in a project that already exists
  6. Queries from the chat
  7. What we took care of
  8. What we tested
  9. Get started

Integrating an identity API usually goes like this: you read the docs, guess what each case returns, write the error handling blind, and find the odd cases in production.

At OrigoID we build an identity verification API for Mexico (CURP, RFC, the INE voter card, invoices, SAT lists, sanctions and more), and we designed it for the person who integrates it. The goal is to get you from zero to a working service in minutes. This article shows it with Claude Code: one command, one prompt and a project that runs.

Step 1: one command

We publish an MCP server, @origoid/mcp-server. MCP (Model Context Protocol) is the open standard for giving tools to an AI assistant. You add it to Claude Code like this:

Terminal
claude mcp add origoid -- npx -y @origoid/mcp-server

It asks for no account and no key. With that, your agent already has ten tools that read the API's real contract: endpoints, result types, code snippets, types and starter projects. It needs Node 18 or newer.

Step 2: one prompt

Create a FastAPI service that validates a CURP with the OrigoID API.

The agent calls the get_full_integration_starter tool and gets a complete project. This is what it delivers for FastAPI:

File What is in it
pyproject.toml Dependencies: FastAPI, the official origoid SDK, uvicorn
main.py The service, using the SDK's async client
.env.example Where your key goes
.gitignore So the key never reaches the repository
README.md How to run it and how to try it

The commands come with the files:

Terminal
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
cp .env.example .env  # edit ORIGOID_API_KEY
uvicorn main:app --reload

The handler it generates returns OrigoID's response as it arrives: the same HTTP status and the same body. What to do with each result is your call, where the comment marks it. This is the main.py the tool delivers, from the route down:

Python
@app.post("/curp/validate")
async def validate_curp(body: ValidateBody):
    try:
        env = await app.state.origoid.renapo.validate_curp(curp=body.curp)
    except ApiError as err:
        # The SDK raises when the API answers with an HTTP error status
        # (401 UNAUTHORIZED, 429 RATE_LIMIT_EXCEEDED). err.body is the
        # envelope the API sent: pass it on with the same status.
        return JSONResponse(
            status_code=err.status_code or 502,
            content=jsonable_encoder(err.body),
        )
    except httpx.HTTPError as err:
        # No response from OrigoID (network error, timeout).
        return JSONResponse(
            status_code=502,
            content={"error": "origoid_unreachable", "message": str(err)},
        )

    # env.type names the result: SUCCESS, CURP_DECEASED, CURP_NOT_FOUND,
    # INVALID_REQUEST... What each one means for your flow is your call:
    # decide here.
    return JSONResponse(content=jsonable_encoder(env))

There are starter projects for FastAPI, for Express with TypeScript and for a command-line tool in Go.

Step 3: your key

So far no account was needed. For the service to run real queries you need a key: you request it at origoid.com, and there are courtesy credits to try it, after a brief validation of your company. Put it in .env and try it:

Terminal
curl -X POST http://localhost:8000/curp/validate \
  -H "content-type: application/json" \
  -d '{"curp": "PELJ900101HDFRRN09"}'

The CURP in the example is synthetic.

Why it is fast

It is not agent magic. It comes from design choices in the API, and they help just as much if you integrate by hand.

One response shape. Every endpoint returns the same seven fields: status, type, message, data, transactionId, processedAt and billable. Learn to read one and you can read them all.

A stable code for every result. The type field names the case, and your code decides with a switch or a match. CURP validation has twelve:

type status Billed?
SUCCESS OK Yes
CURP_DECEASED OK Yes
CURP_HOMONYMY OK Yes
CURP_APOCRYPHAL OK Yes
CURP_JUDICIAL_SUSPENSION OK Yes
CURP_INACTIVE OK Yes
CURP_NOT_FOUND OK Yes
INVALID_REQUEST ERROR No
SERVICE_UNAVAILABLE ERROR No
INTERNAL_ERROR ERROR No
UNAUTHORIZED ERROR No
RATE_LIMIT_EXCEEDED ERROR No

Seven of the twelve arrive with status: "OK". The CURP of a deceased person is a correct response, not an error. That is why checking the HTTP code is not enough, and why the contract names them one by one.

Every response says whether it was billed. The billable field is always there. A malformed request or a service error costs nothing.

Errors say which field and why. INVALID_REQUEST carries an errors list with field, code and message. There is no free text to interpret.

Official SDKs and per-endpoint examples. There are SDKs for TypeScript, Python and Go, and every endpoint comes with its example in cURL, JavaScript, Python, Java, PHP, Go and C#.

The contract is within the agent's reach. That is what the MCP server does. Its ten docs tools work with no key and use no credits:

Tool What it returns
list_endpoints The endpoint catalog
get_endpoint A full endpoint: request, response, examples and cost
get_response_types Every possible result, with a sample of each
get_sdk_example A ready-to-paste snippet in your language
get_typescript_types, get_pydantic_model Types for your code
get_full_integration_starter A complete starter project
search_docs, get_api_overview Search and overview
validate_envelope_shape Whether you are reading a response correctly

The same in a project that already exists

The starter project is the short path. In code you already have, the prompt changes and the tools are the same:

Add the SAT 69-B list check to supplier onboarding. Handle every possible result.

The agent finds the endpoint with list_endpoints, asks for its results with get_response_types and pulls the snippet with get_sdk_example. It writes against the contract, not against what it assumes.

Queries from the chat

With the key configured, the agent can also run real queries, with one tool per endpoint: validate_curp, validate_rfc, validate_cfdi, validate_voter_list, search_sat_69b, search_ofac and the rest. It is handy for trying a case without leaving the editor.

Terminal
claude mcp add origoid --env ORIGOID_API_KEY=your_key -- npx -y @origoid/mcp-server

What we took care of

What we tested

Everything shown here was tested in Claude Code. We installed and started the FastAPI starter exactly as it comes out of the tool. The server speaks MCP over the standard transport (stdio), and the README has the configuration for other clients; we do not cover them here.

Get started

The first step asks for nothing: run the command and tell your agent what you want to validate.

Related services

Keep reading

All guides ›
Compliance Mexico's UIF blocked persons list: what to check

Mexico's UIF blocked persons list is confidential and has no public lookup. Its seven legal grounds and the public lists you can screen instead.

6 min
Tax What to check in a Mexican CFDI before paying

Six checks on the XML of a Mexican e-invoice (CFDI) before paying it, with Python code, and three things the XML cannot tell you.

6 min
Tax SAT Article 69 vs 69-B: differences, Mexico

How SAT's Article 69 lists and the 69-B list differ in Mexico, what risk each one covers and six common mistakes when integrating them.

7 min
Start free, no card.

Courtesy credits to try it with your own data. Access is enabled after a brief validation of your company.

Request access