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 veriko

Create 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_key

Validate 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().

FamilyWhat it covers
client.validationsValidate by fields or by image, read, list, export, check the payment, delete, the retry policy and the CEP download
client.webhooksRegister endpoints, rotate their secret, send a test event and read the delivery history
client.catalogSPEI bank catalog, non-business-day calendar, issuing bank of a card and Banxico status
client.beneficiariesSaved beneficiary accounts and the bulk import
client.usageValidation quota, rate limits and the activity log
client.accountProfile and default retry policy of the account
client.dashboardDashboard summary
client.plansCatalog and comparison of public plans, with no API key
client.insightsSummary, trends, top banks and top beneficiaries
client.financeSummaries, statements, downloads and CEP exports
client.billingActive 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.