go get fetches the source directly from GitHub.
The SDK provides one strongly-typed function per OrigoID endpoint and
follows idiomatic Go patterns (context.Context, exported structs,
explicit error returns).
Install
go.mod:
go mod tidy. Source on
github.com/origoid/sdk-go (public,
for auditing). Requires Go 1.21 or newer.
Initialize the client
os.Getenv, viper,
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.
(*origoid.Envelope, error). The envelope shape
is { Status, Type, Message, Data, TransactionId, ProcessedAt, Billable, Errors }. See Response envelope for the
contract.
Methods by resource
The client groups operations by regulatory domain.c.Authentication
c.Renapo
origoid.String(...) is a helper for optional string fields (Go has
no Option<T>; optionality is modeled with pointers).
c.Sat
ExtractCsf and ValidateCfdi accept a map[string]any because the
underlying schemas allow alternative shapes (direct identifiers OR a
document upload).
c.Imss
c.Ine
c.Compliance
c.Biometrics
c.Email
c.ProofOfAddress
Error handling
The SDK distinguishes between business errors (returned inside the envelope) and transport errors (returned as a non-nilerror).
Business errors — inspect the envelope
For any HTTP 200, includingINVALID_REQUEST, the SDK returns a
*Envelope. Check Status and Type before using Data:
Transport errors — non-nil error
For 401, 429, network failures, the SDK returns a typed error:
Per-call configuration (advanced)
Useoption.With* helpers as additional arguments:
context.Context to honor deadlines or cancellations from the
caller; the SDK respects ctx.Done() and aborts in-flight requests.
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
MaxAttempts(e.g. 120 s × 5) means a single failing request can occupy a goroutine for up to 10 minutes — bad for your throughput and your infrastructure. - Override per-call only on endpoints with known slow cold starts.
Pointers for optional fields
Go has noOption<T>, so optional fields in request structs are
pointer types. The SDK exposes helper constructors to make this less
verbose: