Upload Cardholder File
Uploads one ID document image or proof of address for a cardholder. The returned file_id (chf_<id>) is then referenced in the identity of /cardholder/create or /cardholder/update.
This is the only OpenAPI endpoint that takes multipart/form-data instead of JSON.
AI check
Since v1.6.10, identity document images (identity_front / identity_back / identity_hand) go through an AI check before they are passed to the issuer (proof of address is not checked): whether the file is an identity document, whether it is a specimen / template (including published sample images whose name or photo has been replaced), whether it has been edited, whether the data on it is consistent, whether it is a screenshot or a photo of a screen, whether it is a photo of the original document, whether the correct side was uploaded, whether it is readable, whether the hand-held photo shows the person holding the document, and whether the identity printed on it (name + date of birth + nationality) belongs to a politically exposed person or a well-known public figure. Which findings fail the check depends on the strictness configured by the platform (the strictest by default).
- A check usually takes 3–6 seconds and at most about 20 seconds. Set your client timeout for this endpoint to at least 90 seconds.
- What happens when the AI check fails is a platform setting (the first option is the default):
- Reject: the request fails with one of the AI check errors under Common errors; the file is neither stored nor passed on — ask your end customer to take the photo again;
- Platform manual review: the upload succeeds with
ai_check_status=review_required; a cardholder referencing the file getsmanual_review_status=1and cannot open cards until the platform approves it.
- When the AI check is temporarily unavailable, uploads succeed as before (
ai_check_status=not_checked). - Uploading an identical image that previously failed returns the same result (judged against the current strictness if the platform has changed it).
- Each account has a limit on the number of AI checks per hour and per day, set by the platform (uploads here and identity checks on create / update count together). Over the limit the request fails with
cardholder_ai_check_too_frequentwhatever the failure handling above;data.retry_after_secondssays how long to wait. Re-sending with the sameIdempotency-Keyreturns the same error — retry later with a new key. - A PDF sent for an identity slot may have at most the number of pages set by the platform (2 by default; the platform may also accept no PDF at all). Too many pages:
cardholder_file_pdf_too_many_pages(data.max_pages= the limit); PDF not accepted:cardholder_file_pdf_not_accepted; a PDF whose pages cannot be counted (encrypted or damaged):cardholder_file_pdf_unreadable. Send identity documents as JPG / PNG photos where possible. - An identical image checked again within a period set by the platform (24 hours by default) reuses the earlier result and does not count towards the limit.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /api/v1/openapi/cardholder/files/upload |
| Content-Type | multipart/form-data |
| Auth | HMAC |
| Idempotency Key | Required via Idempotency-Key header |
| Max request body | 4 MB (the default; one file of up to 2 MB plus the multipart overhead fits well within it) |
Form Fields
Send purpose first, then file.
| Field | Type | Required | Description |
|---|---|---|---|
purpose | text | ✅ | identity_front (ID front) / identity_back (ID back) / identity_hand (cardholder holding the ID) / proof_of_address |
file | file | ✅ | One JPG, PNG or PDF file, at most 2 MB (2,097,152 bytes; the issuer's limit, lowered from 10 MB on 2026-10-27). The type is detected from the file content, not from the file name or the part's Content-Type |
The file can only be referenced in the slot matching its purpose (identity_front → identity.front_file_id, identity_back → identity.back_file_id, identity_hand → identity.hand_file_id, proof_of_address → identity.proof_of_address_file_id).
Signing a Multipart Request
The signature and the idempotency check both use the raw request body bytes — here the complete multipart body, boundaries included:
- Build the multipart body into a byte buffer first (fixed boundary).
BODY_SHA256_HEX= SHA-256 of exactly those bytes; sign as usual (HMAC Authentication).- Send exactly those bytes with
Content-Type: multipart/form-data; boundary=<your boundary>.
Do not let your HTTP client re-encode the form after signing (a new boundary changes the bytes → 401 openapi_invalid_credentials). When retrying with the same Idempotency-Key, resend the same bytes; a re-encoded body is a different body (409 openapi_idempotency_key_conflict).
import hashlib, uuid
boundary = "----cardholder" + uuid.uuid4().hex
with open("passport_front.jpg", "rb") as f:
content = f.read()
body = (
f"--{boundary}\r\n"
'Content-Disposition: form-data; name="purpose"\r\n\r\n'
"identity_front\r\n"
f"--{boundary}\r\n"
'Content-Disposition: form-data; name="file"; filename="front.jpg"\r\n'
"Content-Type: image/jpeg\r\n\r\n"
).encode() + content + f"\r\n--{boundary}--\r\n".encode()
body_sha256 = hashlib.sha256(body).hexdigest() # use in the signing input
headers = {
"Content-Type": f"multipart/form-data; boundary={boundary}",
"Idempotency-Key": str(uuid.uuid4()),
# + X-App-Id / X-Timestamp / X-Nonce / X-Signature
}
# send `body` unchangedResponse Fields
The File object:
| Field | Type | Description |
|---|---|---|
file_id | string | chf_<id> |
purpose | string | As uploaded |
content_type | string | Detected type: image/jpeg / image/png / application/pdf |
size | int | Bytes |
expires_at | string | null | Until when the file can still be referenced (RFC3339). Reference it in a create / update before then |
referenced | bool | false right after upload |
ai_check_status | string | AI check status: passed / review_required (failed, pending platform manual review) / not_checked (proof of address, or the AI check was unavailable) |
created_at | string | RFC3339 |
Example Response
{
"code": 0,
"message": "Success",
"data": {
"file_id": "chf_301",
"purpose": "identity_front",
"content_type": "image/jpeg",
"size": 482113,
"expires_at": "2026-11-25T08:00:00Z",
"referenced": false,
"ai_check_status": "passed",
"created_at": "2026-10-26T08:00:00Z"
}
}Common Errors
| HTTP | code | error_key | Description |
|---|---|---|---|
| 200 | 40000 | cardholder_file_purpose_invalid | purpose missing or not one of the four values |
| 200 | 40000 | cardholder_file_empty | file part missing, unreadable or empty |
| 200 | 40000 | cardholder_file_too_large | File larger than 2 MB |
| 200 | 40000 | cardholder_file_type_unsupported | Content is not JPG / PNG / PDF |
| 200 | 40000 | cardholder_file_rejected | The file was rejected as invalid (unsupported format or damaged content) — upload another file |
| 200 | 40000 | cardholder_upload_busy | Too many uploads right now — retry later with a new Idempotency-Key |
| 200 | 40000 | cardholder_file_not_identity_document | AI check: the file is not an identity document |
| 200 | 40000 | cardholder_file_no_person_holding_document | AI check: the hand-held photo does not show the person holding the document (face and document must both be clearly visible) |
| 200 | 40000 | cardholder_file_specimen | AI check: specimen or template document |
| 200 | 40000 | cardholder_file_unreadable | AI check: the document is blurry, too dark, has glare or is covered |
| 200 | 40000 | cardholder_file_public_figure | AI check: the identity on this document cannot be used to open cards — upload your end customer's own document |
| 200 | 40000 | cardholder_file_edited | AI check: the document photo appears to have been edited or altered |
| 200 | 40000 | cardholder_file_data_inconsistent | AI check: the data on the document is inconsistent (for example the machine-readable zone does not match the printed details) |
| 200 | 40000 | cardholder_file_screen_capture | AI check: a screenshot or a photo of a screen — photograph the original document directly |
| 200 | 40000 | cardholder_file_digital_copy | AI check: not a photo of the original document (a downloaded, electronic or composited image) |
| 200 | 40000 | cardholder_file_side_mismatch | AI check: the side does not match the upload slot (the front is the side with the holder's photo) |
| 200 | 40000 | cardholder_ai_check_too_frequent | Too many AI checks for this account (per-hour / per-day limit); data.retry_after_seconds is the wait in seconds — retry after that with a new Idempotency-Key |
| 200 | 40000 | cardholder_file_pdf_too_many_pages | The PDF has more pages than allowed (data.max_pages) — upload a photo of the document instead |
| 200 | 40000 | cardholder_file_pdf_not_accepted | PDF is not accepted for identity documents — upload a JPG / PNG photo |
| 200 | 40000 | cardholder_file_pdf_unreadable | The PDF's pages cannot be counted (encrypted or damaged) — upload a JPG / PNG photo |
| 401 | 40100 | openapi_invalid_credentials | Auth failure — also returned when the whole request body exceeds 11 MB |
| 200 | 50000 | cardholder_provider_unavailable / cardholder_service_not_configured | Temporarily unavailable / not enabled |
| 200 | 50000 | openapi_cardholder_failed | Server error |
Plus the shared Idempotency-Key (40000 / 409) and rate-limit (429) errors.
Notes
- The platform never returns file content — only the metadata above.
- A file is bound to the cardholder that first references it and cannot be reused by another cardholder (
cardholder_file_in_use); upload it again for another cardholder. - Uploading does not change any cardholder; nothing is used until a create / update references the
file_id.