# Check a document

> Kontiga is document fraud detection by Bynn Intelligence for insurers, letting agents, lenders and HR screening teams: every document is compared with a proprietary library of more than 300 million original documents, gathered over 20 years.

Documentation index: https://kontiga.com/llms.txt

Section: Guides. URL: https://kontiga.com/docs/guides/check-a-document

Upload a document with no case, collection or person, and get its verdict, its findings and both scores. The same action as Check a document in the console, which takes up to 100 files or a folder at once.

Updated November 30, 2026

## Before you start

- A key with `documents:write`, or a member role of Owner, Admin or Analyst. A Developer checks documents in test mode.
- A PDF or a photo (JPEG, PNG, HEIC, HEIF, TIFF or WebP), up to 64 MB. A PDF is read up to its 50th page.
- In test mode, one of Kontiga's sample documents.

## Send the document

The CLI and the SDKs upload the file and create the document in one step. On the API it is two calls: `POST /v1/uploads` gives a presigned address to put the file at, then `POST /v1/documents` names the upload. The answer comes at once with the document's id.

API:

```bash
curl -X POST https://api.kontiga.com/v1/documents \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file_name": "bank-statement-may.pdf",
    "content_type": "application/pdf",
    "byte_size": 391168,
    "upload_id": "upl_4f1c9a2e7b3d4c5a8e6f0b1d2c3a4e5f",
    "wait": 10
  }'
```

CLI:

```bash
kontiga documents check bank-statement-may.pdf --wait 10
```

MCP tool `check_document`:

```json
{
  "name": "check_document",
  "arguments": {
    "file_name": "bank-statement-may.pdf",
    "content_type": "application/pdf",
    "byte_size": 391168,
    "upload_id": "upl_4f1c9a2e7b3d4c5a8e6f0b1d2c3a4e5f",
    "wait": 10
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";
import { openAsBlob } from "node:fs";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.documents.check({
  file: await openAsBlob("bank-statement-may.pdf"),
  wait: 10,
});
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.documents.check(file=open("bank-statement-may.pdf", "rb"), wait=10)
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Documents.Check(ctx, &kontiga.DocumentsCheckParams{
	File: kontiga.FileFromPath("bank-statement-may.pdf"),
	Wait: 10,
})
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.documents().check(DocumentsCheckParams.builder()
    .file(Path.of("bank-statement-may.pdf"))
    .wait(10)
    .build());
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Documents.CheckAsync(new DocumentsCheckOptions
{
    File = File.OpenRead("bank-statement-may.pdf"),
    Wait = 10,
});
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->documents->check([
    'file' => fopen('bank-statement-may.pdf', 'r'),
    'wait' => 10,
]);
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.documents.check(file: File.open("bank-statement-may.pdf"), wait: 10)
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .documents()
    .check(kontiga::documents::CheckParams {
        file: kontiga::File::open("bank-statement-may.pdf").await?,
        wait: 10,
        ..Default::default()
    })
    .await?;
```

> **Retry safely.** Send an `Idempotency-Key` header with every create. A retry with the same key within 24 hours gets the first answer, and never makes or bills a second document.

## Get the result

Three ways, whichever suits your code. Most integrations use the webhook and fetch only to show a document again.

Ways to get a result

| Way | How | When |
| --- | --- | --- |
| Wait | Pass `wait` up to 10 seconds. The answer is `201` once the first checks are done (their findings marked `provisional`, still no verdict) or the check ended in time, else `202` with the document as it stands. | A person is waiting on screen. |
| Webhook | `document.checked` with the verdict, or `document.failed`, signed with `Kontiga-Signature`. `document.checked_fast` says the first checks are done; it carries no verdict. | Servers. Delivered at least once, retried for 72 hours. |
| Fetch | Read the document at any time. While it is checked, `check.stage` says what it is doing (`queued`, `reading`, `checking` or `deciding`), `check.percent` how far it is, and `verdict` is `null`. Read the scores only once `check` is `null`. | Showing a document again. |

