Code examples
The examples repository gathers runnable programs for the Veriko API. Each flow has an example in cURL, Node.js, Python and PHP. The Node.js and Python ones also come in a variant that uses the official SDKs (JavaScript and Python).
Requirements
- An API key, in the
VERIKO_API_KEYenvironment variable. Create it in the Veriko console. - cURL: bash,
curlandjq. Node.js: version 18 or later. Python: version 3.9 or later. PHP: version 8.1 or later with thecurlextension. - Optional:
VERIKO_BASE_URLsends the requests to another host.
Run an example
From the root of the repository:
bash curl/validate.sh
node node/raw/validate.mjs
python3 python/raw/validate.py
php php/validate.phpEvery example exits with a non-zero code when the API answers a non-2xx status, when a request times out and when a validation ends without a final status. The synchronous validation waits up to 75 seconds, because Banxico can take about a minute to answer.
Which flows they cover
- Validate by fields and by image, with the verdict in the response or with
sync_deadline. - Enqueue a validation and poll until the final status.
- Idempotency and safe retries, and error handling.
- Download the CEP as PDF or XML.
- Paginate and export validations, and export CEP files as a ZIP.
- Retry policy and beneficiaries.
- Register a webhook endpoint and receive deliveries while verifying the signature.
Repository
The full table of examples and the contribution guide are in the examples repository.