Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Card KYC Upload a cardholder KYC document

Upload a cardholder KYC document

Stores one document file for a cardholder. This is step 1 of server-to-server card KYC. Nothing is sent for review until you call `POST /v1/risk/start-kyc-s2s`.

POSThttps://api.gravv.xyz/v1/risk/upload-documentTry it
Api-Key

Stores one document file for a cardholder. This is step 1 of server-to-server card KYC. Nothing is sent for review until you call POST /v1/risk/start-kyc-s2s.

Check data.status. A validation failure returns HTTP 200 with data.status: error and a generic message. Common causes are a two-letter country, a file name that does not end in .jpg, .jpeg, .png or .pdf, a PDF selfie, or a date that is not YYYY-MM-DD.

Every upload is stored as a front image. Send the back of a card as a second upload with idDocSubType: BACK_SIDE. Uploading the same type and subtype again replaces the earlier file. Keep files under 5 MB.

Headers

NameDescription
Idempotency-Key:stringRequired
Required for POST requests. 1 to 255 printable ASCII characters. A retry with the same key and body within 24 hours returns the first response.

Body parameters

NameDescription
customer_id:stringRequired
ID of the customer this document belongs to
metadata:objectRequired
Show 11 child attributesobject
content:stringRequired
The file as plain standard base64. The decoded file must be a JPEG, PNG or PDF. Keep files under 5 MB. Larger files fail with a 400.
filename:stringRequired
Name of the file. It must end in .jpg, .jpeg, .png or .pdf, in any case.

Response

Returns 200 OK. Document stored, or a validation failure with data.status: error

NameDescription
data:oneOfRequired
One of the following variants:
Show 10 child attributesoneOf
error:nullRequired

Errors

StatusMeaning
200Document stored, or a validation failure with data.status: error
400Invalid customer, missing KYC record, or a file that is too large
409A request with the same Idempotency-Key is still running.
413The request body is too large.
422The Idempotency-Key was used before with a different body.
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/risk/upload-document' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: card-kyc-b84d9a52-attempt-1' \
--header 'Content-Type: application/json' \
--data '{
"customer_id": "b84d9a52-2978-43e5-9b86-eac9839e1146",
"metadata": {
"idDocType": "passport",
"idDocSubType": "FRONT_SIDE",
"country": "USA",
"firstName": "John",
"middleName": "Michael",
"lastName": "Doe",
"issuedDate": "2020-01-15",
"validUntil": "2030-01-15",
"number": "A12345678",
"dob": "1990-05-20",
"placeOfBirth": "New York, NY"
},
"content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"filename": "passport_front.png"
}'
Responseapplication/json
200400409413422OK
{
"data": {
"status": "success",
"customer_id": "b84d9a52-2978-43e5-9b86-eac9839e1146",
"document_type": "PASSPORT",
"document_sub_type": "FRONT_SIDE",
"country": "USA",
"message": "Document saved. Use /initiate-kyc to submit for verification."
},
"error": null
}