API:

```bash
curl -X GET https://api.kontiga.com/v1/documents/doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e \
  -H "Authorization: Bearer $KONTIGA_API_KEY"
```

CLI:

```bash
kontiga documents get doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e
```

MCP tool `get_document`:

```json
{
  "name": "get_document",
  "arguments": {
    "document_id": "doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e"
  }
}
```

TypeScript:

```typescript
import Kontiga from "@kontiga/sdk";

const kontiga = new Kontiga(); // reads KONTIGA_API_KEY
const result = await kontiga.documents.get("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e");
```

Python:

```python
from kontiga import Kontiga

kontiga = Kontiga()  # reads KONTIGA_API_KEY
result = kontiga.documents.get("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e")
```

Go:

```go
client := kontiga.NewClient() // reads KONTIGA_API_KEY
result, err := client.Documents.Get(ctx, "doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e")
if err != nil {
	return err
}
```

Java:

```java
Kontiga kontiga = Kontiga.fromEnv(); // reads KONTIGA_API_KEY
var result = kontiga.documents().get("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e");
```

.NET:

```csharp
var kontiga = new KontigaClient(); // reads KONTIGA_API_KEY
var result = await kontiga.Documents.GetAsync("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e");
```

PHP:

```php
$kontiga = new \Kontiga\Client(); // reads KONTIGA_API_KEY
$result = $kontiga->documents->get('doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e');
```

Ruby:

```ruby
require "kontiga"

kontiga = Kontiga::Client.new # reads KONTIGA_API_KEY
result = kontiga.documents.get("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e")
```

Rust:

```rust
let kontiga = kontiga::Client::from_env()?; // reads KONTIGA_API_KEY
let result = kontiga
    .documents()
    .get("doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e".into())
    .await?;
```

## Read the verdict

The verdict comes only once every check has finished, never while one runs. Start from the verdict, then read the tags behind it. A fraud tag says what was found and where on the page; an information tag is a fact to weigh; a positive tag speaks for the document. The two scores are separate: one for changes to the file, one for fraud for this type of document. A document the checks could not finish on reads Review, and `verdict_reason` says why. See [Verdicts and scores](https://kontiga.com/docs/concepts/verdicts-and-scores).

> **On the free start.** Before the workspace has a plan, a check of your own document shows its verdict, both scores and how many findings of each kind it has, in `details_locked.counts`. Which findings, where and the fields show once you choose a plan, for the documents checked before it too. Samples and test mode show everything.

## When it does not go through

Failures to plan for

| Answer | Means | Do |
| --- | --- | --- |
| `400 invalid_input` at the upload | The file is over 64 MB, or not a PDF or a supported photo. | Send a smaller scan, or convert it to PDF. |
| `409 upload_not_received` | The file was not PUT to its upload address. | PUT it, then check it. |
| `409 upload_consumed` | The upload was checked already. | Upload the file again. |
| `422 file_type_mismatch` | The file's bytes are not the type it was uploaded as. | Upload it with its own type. |
| `422 test_mode_sample_only` | A test key sent a file that is not a sample. | Use a sample, or a live key. |
| `402 insufficient_credit` | The free start and the credit are used: `details.reason` says which. | Add credit, or choose a plan. |
| `document.failed` | The checks could not finish on Kontiga's side. | Nothing is charged. Check it again. |

## Test mode

A test key, or the console's test switch, checks Kontiga's sample documents only, with the real checks and never billed: a payslip, a bank statement, an identity card as a PDF and as a photo, a utility bill, an invoice and an employment contract. Download them from the Documents page of the console in test mode. Any other file answers `422 test_mode_sample_only`. A sample shows everything wherever it is checked.

## Put it in a case later

A checked document can join a case at any time, and keeps its result. See [Cases](https://kontiga.com/docs/cases).
