> Toden documentation. For the full index fetch /llms.txt. Every page is available as Markdown by appending .md to its URL. Every endpoint is under /api/v1. Identity verification and Risk Intelligence are separate contracts there with different error shapes; /api/kyc and /api/identity are older prefixes that still answer the same. Never invent an endpoint, field or enum value: read the API reference page for the operation first.

# Check an identity document

POST https://sandbox-api.toden.co/api/v1/checks/document
Content-Type: application/json

Reads an identity document (a passport, a national ID card, a driving licence) on its own, with no verification, the way a verification reads one: the printed fields, then the document's own MRZ and barcode, which win where they agree with their check digits. With `documentLiveness` (on unless sent false) it also examines the document itself for a photo of a screen, a screenshot, a photocopy, a replaced portrait or signs of editing.

Upload the front first with `POST /api/kyc/upload` (multipart `file` and `type=document_front`; JPEG, PNG or WebP) and, for a two-sided document such as an ID card, the back with `type=document_back`; then send their `mediaId`s here within 30 minutes. From Spot Checks a PDF is accepted too, read by its first page.

By default an MRZ that fails its check digits, an expired document, printed text the MRZ or barcode contradicts, a screen photo, photocopy, replaced portrait or editing, and (when `minimumAge` is sent) a holder younger than it fail the check; no expiry date read and a layout that does not fit send it to review. `rules` changes what each finding does. A document that cannot be read is `unavailable` with `failureCode` `unreadable` and is not charged.

Charged at your Verifications document reading price. In sandbox the document is not read: a sample passport marked `result.sample` comes back (holder born 14 May 1990), and `idType` picks the outcome (`sample-expired`, `sample-screen-photo`, `sample-invalid-mrz`, `sample-inconsistent` fail, `sample-unreadable` unavailable, anything else pass).

Rules: send `rules` to set what each finding does (`decline` fails the check, `review` sends it to review, `approve` keeps it as a note and passes) and to change the check's settings. Anything left out takes your organisation's saved default rules (set in Spot Checks), else Toden's, which judge the check as it was judged before rules existed. `result.rules` says which rules the check ran under, where each came from and what each finding did.

Charged per check at your price (production only); a check that could not be completed is not charged. Send a `requestId`: a retry with the same value returns the same check with `replayed: true`, without running or charging again.

**Error codes**

| `error` | Status | Meaning |
|---|---|---|
| `invalid_input` | 400 | The body is missing something the check needs, or the requestId is malformed. |
| `insufficient_credits` | 402 | Your balance cannot cover the check. Nothing was run or charged. |
| `checks_unavailable` | 403 | These checks are not switched on for your organisation yet. |
| `spot_checks_disabled` | 403 | Spot checks are not enabled for your organisation. |
| `request_id_reused` | 409 | The requestId was used for a different check. |
| `check_in_progress` | 409 | A check with this requestId is still running. |
| `file_not_found` | 422 | The uploaded file was not found, is not yours, or has expired. |
| `check_unavailable` | 503 | The check cannot run on this deployment right now. Nothing was charged. |
| `secret_key_required` | 403 | A publishable key was used. This endpoint accepts secret keys only. |
| `environment_mismatch` | 403 | The key belongs to an environment this deployment does not serve. |
| `ip_not_allowed` | 403 | The key has an IP allowlist and the calling address is not on it. |
| `organization_suspended` | 403 | The organisation is suspended. The response carries `reason` and `suspendedAt`. |
| `business_not_approved` | 403 | A live key was used before the business was approved for production. |

A missing or unknown key answers `401`, where `error` is a short sentence rather than a code.

Requires a secret (`sk_`) key. A publishable key receives `403 secret_key_required`.

Reference: https://docs.toden.co/api-reference/verification/standalone-checks/create-document-check

## Authentication

- `Authorization` header (bearer token, required) — Send the API key as a Bearer token. Each operation states whether a publishable key is enough or a secret key is required. A scoped publishable key has Verification flow access, the fixed set `flow.run`, `flow.config.read` and `verifications.status.read`; a scoped secret key reaches what its scopes allow.

## Servers

- `https://sandbox-api.toden.co` (Sandbox, default)
- `https://api.toden.co` (Production)

## Request

### Body (application/json)

