Upload an ID and a selfie you already hold, start server-to-server verification, and wait for basic KYC to complete.
9 min read
This recipe uploads an ID and a selfie you already hold, starts server-to-server verification and waits for basic KYC to complete.
Who it is for. A remittance app whose own sign-up screen already captures Kofi's Ghana card, front and back, and a selfie. The app wants no hosted page.
Status. Available. This flow records no liveness check, which matters only if he later needs a card. In sandbox every finished review completes.
Money example
1.
Kofi has no completed KYC, so on the standard limits he can move 500.00 USD a day.
2.
You upload his card and selfie and start verification. Gravv verifies him, and his limit becomes 50,000.00 USD a day.
3.
His 800.00 USD monthly rent payout now goes through without a limits pause.
Before you start
•
Kofi exists as a customer (create him), here with address country GH. His basic row is not completed.
•
A scoped key needs customer:update.
•
Files are JPEG, PNG or PDF. The selfie is JPEG or PNG. Each file can be at most 5 MB. In sandbox, keep each file under 500 KB, because sandbox refuses requests of about 600 KB or more.
•
Gravv does not deduplicate a request body over 1 MiB under its Idempotency-Key. A file over about 770 KB makes a body that large, so a retried upload of it runs again instead of returning the first response. After a timeout, read the documents list before you upload again.
•
Gravv bills every server-to-server start. Call it once, when the set is complete.
Find out what is required
•
A person needs one identity document (ID_CARD, PASSPORT or DRIVERS) with a FRONT_SIDE image, a BACK_SIDE upload for a two-sided card, and one SELFIE. Gravv accepts PROOF_OF_ADDRESS and TAX_DECLARATION but does not require them.
Each upload's message lists what is still required. If anything is missing, the start fails with DOCUMENTS_MISSING and lists it, without a fee, so you can use the start as the check.
Steps
1. Upload the ID front
content is the whole file as plain base64, with no data:image/jpeg;base64, prefix. The samples here shorten it.
Uploading the same type and side again replaces the earlier file. With the selfie in, the message reads Document saved. All required documents are uploaded; call POST /v1/customers/kyc/start-s2s with customer_id 9d2f4b6a-1c3e-4a5b-8d7f-2e4a6c8e0b13 to submit them for verification.
"message": "KYC verification initiated. Status will be updated via webhook."
},
"error": null
}
On a business that Gravv set up for automatic verification, the response is {"status": "completed", "message": "KYC auto-approved for this tenant."}, and no further step is needed.
The review refused the submission. The message gives its reason, and Kofi's KYC stays unsubmitted
Upload what the message asks for, then start again with a new key
400 DOCUMENT_REJECTED: …
The review refused one file. The message names its type and side, its document_id and the reason, such as Image is too small
Upload a corrected file with the same idDocType and idDocSubType, then start again with a new key
409 KYC_ALREADY_COMPLETED: KYC for customer 9d2f4b6a-1c3e-4a5b-8d7f-2e4a6c8e0b13 is already completed, so its documents can't be replaced. … on upload
Kofi is verified, so his documents are locked
No action is needed
400 INVALID_REQUEST: document content is not valid base64
The content has a data: prefix, line breaks or URL-safe base64
Send plain standard base64 of the file
400 INVALID_REQUEST: unsupported file type "image/gif"; allowed types are JPEG, PNG, and PDF
Gravv reads the type from the content and ignores the file name
Convert the file
413 the uploaded file is too large — the maximum is 5MB
In sandbox, any request of about 600 KB or more, whatever the message says. In live, a file over about 5 MB
Compress or resize it to under 500 KB in sandbox, or 5 MB or less in live
400 INVALID_REQUEST: metadata.idDocSubType is required for identity document uploads (e.g. FRONT_SIDE, BACK_SIDE)
The ID has no side
Add FRONT_SIDE or BACK_SIDE
400 INVALID_REQUEST: metadata.number is required for identity document uploads
The document number (or validUntil) is missing
Add it, with dates as YYYY-MM-DD
400 INVALID_REQUEST: metadata.country is required
The ID has no country
Send a two- or three-letter country code
400 INVALID_DOCUMENT_TYPE: unknown idDocType "SELFIE_VIDEO"; use PASSPORT, ID_CARD or DRIVERS (idDocSubType FRONT_SIDE or BACK_SIDE), SELFIE, …
The type is unknown. Gravv checks the type before the other fields
Use one of the listed types
400 INVALID_DOCUMENT_TYPE: idDocSubType "FRONT" doesn't fit idDocType ID_CARD; use FRONT_SIDE or BACK_SIDE
The sub-type is not one this type takes
Send FRONT_SIDE or BACK_SIDE
400 DOCUMENT_TYPE_NOT_ALLOWED: idDocType COMPANY_DOC can't be uploaded on customer 9d2f4b6a-1c3e-4a5b-8d7f-2e4a6c8e0b13: only business customers take company documents. …
Company documents go on a business, not on a person
Upload only Kofi's own documents
500 failed to upload documents to verification provider
Gravv does not check validUntil on upload, so Gravv stores 03/05/2031 as written. Always send YYYY-MM-DD, or the review may not read it.
Webhooks you will receive
You receive customer.kyc.status.pending after the start, then customer.kyc.status.completed or customer.kyc.status.failed with failure_reason. Deduplicate webhooks on the body's event_id. See Customer and KYC events.
Testing in sandbox
Uploads, the documents list and the start work with a grvSec_sandbox_ key. Use small real JPEGs under 500 KB. Gravv reads the type from the content, so it refuses a renamed text file. A finished review completes a few minutes later, and sandbox never produces a failed review. To test the "completes on upload" path, ask support to set up your sandbox business for automatic verification.