Skip to main content

API Quickstart

Use the Cogneris API when another system needs to submit documents and consume structured results.

Let your AI assistant do it

Connect your editor to the Cogneris MCP server and ask for the integration instead — the assistant reads this API's contract, creates the key and writes the code. See the prompt cookbook.

Bank CAN — API: Cogneris document APIs: classify, extract and face match in one call Watch on YouTube

Before You Start​

  • Confirm API access is enabled for your tenant.
  • Generate an API key and keep it in an environment variable such as COGNERIS_API_KEY — never in source control.
  • Use the API host of your tenant's region: https://api-eu.cogneris.ai (Europe, where new tenants are created) or https://api-us.cogneris.ai (United States). A key works only in its own region.

Workflow​

  1. Send the document as multipart/form-data with the key in the Authorization: Bearer header.
  2. Parse the response body as JSON.
  3. Check hasErrors and the HTTP status, then read the result from data.
  4. Log the request identifiers or support details when a request fails.
caution

Some Cogneris backend responses are returned with Content-Type: text/plain while the body contains JSON. API clients should parse the response body as JSON even when the content type is not application/json.

Use a production key

The synchronous /Document/* endpoints, including the example below, accept only a production key (xtkt_live_). A sandbox key (xtkt_test_) — the kind an AI assistant creates unless you ask for production — is refused with 403 and the code environment.sandbox_route_unavailable. Sandbox keys cover only the asynchronous job flow; see API Examples.

Example​

Extract the fields of an invoice:

curl -X POST "https://api-eu.cogneris.ai/Document/extraction" \
-H "Authorization: Bearer $COGNERIS_API_KEY" \
-F "file=@./invoice.pdf"

The answer carries the extracted fields in data.metadata.fields. Accepted files: .pdf, .png, .jpg, .jpeg, .tiff, .tif, .bmp, .doc, .docx, up to 10 MB. The limit is 50 requests per minute per key.