This endpoint expects a DocumentCheckRequest.

- `frontMediaId` (string, required) — The `mediaId` from uploading the front with `type=document_front`.
- `requestId` (string, required) — Your idempotency key, 8 to 120 characters: a retry with the same value returns the same check.
- `backMediaId` (string, optional) — The `mediaId` from uploading the back with `type=document_back`, for two-sided documents.
- `country` (string, optional) — The issuing country, when known (ISO 3166-1 alpha-2).
- `idType` (string, optional) — The ID type, when known, for example `passport` or `drivers-license`. Left out, the kind is recognised.
- `documentLiveness` (boolean, optional, default: true) — Examine the document itself. On unless sent false.
- `externalUserId` (string, optional) — Your own reference for the check (a customer or case id), kept with it and searchable in your history.
- `rules` (DocumentCheckRequestRules, optional) — What each finding does, and the check's settings. Defaults: `expiry_not_detected` and `template_mismatch` review, the rest decline.

## Response

### 200

A retry: the check already run under this requestId.

- `id` (string, required) — The check id (`chk_…`).
- `kind` (enum, required) — Which check this is.
  - Allowed values: `document`
- `outcome` (enum, required) — `pass`: nothing of concern. `review`: something a person should look at. `fail`: a clear problem. `unavailable`: the check could not be completed, was not charged, and is never a pass.
  - Allowed values: `pass`, `review`, `fail`, `unavailable`
- `subject` (string, required) — What was checked, as your history lists it.
- `channel` (enum, required) — Whether the check was run through the API or from the dashboard.
  - Allowed values: `api`, `dashboard`
- `createdAt` (datetime, required) — When the check was run.
- `input` (DocumentCheckInput, optional) — What was sent, minimised: never image bytes, only media ids.
- `externalUserId` (string, optional, nullable) — Your own reference for the check, as sent.
- `result` (DocumentCheckResult, optional, nullable) — What was found. Null when the check could not be completed.
- `failureCode` (string, optional, nullable) — Why the check could not be completed, when `outcome` is `unavailable`.
- `charged` (string, optional, nullable) — What the check cost in USD, as a decimal string. Null when nothing was charged.
- `entityId` (string, optional, nullable) — The customer record this check was saved to.
- `completedAt` (datetime, optional, nullable) — When it finished.
- `replayed` (boolean, optional) — On a run only: true when this is a check already run under the same `requestId`.

### 201

The check was run.

- `id` (string, required) — The check id (`chk_…`).
- `kind` (enum, required) — Which check this is.
  - Allowed values: `document`
- `outcome` (enum, required) — `pass`: nothing of concern. `review`: something a person should look at. `fail`: a clear problem. `unavailable`: the check could not be completed, was not charged, and is never a pass.
  - Allowed values: `pass`, `review`, `fail`, `unavailable`
- `subject` (string, required) — What was checked, as your history lists it.
- `channel` (enum, required) — Whether the check was run through the API or from the dashboard.
  - Allowed values: `api`, `dashboard`
- `createdAt` (datetime, required) — When the check was run.
- `input` (DocumentCheckInput, optional) — What was sent, minimised: never image bytes, only media ids.
- `externalUserId` (string, optional, nullable) — Your own reference for the check, as sent.
- `result` (DocumentCheckResult, optional, nullable) — What was found. Null when the check could not be completed.
- `failureCode` (string, optional, nullable) — Why the check could not be completed, when `outcome` is `unavailable`.
- `charged` (string, optional, nullable) — What the check cost in USD, as a decimal string. Null when nothing was charged.
- `entityId` (string, optional, nullable) — The customer record this check was saved to.
- `completedAt` (datetime, optional, nullable) — When it finished.
- `replayed` (boolean, optional) — On a run only: true when this is a check already run under the same `requestId`.

## Errors

### 400 Bad Request Error

The request body, query or path was invalid.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 401 Unauthorized Error

The Authorization header is missing, or the API key is unknown or revoked.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 402 Payment Required Error

The organisation does not have enough credit for this request.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 403 Forbidden Error

The key may not call this endpoint, or the organisation may not use this feature.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 409 Conflict Error

The request conflicts with the current state of the resource.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 422 Unprocessable Entity Error

The request was understood but cannot be processed as sent.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

