Install
uv / poetry / pdm:
origoid. Source
on github.com/origoid/sdk-python
(public, for auditing). Requires Python 3.9 or newer.
Initialize the client
os.environ, a .env file via
python-dotenv, or a
secrets manager (HashiCorp Vault, 1Password, Doppler, etc.).
Your first call
The example below usesPELJ900101HDFRRN09, a synthetic CURP from
the OpenAPI examples — not a real person’s CURP. Replace it with the
CURP you need to validate.
Envelope instance: { status, type, message, data, transaction_id, processed_at, billable, errors? }. See
Response envelope for the contract.
Methods by resource
Methods are grouped by regulatory domain. Names use Pythonsnake_case.
client.authentication
client.renapo
client.sat
extract_csf and validate_cfdi accept a request= dict because the
underlying schemas allow alternative shapes (direct identifiers OR a
document upload). Inside that dict use the JSON wire names
(camelCase):
client.imss
client.ine
client.compliance
client.biometrics
client.email
client.proof_of_address
Async client
For applications built on FastAPI, aiohttp, Starlette, or other async frameworks, useAsyncOrigoID. Same method names, same
arguments, same return types — you just await each call so it does
not block the event loop while the HTTP request is in flight.
asyncio.gather — the same pattern as Promise.all in
JavaScript:
OrigoID —
async only adds value when you need to handle many concurrent
operations without spawning threads.
Error handling
The SDK distinguishes between business errors (returned inside the envelope) and transport errors (raised as exceptions).Business errors — inspect the envelope
For any HTTP 200, includingINVALID_REQUEST, the SDK returns an
Envelope. Check status and type before using data:
type codes.
Transport errors — try/except
For 401, 429, and unrecoverable failures the SDK raises typed
exceptions:
Per-call configuration (advanced)
Passrequest_options to override timeout, retries, or headers per
call:
Read this before tuning timeouts or retries. The SDK only retries
5xx and network failures, never successful business responses — so
retries do not create duplicate billable calls when the API
responded correctly. They do create extra calls when the request
actually failed: a request that times out three times can consume
three credits if the call eventually succeeded on a later attempt.- Defaults (60 s, 2 retries) are right for almost every workload. Change only with a specific reason.
- Combining a long timeout with high
max_retries(e.g. 120 s × 5) means a single failing request can occupy a thread for up to 10 minutes — bad for your throughput and your infrastructure. - Override per-call only on endpoints with known slow cold starts.