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:
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:
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:
@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:
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.
claude mcp add origoid --env ORIGOID_API_KEY=your_key -- npx -y @origoid/mcp-server
What we took care of
- The key never enters the chat. It goes in an environment variable. The server does not accept it as a tool argument, so it never reaches the model's context.
- The code is public, under the MIT license. You can check exactly what is sent to
api.origoid.com. - Real queries cost money. Every successful call to an API tool uses credits, and an agent can repeat calls while it iterates. Review the tool list before approving automatic execution.
- Whatever you type in the chat, your assistant sees. While integrating, use test data. On our side, every query is validated, answered and discarded, with no data stored.
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
- Code and README: github.com/origoid/mcp-server
- Package: @origoid/mcp-server on npm
- Documentation: docs.origoid.com
- Key and courtesy credits: request access
The first step asks for nothing: run the command and tell your agent what you want to validate.