### 503 Service Unavailable Error

The service is temporarily unavailable.

- `error` (string, required) — A stable machine-readable code such as `invalid_input`. Authentication failures (401) carry a short sentence here instead of a code.
- `message` (string, optional) — A human-readable explanation, safe to log. The wording may change.

## Types

### DocumentCheckRequestRules

What each finding does, and the check's settings. Defaults: `expiry_not_detected` and `template_mismatch` review, the rest decline.

- `invalid_mrz` (enum, optional) — An MRZ was found and fails its own check digits.
  - Allowed values: `decline`, `review`, `approve`
- `expiry_not_detected` (enum, optional) — No expiry date was read.
  - Allowed values: `decline`, `review`, `approve`
- `expired` (enum, optional) — The expiry date has passed.
  - Allowed values: `decline`, `review`, `approve`
- `inconsistent_data` (enum, optional) — The printed text and the document's own code (MRZ or barcode) disagree. A name the code splits or shortens differently is the same name.
  - Allowed values: `decline`, `review`, `approve`
- `document_liveness` (enum, optional) — A photo of a screen, a screenshot, a photocopy, a replaced portrait or signs of editing. Only found when `documentLiveness` is on.
  - Allowed values: `decline`, `review`, `approve`
- `template_mismatch` (enum, optional) — The layout or wording does not fit the document's kind. Only found when `documentLiveness` is on.
  - Allowed values: `decline`, `review`, `approve`
- `under_minimum_age` (enum, optional) — Younger than `minimumAge`. Only found when `minimumAge` is sent.
  - Allowed values: `decline`, `review`, `approve`
- `minimumAge` (integer, optional) — The youngest the holder may be, in whole years from the date of birth read. Left out: no age is checked.

### DocumentCheckInput

What was sent, minimised: never image bytes, only media ids.

### DocumentCheckResult

What was found. Null when the check could not be completed.

- `sample` (boolean, optional) — True in sandbox: the document was not read and every value is a sample.
- `frontMediaId` (string, optional) — The uploaded front checked.
- `backMediaId` (string, optional, nullable) — The uploaded back checked, when one was sent.
- `reasons` (list of enum, optional) — Why the check is not a pass; empty on a pass.
  - Allowed values: `invalid_mrz`, `expiry_not_detected`, `expired`, `inconsistent_data`, `document_liveness`, `template_mismatch`, `under_minimum_age`
- `notes` (list of enum, optional) — What was found but approved by the rules.
  - Allowed values: `invalid_mrz`, `expiry_not_detected`, `expired`, `inconsistent_data`, `document_liveness`, `template_mismatch`, `under_minimum_age`
- `documentKind` (enum, optional) — What the document was recognised as.
  - Allowed values: `passport`, `drivers_license`, `national_id`, `voter_card`, `residence_permit`, `other`
- `issuingCountry` (string, optional, nullable) — The country that issued it, as read (or the `country` sent).
- `fields` (DocumentCheckResultFields, optional) — What was read. The document's own code (MRZ or barcode) wins over the printed text where both have a field.
- `sources` (map from string to enum, optional) — Where each field read came from.
  - Allowed values: `barcode`, `mrz`, `printed`
- `mrz` (DocumentCheckResultMrz, optional)
- `barcode` (boolean, optional) — A barcode was decoded and read.
- `inconsistencies` (list of DocumentCheckResultInconsistenciesItems, optional) — Where the printed text and the document's own code disagree.
- `age` (integer, optional, nullable) — Whole years, from the date of birth. Null when it was not read.
- `expired` (boolean, optional, nullable) — Null when no expiry date was read.
- `minimumAge` (integer, optional, nullable) — The `minimumAge` the check was judged against.
- `documentLiveness` (DocumentCheckResultDocumentLiveness, optional) — What examining the document itself found.
- `templateIssues` (list of string, optional) — What does not fit the document's kind, in a few words each.
- `checkedAt` (datetime, optional) — When the document was judged.
- `rules` (DocumentCheckResultRules, optional) — The rules this check was judged by.

### DocumentCheckResultFields

What was read. The document's own code (MRZ or barcode) wins over the printed text where both have a field.

