Skip to content

GuidesDetect

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

Ask about this pageRead this page as Markdown

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.

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
  }'

POST /v1/documents

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
WayHowWhen
WaitPass 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.
Webhookdocument.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.
FetchRead 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.
curl -X GET https://api.kontiga.com/v1/documents/doc_0193f6a2c5e27b3a9d4e1f6a7b8c9d0e \
  -H "Authorization: Bearer $KONTIGA_API_KEY"

GET /v1/documents/{document_id}

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.

When it does not go through

Failures to plan for
AnswerMeansDo
400 invalid_input at the uploadThe 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_receivedThe file was not PUT to its upload address.PUT it, then check it.
409 upload_consumedThe upload was checked already.Upload the file again.
422 file_type_mismatchThe file’s bytes are not the type it was uploaded as.Upload it with its own type.
422 test_mode_sample_onlyA test key sent a file that is not a sample.Use a sample, or a live key.
402 insufficient_creditThe free start and the credit are used: details.reason says which.Add credit, or choose a plan.
document.failedThe 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.