Skip to content

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 gets manual_review_status=1 and 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_frequent whatever the failure handling above; data.retry_after_seconds says how long to wait. Re-sending with the same Idempotency-Key returns 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 ​

ItemValue
MethodPOST
Path/api/v1/openapi/cardholder/files/upload
Content-Typemultipart/form-data
AuthHMAC
Idempotency KeyRequired via Idempotency-Key header
Max request body4 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.

FieldTypeRequiredDescription
purposetext✅identity_front (ID front) / identity_back (ID back) / identity_hand (cardholder holding the ID) / proof_of_address
filefile✅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:

  1. Build the multipart body into a byte buffer first (fixed boundary).
  2. BODY_SHA256_HEX = SHA-256 of exactly those bytes; sign as usual (HMAC Authentication).
  3. 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).

python
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` unchanged

Response Fields ​

The File object:

FieldTypeDescription
file_idstringchf_<id>
purposestringAs uploaded
content_typestringDetected type: image/jpeg / image/png / application/pdf
sizeintBytes
expires_atstring | nullUntil when the file can still be referenced (RFC3339). Reference it in a create / update before then
referencedboolfalse right after upload
ai_check_statusstringAI check status: passed / review_required (failed, pending platform manual review) / not_checked (proof of address, or the AI check was unavailable)
created_atstringRFC3339

Example Response ​

json
{
  "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 ​

HTTPcodeerror_keyDescription
20040000cardholder_file_purpose_invalidpurpose missing or not one of the four values
20040000cardholder_file_emptyfile part missing, unreadable or empty
20040000cardholder_file_too_largeFile larger than 2 MB
20040000cardholder_file_type_unsupportedContent is not JPG / PNG / PDF
20040000cardholder_file_rejectedThe file was rejected as invalid (unsupported format or damaged content) — upload another file
20040000cardholder_upload_busyToo many uploads right now — retry later with a new Idempotency-Key
20040000cardholder_file_not_identity_documentAI check: the file is not an identity document
20040000cardholder_file_no_person_holding_documentAI check: the hand-held photo does not show the person holding the document (face and document must both be clearly visible)
20040000cardholder_file_specimenAI check: specimen or template document
20040000cardholder_file_unreadableAI check: the document is blurry, too dark, has glare or is covered
20040000cardholder_file_public_figureAI check: the identity on this document cannot be used to open cards — upload your end customer's own document
20040000cardholder_file_editedAI check: the document photo appears to have been edited or altered
20040000cardholder_file_data_inconsistentAI check: the data on the document is inconsistent (for example the machine-readable zone does not match the printed details)
20040000cardholder_file_screen_captureAI check: a screenshot or a photo of a screen — photograph the original document directly
20040000cardholder_file_digital_copyAI check: not a photo of the original document (a downloaded, electronic or composited image)
20040000cardholder_file_side_mismatchAI check: the side does not match the upload slot (the front is the side with the holder's photo)
20040000cardholder_ai_check_too_frequentToo 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
20040000cardholder_file_pdf_too_many_pagesThe PDF has more pages than allowed (data.max_pages) — upload a photo of the document instead
20040000cardholder_file_pdf_not_acceptedPDF is not accepted for identity documents — upload a JPG / PNG photo
20040000cardholder_file_pdf_unreadableThe PDF's pages cannot be counted (encrypted or damaged) — upload a JPG / PNG photo
40140100openapi_invalid_credentialsAuth failure — also returned when the whole request body exceeds 11 MB
20050000cardholder_provider_unavailable / cardholder_service_not_configuredTemporarily unavailable / not enabled
20050000openapi_cardholder_failedServer 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.

Released under MIT-equivalent terms.