- `documentNumber` (string, optional, nullable) — The document number.
- `lastName` (string, optional, nullable) — The surname.
- `firstName` (string, optional, nullable) — The first given name.
- `middleName` (string, optional, nullable) — Any further given names.
- `dateOfBirth` (date, optional, nullable) — The date of birth (YYYY-MM-DD).
- `expiryDate` (date, optional, nullable) — The expiry date (YYYY-MM-DD).
- `issueDate` (date, optional, nullable) — The issue date (YYYY-MM-DD).
- `sex` (string, optional, nullable) — M or F.
- `nationality` (string, optional, nullable) — The nationality, as the MRZ gives it (ISO 3166-1 alpha-3).

### DocumentCheckResultMrz

- `found` (boolean, optional)
- `valid` (boolean, optional) — Its ICAO check digits hold.
- `format` (enum, optional) — TD1 (ID cards) or TD3 (passports).
  - Allowed values: `TD1`, `TD3`

### DocumentCheckResultInconsistenciesItems

- `field` (string, optional) — The field.
- `printed` (string, optional) — As printed.
- `machineReadable` (string, optional) — As the code gives it.

### DocumentCheckResultDocumentLiveness

What examining the document itself found.

- `status` (enum, optional) — `not_checked`: switched off, or read by a reader that cannot examine it.
  - Allowed values: `clean`, `concerns`, `not_checked`
- `capture` (enum, optional) — How the image was made.
  - Allowed values: `paper_photo`, `screen_photo`, `screenshot`, `scan`, `photocopy`, `pdf_render`, `other`
- `portraitReplaced` (boolean, optional, nullable)
- `signs` (list of string, optional) — What looks altered, in a few words each. Never a name, a number or a date.

### DocumentCheckResultRules

The rules this check was judged by.

- `actions` (map from string to enum, optional) — Each finding's action.
  - Allowed values: `decline`, `review`, `approve`
- `settings` (DocumentCheckResultRulesSettings, optional) — Each setting's value.
- `source` (map from string to enum, optional) — Where each finding's action and each setting came from.
  - Allowed values: `default`, `organisation`, `request`
- `triggered` (list of DocumentCheckResultRulesTriggeredItems, optional) — The findings this check found, each with the action it took.

### DocumentCheckResultRulesSettings

Each setting's value.

### DocumentCheckResultRulesTriggeredItems

- `finding` (string, optional) — The finding.
- `action` (enum, optional) — What it did.
  - Allowed values: `decline`, `review`, `approve`

## Examples

### Example 1

**Request**

```json
{
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": {
    "minimumAge": 18
  }
}
```

**Response**

```json
{
  "id": "string",
  "kind": "document",
  "outcome": "pass",
  "subject": "string",
  "channel": "api",
  "createdAt": "2024-01-15T09:30:00Z",
  "input": {},
  "externalUserId": "string",
  "result": {
    "sample": true,
    "frontMediaId": "string",
    "backMediaId": "string",
    "reasons": [
      "invalid_mrz"
    ],
    "notes": [
      "invalid_mrz"
    ],
    "documentKind": "passport",
    "issuingCountry": "string",
    "fields": {
      "documentNumber": "string",
      "lastName": "string",
      "firstName": "string",
      "middleName": "string",
      "dateOfBirth": "2023-01-15",
      "expiryDate": "2023-01-15",
      "issueDate": "2023-01-15",
      "sex": "string",
      "nationality": "string"
    },
    "sources": {},
    "mrz": {
      "found": true,
      "valid": true,
      "format": "TD1"
    },
    "barcode": true,
    "inconsistencies": [
      {
        "field": "string",
        "printed": "string",
        "machineReadable": "string"
      }
    ],
    "age": 1,
    "expired": true,
    "minimumAge": 1,
    "documentLiveness": {
      "status": "clean",
      "capture": "paper_photo",
      "portraitReplaced": true,
      "signs": [
        "string"
      ]
    },
    "templateIssues": [
      "string"
    ],
    "checkedAt": "2024-01-15T09:30:00Z",
    "rules": {
      "actions": {},
      "settings": {},
      "source": {},
      "triggered": [
        {
          "finding": "string",
          "action": "decline"
        }
      ]
    }
  },
  "failureCode": "string",
  "charged": "string",
  "entityId": "string",
  "completedAt": "2024-01-15T09:30:00Z",
  "replayed": true
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/v1/checks/document"

payload = {
    "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
    "requestId": "document-check-2c81e0d4",
    "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
    "country": "GH",
    "documentLiveness": True,
    "rules": { "minimumAge": 18 }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/v1/checks/document';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"frontMediaId":"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8","requestId":"document-check-2c81e0d4","backMediaId":"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9","country":"GH","documentLiveness":true,"rules":{"minimumAge":18}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox-api.toden.co/api/v1/checks/document"

	payload := strings.NewReader("{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/v1/checks/document")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/v1/checks/document")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/v1/checks/document', [
  'body' => '{
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": {
    "minimumAge": 18
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/v1/checks/document");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": ["minimumAge": 18]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/v1/checks/document")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Request**

```json
{
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": {
    "minimumAge": 18
  }
}
```

**Response**

```json
{
  "id": "string",
  "kind": "document",
  "outcome": "pass",
  "subject": "string",
  "channel": "api",
  "createdAt": "2024-01-15T09:30:00Z",
  "input": {},
  "externalUserId": "string",
  "result": {
    "sample": true,
    "frontMediaId": "string",
    "backMediaId": "string",
    "reasons": [
      "invalid_mrz"
    ],
    "notes": [
      "invalid_mrz"
    ],
    "documentKind": "passport",
    "issuingCountry": "string",
    "fields": {
      "documentNumber": "string",
      "lastName": "string",
      "firstName": "string",
      "middleName": "string",
      "dateOfBirth": "2023-01-15",
      "expiryDate": "2023-01-15",
      "issueDate": "2023-01-15",
      "sex": "string",
      "nationality": "string"
    },
    "sources": {},
    "mrz": {
      "found": true,
      "valid": true,
      "format": "TD1"
    },
    "barcode": true,
    "inconsistencies": [
      {
        "field": "string",
        "printed": "string",
        "machineReadable": "string"
      }
    ],
    "age": 1,
    "expired": true,
    "minimumAge": 1,
    "documentLiveness": {
      "status": "clean",
      "capture": "paper_photo",
      "portraitReplaced": true,
      "signs": [
        "string"
      ]
    },
    "templateIssues": [
      "string"
    ],
    "checkedAt": "2024-01-15T09:30:00Z",
    "rules": {
      "actions": {},
      "settings": {},
      "source": {},
      "triggered": [
        {
          "finding": "string",
          "action": "decline"
        }
      ]
    }
  },
  "failureCode": "string",
  "charged": "string",
  "entityId": "string",
  "completedAt": "2024-01-15T09:30:00Z",
  "replayed": true
}
```

**SDK Code**

```python
import requests

url = "https://sandbox-api.toden.co/api/v1/checks/document"

payload = {
    "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
    "requestId": "document-check-2c81e0d4",
    "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
    "country": "GH",
    "documentLiveness": True,
    "rules": { "minimumAge": 18 }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://sandbox-api.toden.co/api/v1/checks/document';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"frontMediaId":"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8","requestId":"document-check-2c81e0d4","backMediaId":"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9","country":"GH","documentLiveness":true,"rules":{"minimumAge":18}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox-api.toden.co/api/v1/checks/document"

	payload := strings.NewReader("{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.toden.co/api/v1/checks/document")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox-api.toden.co/api/v1/checks/document")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.toden.co/api/v1/checks/document', [
  'body' => '{
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": {
    "minimumAge": 18
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.toden.co/api/v1/checks/document");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"frontMediaId\": \"med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8\",\n  \"requestId\": \"document-check-2c81e0d4\",\n  \"backMediaId\": \"med_8e7d6c5b4a39281706f5e4d3c2b1a0f9\",\n  \"country\": \"GH\",\n  \"documentLiveness\": true,\n  \"rules\": {\n    \"minimumAge\": 18\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "frontMediaId": "med_3f9a1c2b4d5e6f708192a3b4c5d6e7f8",
  "requestId": "document-check-2c81e0d4",
  "backMediaId": "med_8e7d6c5b4a39281706f5e4d3c2b1a0f9",
  "country": "GH",
  "documentLiveness": true,
  "rules": ["minimumAge": 18]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.toden.co/api/v1/checks/document")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```