BlindPay Python SDK 
The official Python SDK for BlindPay - Stablecoin API for global payments.
Installation
pip install blindpay
Requirements
- Python 3.12 or higher
Quickstart
BlindPay is the async client and BlindPaySync the sync one. They expose the same resources and methods.
import asyncio
from blindpay import BlindPay
async def main() -> None:
async with BlindPay(api_key="your_api_key", instance_id="in_000000000000") as blindpay:
response = await blindpay.payouts.get("po_000000000000")
if response["error"] is not None:
print(response["error"]["code"], response["error"]["message"])
return
print(response["data"]["status"])
asyncio.run(main())
from blindpay import BlindPaySync
with BlindPaySync(api_key="your_api_key", instance_id="in_000000000000") as blindpay:
response = blindpay.payouts.get("po_000000000000")
Each client owns one HTTP connection pool. Close it with async with / with, or await blindpay.aclose() /
blindpay.close(). A configured client is safe to share across threads (sync) or tasks (async); per-request options
never change it.
Resources
Both clients expose the same namespaces (94 of 94 public API operations):
| Namespace | What it covers |
|---|---|
available |
rails, bank-detail fields, NAICS codes, SWIFT lookups |
customers (+ .bank_accounts, .rfi) |
customers (KYC/KYB), limits, limit increases, bank accounts incl. create_plaid_link, compliance RFIs |
quotes, payouts |
payout quotes and FX, EVM/Solana/Stellar payouts, documents, tracking |
payins (+ .quotes) |
payin quotes and FX, EVM payins, tracking |
payables |
bills to pay (boleto, PIX code, invoice) |
transfers |
transfer quotes and transfers between wallets |
virtual_accounts |
virtual accounts (US, Mexico, Colombia) |
wallets.blockchain / .offramp / .custodial |
external wallets (incl. set_self_custody), offramp wallets, managed wallets (balances, deposits) |
instances (+ .webhook_endpoints, .terms_of_service, .onboarding, .rfi) |
your instance, members, webhook endpoints, ToS links, onboarding answers |
partner_fees, fees |
partner fees and your billing fees |
upload |
multipart upload and document analysis, presign |
Every input, output and enum type is importable from the package root (from blindpay import Payout, CreateQuoteInput).
Amounts and units
- Payout, payin, quote, payable and limit amounts are integer cents (
1000= 10.00). - Partner percentage fees are basis points (
100= 1%); flat fees are cents. - Managed-wallet balances (
wallets.custodial.get_balance) are whole tokens (10.5= 10.5 USDC).
"Exactly one of" inputs
payouts.create_evm/create_solana/create_stellar/authorize_stellar_token: passsender_wallet_addressorwallet_id(a managed wallet), not both.quotes.create: passbank_account_idorpayable_id.
The SDK doesn't validate these; the API answers 400.
Testing on a development instance
Development instances simulate settlement (test token USDB). Payouts of 66600 cents fail and 77700 are refunded;
dev payins complete in about 30 s; quotes expire after 5 minutes (OTC payin quotes after 10 s); development instances
allow 40 requests per minute (the SDK retries the 429 for you, honouring Retry-After).
Configuration
blindpay = BlindPay(
api_key="your_api_key",
instance_id="in_000000000000",
base_url="https://api.blindpay.com", # default; a proxy URL also works (it receives your API key)
timeout=60.0, # seconds per attempt (default 60)
max_retries=2, # retries after the first attempt (default 2); 0 turns retries off
http_client=None, # your own httpx.AsyncClient (httpx.Client for BlindPaySync), e.g. with a mock transport
)
When you pass http_client, closing the BlindPay client leaves it open: you own it.
Error handling
Methods never raise for API or network errors. They return a dict with either data or error:
response = await blindpay.customers.get("cu_000000000000")
if response["error"] is not None:
error = response["error"]
print(error["message"]) # always present
print(error.get("status")) # HTTP status, or 0 when no response arrived (timeout, connection error)
print(error.get("code")) # stable UPPERCASE API code, e.g. "CUSTOMERS_NOT_FOUND"; "SDK_TIMEOUT" etc. client-side
print(error.get("description"), error.get("errors"), error.get("trace_id"))
print(error.get("request_id")) # the X-Request-Id response header; quote it to support
print(error.get("idempotency_key")) # the key this request carried (see below)
print(error.get("retryable")) # True when resending with the same idempotency_key may succeed
else:
customer = response["data"]
BlindPayError is raised only for programming errors caught before a request is sent (a missing API key, an
invalid idempotency_key). list_auto_paging iterators raise BlindPayApiError, which carries the same fields as
attributes, because an iterator can't return an error dict.
Idempotency and retries
Every method that creates, changes or deletes something takes a trailing options argument:
response = await blindpay.payouts.create_evm(
{"quote_id": "qu_000000000000", "wallet_id": "wa_000000000000"},
{"idempotency_key": "payout-for-order-42", "timeout": 30, "headers": {"X-Trace": "abc"}},
)
idempotency_key(1 to 255 characters) is sent asIdempotency-Key. The API stores the response for that key, so resending the same request with the same key returns the stored result instead of creating a second payout. An empty, padded or non-ASCII key, or one longer than 255 characters, raisesBlindPayErrorbefore anything is sent.- With retries on (the default) and no key of yours, the SDK generates a UUIDv4 key before the first attempt, so a
retried request can't execute twice. Uploads (
upload.create,upload.analyze) never carry a key: the API doesn't deduplicate multipart requests. timeoutoverrides the client's per-attempt timeout;headersadds headers to this request only (names are case-insensitive;Authorization,User-AgentandIdempotency-Keycan't be set this way).
What the SDK retries, with exponential backoff (0.5 s doubling up to 8 s, with jitter) or the server's
Retry-After when it is 60 s or less:
| Request | Retried on |
|---|---|
GET |
connection errors, timeouts, HTTP 408, 429, 500, 502, 503, 504 |
POST / PUT / PATCH / DELETE |
connection errors and timeouts before any response arrived, 429, and 409 idempotency_key_in_flight, always with the same key and bytes |
| Uploads | connection failures before anything was sent |
A mutation that gets a 5xx is not retried: the API releases the idempotency key on a 5xx, so a resend could run
the operation twice. The error comes back with retryable: True and the idempotency_key it used. If a create
or payout returns a 5xx, look the resource up (by quote, external id, or a list filter) before resending. Resend
with the same idempotency_key from the error.
Pagination
Payouts, payins, payables, customers, transfers and managed-wallet deposits have cursor pagination. list returns one page: the
{"data": [...], "pagination": {"has_more", "next_page", "prev_page"}} envelope when you pass limit,
starting_after or ending_before, and (for payouts, payins, payables and customers) a bare list of every row
when you pass none of them. Transfers and deposits always return the envelope. For large collections use the auto-pager, which requests pages of 100 and follows
pagination.next_page for you:
async for payout in blindpay.payouts.list_auto_paging({"customer_id": "cu_000000000000", "status": "completed"}):
print(payout["id"], payout["status"])
for customer in blindpay_sync.customers.list_auto_paging():
...
deposits = blindpay_sync.wallets.custodial.get_deposits_auto_paging({"customer_id": "cu_000000000000", "id": "wa_000000000000"})
Pagers only page forward (ending_before raises BlindPayError). Each page goes through the retry policy above;
an error that survives it raises BlindPayApiError.
Webhooks
Verify every delivery against the raw request body, before parsing it. No client or API key is needed:
from blindpay import webhooks
# Flask: request.get_data(); FastAPI/Starlette: await request.body()
raw_body = request.get_data()
if not webhooks.verify(raw_body, request.headers, secret): # secret: "whsec_..."
abort(400)
verify checks the Svix v1 signatures in svix-signature and rejects timestamps more than 5 minutes from now
(tolerance= changes that). Deduplicate deliveries on the svix-id header, and never log the secret.
To verify and parse in one step, use construct_event. It returns a typed WebhookEvent, a union of one
TypedDict per event that type checkers narrow on webhook_event. It raises WebhookVerificationError when the
signature or timestamp doesn't verify:
from blindpay import WebhookVerificationError, webhooks
try:
event = webhooks.construct_event(raw_body, request.headers, secret)
except WebhookVerificationError:
abort(400)
if event["webhook_event"] in ("payout.update", "payout.complete") and event.get("status") == "failed":
... # a failed payout can arrive on either event: branch on status, not on the event name
Events this SDK version doesn't know yet are returned as-is (UnknownWebhookEvent) instead of failing.
Uploads
upload.create and upload.analyze send multipart/form-data. Pass bytes or a binary file object:
with open("proof_of_address.pdf", "rb") as f:
response = await blindpay.upload.create({"bucket": "onboarding", "file": f})
file_url = response["data"]["file_url"]
The API checks the file's MIME type, which the SDK guesses from the filename (or the file's first bytes). Pass
filename and content_type to set them explicitly.
upload.presign({"file_url": file_url}) returns a short-lived signed URL (file_url, expires_at) to download an
uploaded file.
Upgrading to this release
No public method or type was removed. Things that behave differently:
- Retries and timeouts are on by default: each attempt times out after 60 s (httpx's default was 5 s), and
requests are retried up to 2 times as described above. Mutations carry an auto-generated
Idempotency-Key. Passmax_retries=0to get the old single-attempt behaviour. - Typing only (nothing changes at runtime; type checkers may report new warnings):
- Response fields the API can omit are
NotRequired, and nullable ones areOptional: read them with.get(). - Response enum fields are
Union[<known values>, str], so values added by the API later still type-check. - Request inputs follow the API's required fields: some keys became optional (
sender_wallet_address, quotebank_account_id, most customer fields), and a few the API always required are now required (nameon ACH/wire/SWIFT/RTP bank accounts, payin-quotecurrency_type/payment_method/request_amount/token, transfer-quote fields,banking_partner/blockchain_wallet_id/tokenon virtual accounts,nameoninstances.update). request_amountonquotes.createandpayins.quotes.createisint(cents), no longerfloat.retryableon errors is nowFalsefor a mutation that carried no idempotency key, and for a mutation 408.payouts.list,payins.listandpayables.listreturn the{data, pagination}envelope or a bare list (see Pagination);virtual_accounts.listreturns a list.
- Response fields the API can omit are
client.verify_webhook_signaturestill works but is deprecated: usewebhooks.verify/webhooks.construct_event.payouts.exportandpayins.exportcall a route that doesn't exist and are deprecated.
Types
The SDK includes comprehensive type definitions for all API resources and parameters. These can be imported from the main package:
from blindpay import (
AccountClass,
BankAccountType,
Country,
Currency,
CurrencyType,
Network,
Rail,
StablecoinToken,
TransactionDocumentType,
TransactionStatus,
PaginationParams,
PaginationMetadata,
# ... and more
)
Development
This SDK uses:
uvfor package managementhttpxfor HTTP (one pooled client per BlindPay client)typing_extensionsfor typing
License
MIT
Support
Metadata
Release files for blindpay 4.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| blindpay-4.0.1.tar.gz | 65.2 kB | Without provenance | Details for blindpay-4.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| blindpay-4.0.1-py3-none-any.whl | Python 3 | none | any | Details for blindpay-4.0.1-py3-none-any.whl |
Total release size: 152.7 kB
Release files / blindpay-4.0.1.tar.gz
| Download URL | blindpay-4.0.1.tar.gz |
|---|---|
| Size | 65.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c85ef1b494c6c843b0b9eeeac143de342dbe95104b5b5bf65fae65960dfc6c6
|
|
BLAKE2b-256 checksum How to use checksums |
4891ce915a6b22341bdf55657e9f891d04714d3a68b23976d1e4831a012b3e43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / blindpay-4.0.1-py3-none-any.whl
| Download URL | blindpay-4.0.1-py3-none-any.whl |
|---|---|
| Size | 87.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46a402296f40a4fb8c877c568393f5b6cd17ede06f4989bd7d775e4c012da1f3
|
|
BLAKE2b-256 checksum How to use checksums |
49b299d689d28b328e3c8287f57f3252ed61d3b949d23c55974d980e8fdfa18e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for blindpay 4.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.