Skip to main content

What it’s for

The Documents API checks one document on its own, without a selfie or liveness. It is the API version of the Documents (IDP) page (IDP: intelligent document processing). See B5 Document checks (in Sentinel’s in-app Help). You send one call to POST /v1/verify/document with a documentKind:
  • identity: passport, national ID (including both Kenyan cards, the second-generation ID and the Maisha card), driver’s licence or residence permit.
  • proof_of_address: utility bill, bank statement, salary slip, rental agreement and over 20 other types.
  • kra_pin: a Kenya Revenue Authority PIN certificate, for an individual or a company.
You can also send what the customer told you, such as their name, date of birth, address or KRA PIN, and Sentinel checks the document against it. Each document goes through file forensics, an AI reading of the fields and visual fraud signs, an independent OCR (optical character recognition) reading, and rule checks. The call is asynchronous. It returns an id at once, and the result arrives by webhook or from GET /v1/verify/{id}. Keys, test mode, rate limits and the general error format are in Quick start.

Who can use it

  • Any system holding an API key for your organization with the Run IDP document checks scope (verify:document). To read results by polling, the key also needs Read check results.
  • Admin and Developer create keys and choose their scopes on the API Keys page.
  • Everyone in your organization can open API checks on the Documents (IDP) page. Any document that doesn’t pass opens a review case for your team. See B11 Deciding a review case (in Sentinel’s in-app Help).
API Keys page with a key that has the Run IDP document checks scope

Step by step

The examples read the key from the SENTINEL_API_KEY environment variable, for example gt_test_.... The examples use Sentinel’s production address, https://robust-parakeet-542.convex.site. If API Keys shows a different API address for your organization, use that.

Prepare the file

  1. Use a JPEG, PNG, WebP or PDF. Sentinel reads the file type from its contents, not its name.
  2. Send the original file where you can. Resizing or re-saving removes the hidden data that reveals AI-generated or edited files.
  3. Base64-encode it. A data: prefix and line breaks are removed for you.
  4. Keep each file to 1,000,000 base64 characters, about 730 KB.
  5. For an identity card or licence, also send the back in documentBackBase64. The back of a Kenyan ID carries the MRZ (machine-readable zone: the coded lines that Sentinel checks digit by digit). Proof of address and KRA PIN certificates take one file only.

Verify an identity document

curl

Node (built-in fetch, Node 18+)

Python (requests)

Verify a proof of address or KRA PIN certificate

The call is the same. Change documentKind, send one file, and use the matching fields. For a proof of address:
For a KRA PIN certificate:

Collect the result

  1. Wait for the sentinel.scan.complete webhook with product idp. See Webhooks.
  2. Or poll GET /v1/verify/{id} until status is completed or failed. A completed document check carries a document object, described below. See Results and credits.
  3. Results usually take under a minute.
Document report for Amina Hassan Omar's Maisha card, opened from an API check

What each result means

Request fields

Text fields are at most 300 characters.

Response to the POST (202)

Verdicts

confidence is 1 minus riskScore / 100. Your Admin can send AI-generated or other fraud rejections to review instead, and can limit which proof of address types pass. See B5 Document checks (in Sentinel’s in-app Help).

The document object

The objects that don’t apply to the kind are null. A name matches at a score of 0.67 or more, an address at 0.6 or more.

Common flag codes

Errors specific to this call

When processing fails, failureReason is one of: “The front of the document is not a JPEG, PNG, WebP or PDF file.”, “The document could not be read. Try a clearer, uncropped image.” or “Document verification is temporarily unavailable; please retry.”

Common questions

How many credits does a document check cost?

On KES plans, an identity document or KRA PIN certificate costs 1 credit and a proof of address 2. On USD plans, identity and KRA cost 80 credits on Starter, 50 on Growth, 45 on Business and 30 on Enterprise; proof of address costs 110, 80, 70 and 65. A completed check is charged whatever the verdict. A failed check isn’t.

Does Sentinel keep the document image?

No. Sentinel reads the file and keeps only the extracted fields, checks and findings. Keep your own copy.

What does a test key return?

status completed, verdict pass and sandbox: true at once, with no charge. The field rules above still apply, so a bad expectedKraPin still gets 400.

Does a minor’s ID get rejected?

No. The Age 18+ check shows whether the holder is an adult, but doesn’t change the verdict. Read identity.isAdult if your product needs an adult.

Can I send a PDF bank statement?

Yes. The independent OCR cross-check reads single-page PDFs, so where you can, send just the page with the name, address and date.

Is a flag proof of fraud?

No. Flags are leads for a person to review. Check the original document before you act.