Skip to main content
The Go SDK is distributed as a standard Go module. There is no separate registry — 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

Or add it to go.mod:
Then run go mod tidy. Source on github.com/origoid/sdk-go (public, for auditing). Requires Go 1.21 or newer.

Initialize the client

That’s the whole setup — there is nothing else to configure. Never hardcode the key. Load it from os.Getenv, viper, or a secrets manager (HashiCorp Vault, 1Password, Doppler, etc.).

Your first call

The example below uses PELJ900101HDFRRN09, a synthetic CURP from the OpenAPI examples — not a real person’s CURP. Replace it with the CURP you need to validate.
Every method returns (*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-nil error).

Business errors — inspect the envelope

For any HTTP 200, including INVALID_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)

Use option.With* helpers as additional arguments:
Pass a 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 no Option<T>, so optional fields in request structs are pointer types. The SDK exposes helper constructors to make this less verbose:
For enums: