> ## Documentation Index
> Fetch the complete documentation index at: https://docs.idmetagroup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction to Document OCR

> Extract structured data from identity documents without creating a Trust Validation.

## Overview

Document OCR endpoints extract structured fields from a supported identity document — a KTP, Kartu Keluarga, NPWP, driving licence, passport, or Philippine ID card — and return them in the same request/response cycle. Like the rest of the [Stateless Verification API](/stateless-verification-api/introduction), there is no `trustValidationId`, no session, and no separate finalize step.

<Note>
  Extracted fields are returned to the caller and **never stored**. The transaction record keeps only the outcome and quality signals (outcome, status, confidence, missing-field count, time to verify, and — for the Philippines plan — the classified document type). Cropped image regions (`photo`, `signature`) are never returned or persisted, and are always `null`.
</Note>

## Endpoints

### Indonesia

| Verification type                                                                                                     | Method | Path                                                                             |
| --------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| [KTP Details Extraction](/stateless-verification-api/document-ocr/ktp-details-extraction)                             | POST   | `/api/v3/verifications/indonesia/ktp-details-extraction-passthrough`             |
| [Kartu Keluarga Details Extraction](/stateless-verification-api/document-ocr/kartu-keluarga-details-extraction)       | POST   | `/api/v3/verifications/indonesia/kartu-keluarga-details-extraction-passthrough`  |
| [NPWP Details Extraction](/stateless-verification-api/document-ocr/npwp-details-extraction)                           | POST   | `/api/v3/verifications/indonesia/npwp-details-extraction-passthrough`            |
| [Driving Licence Details Extraction](/stateless-verification-api/document-ocr/idn-driving-license-details-extraction) | POST   | `/api/v3/verifications/indonesia/driving-license-details-extraction-passthrough` |
| [Passport Details Extraction](/stateless-verification-api/document-ocr/idn-passport-details-extraction)               | POST   | `/api/v3/verifications/indonesia/passport-details-extraction-passthrough`        |

### Philippines

| Verification type                                                                                               | Method | Path                                                                        |
| --------------------------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------- |
| [Document Details Extraction](/stateless-verification-api/document-ocr/philippines-document-details-extraction) | POST   | `/api/v3/verifications/philippines/document-details-extraction-passthrough` |

## Request

All six endpoints take the same request shape:

| Field           | Type           | Required     | Notes                                                                                                                                                                 |
| --------------- | -------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `documentImage` | file or string | Yes          | Multipart file upload, or a base64 string (raw or `data:` URI). Accepts JPG, JPEG, PNG, and PDF, up to 2 MB.                                                          |
| `metadata`      | object         | No           | Free-form correlation data. Echoed back unchanged in the response.                                                                                                    |
| `documentTypes` | —              | Not accepted | Rejected with a 400 if supplied. There is no template to bound the accepted list against on a stateless call — the response reports whichever document type it found. |

## Reading the response

Every response — success or failure — includes:

```
success, message, verificationStatus, verificationStatusCode,
transactionId, verificationType, metadata, createdAt
```

A successful response also includes `data`. A coded failure includes `code` instead — the two never appear together.

### Status codes

| `verificationStatus` | `verificationStatusCode` | Meaning                                                             |
| -------------------- | ------------------------ | ------------------------------------------------------------------- |
| `VERIFIED`           | 3                        | Every required field was read from the document.                    |
| `REVIEW_NEEDED`      | 2                        | Some required fields could not be read; check `data.missingFields`. |
| `REJECTED`           | 1                        | The document was read, but is not the expected type.                |
| `FAILED`             | 6                        | The request could not be completed — see [Errors](#errors) below.   |

`REVIEW_NEEDED` and `REJECTED` are still returned as HTTP `200` — the call succeeded and the engine produced an answer, it's just not a clean extraction. Only `FAILED` corresponds to a non-2xx response.

### Per-field confidence

Extracted values are returned as `{"value": ..., "confidence": "99.35%"}` whenever the value can be traced back to scored OCR text. Values that cannot be scored — `null` results, empty strings, and classification fields such as `documentType` — are returned bare, without a confidence wrapper. Confidence reflects transcription certainty, not correctness of the underlying document.

## Errors

| Code                  | HTTP | Meaning                                                                                                  |
| --------------------- | ---- | -------------------------------------------------------------------------------------------------------- |
| `VALIDATION_FAILED`   | 400  | The request body or the submitted image failed validation. Fix the field named in `errors` and resubmit. |
| `SOURCE_UNAVAILABLE`  | 500  | The OCR provider could not be reached, timed out, or returned no result. Safe to retry.                  |
| `INTERNAL_ERROR`      | 500  | A fault on IDmeta's side. Safe to retry; include the `transactionId` if you escalate.                    |
| `INSUFFICIENT_CREDIT` | 402  | Your account holds a plan for this verification type but has no credit remaining.                        |

A `401` is returned for a missing or invalid bearer token, and a `403` if your account has no plan configured for the verification type at all.

## Billing

| Result                | Billed                                      |
| --------------------- | ------------------------------------------- |
| `VERIFIED` (200)      | Yes                                         |
| `REVIEW_NEEDED` (200) | Yes                                         |
| `REJECTED` (200)      | Yes — the engine returned a complete answer |
| Any 400               | No                                          |
| Any 500               | No                                          |
| 401 / 402 / 403       | No                                          |
