Python SDK
The Python SDK is the official client of the API. It validates SPEI transfers against the Banxico CEP, downloads the receipt and verifies webhook signatures. It has no runtime dependencies and requires Python 3.9 or later.
Installation
pip install verikoCreate your API key in the Veriko console and store it in the VERIKO_API_KEY environment variable. The client reads it on its own.
export VERIKO_API_KEY=veriko_your_keyValidate a transfer
from veriko import Veriko
client = Veriko()
validation = client.validate_transfer(
send_date="2025-03-15",
amount=15000.50,
tracking_key="MXBA20250315001234",
beneficiary_account="012180004412345678",
)
print(validation.status) # 'valid'The amount is in pesos, with cents, and accepts Decimal. Besides the amount and the beneficiary account, the tracking key or the numeric reference is required. For the full flow, see Validate a SPEI transfer.
Verify a webhook
Verify the raw body before parsing it: reading it into a dictionary and writing it back changes the bytes and the signature no longer matches.
from veriko import SignatureVerificationError, parse_webhook
try:
event = parse_webhook(request.get_data(), request.headers, [current_secret, previous_secret])
except SignatureVerificationError:
return "", 401
if event.event == "validation.completed":
...With the request headers, parse_webhook() verifies the timestamped signature and rejects a timestamp outside a 5-minute window. It accepts one secret or several, which helps during the 24 hours after a rotation. More about the delivery model in Webhooks architecture.
What it includes
The client groups the 75 M2M operations of the API into eleven families. The three most used are also at the root: validate_transfer(), get_validation() and get_cep().
| Family | What it covers |
|---|---|
client.validations | Validate by fields or by image, read, list, export, check the payment, delete, the retry policy and the CEP download |
client.webhooks | Register endpoints, rotate their secret, send a test event and read the delivery history |
client.catalog | SPEI bank catalog, non-business-day calendar, issuing bank of a card and Banxico status |
client.beneficiaries | Saved beneficiary accounts and the bulk import |
client.usage | Validation quota, rate limits and the activity log |
client.account | Profile and default retry policy of the account |
client.dashboard | Dashboard summary |
client.plans | Catalog and comparison of public plans, with no API key |
client.insights | Summary, trends, top banks and top beneficiaries |
client.finance | Summaries, statements, downloads and CEP exports |
client.billing | Active subscription |
It also includes an asynchronous client, AsyncVeriko, with the same arguments and the same families. The SDK retries with exponential backoff what is safe to repeat, sends an Idempotency-Key on the operations that accept one and raises typed errors. See Idempotency, Retry policy and Errors.
While the version is 0.x, a minor version can adjust the public surface of the SDK.
Repository
The code, the changelog and the contribution guide are in the Python SDK repository.