Scan Document
Server-to-Server
Scan Document
Extract fields from a government-issued ID and run authenticity checks
POST
Scan Document
documentType, and an average extraction confidence score.
Request
Headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Content-Type | Yes | multipart/form-data or application/json |
Body parameters
The endpoint accepts the image either as raw multipart bytes or as a JSON string (base64, base64url, or an S3 key from an earlier presigned upload). See the overview for the shared image rules — accepted formats, the 15 MB limit, and when to prefer one over the other.| Parameter | Type | Required | Description |
|---|---|---|---|
image | binary | string | Yes | The image. For multipart, the file part. For JSON, a base64, base64url, or S3-key string. |
documentType | string | No | One of passport, drivers_license, national_id, auto. Defaults to auto. |
Example request
Response
200 — Success
| Field | Type | Description |
|---|---|---|
documentType | string | Normalized document type extracted from the image |
fullName | string | Full name as printed on the document |
firstName | string | First / given name |
lastName | string | Last / family name |
dateOfBirth | string | Date of birth as printed on the document |
gender | string | Gender as printed on the document |
nationality | string | Nationality as printed on the document |
documentNumber | string | Document number |
expirationDate | string | Document expiration date |
issuingCountry | string | Issuing country |
address | string | Address as printed on the document (when present) |
mrzData | string | Machine-readable zone, raw (passports / some IDs) |
rawFields | object | All fields returned by AWS Textract, keyed by Textract field name |
confidence | number (0–1) | Average extraction confidence across all detected fields |
Error responses
| Status | Description |
|---|---|
400 | Invalid body, unsupported image format, or image larger than 15 MB |
401 | Missing or invalid x-api-key |
402 | Insufficient token balance |
403 | The supplied image S3 key is not readable by this organization |
429 | Rate limit exceeded |
500 | Unexpected server error — safe to retry with backoff |
When to use /v1/identity/verify instead
If you also have a selfie and want a single round-trip that runs document scan + face detect + face compare in parallel, call /v1/identity/verify instead — it returns one aggregated payload with an overallConfidence score.