API Documentation

Cohesive offers common data extraction use cases, such as order data and metrics data, as templates. For maximum flexibility, you can define your own custom response schema.

API Overview

Cohesive's API can be accessed at the base URL of https://ocr.cohesiveapp.com. When making a request, be sure to include your provided API key as a bearer token in the request header.

Cohesive offers two options / endpoints for making a POST request. While both fundamentally work the same, the upload_async endpoint will send the extracted data as part of a webhook to a callback URL provided, whereas the upload endpoint returns the extracted data as part of an API response.

POST: uploadPOST: upload_async

Typically, we recommend the upload_async endpoint if you expect to be uploading large files or if you already have implemented callback/webhook processing functionality.

Cohesive Response Format

Cohesive's response will contain a data array that is an array of objects. Each object contains the following:

  • pageRange: The page(s) that the extraction covers

  • extraction: The extracted response, in the response schema specified, for the pages specified

Cohesive will attempt to process the entire file at once, in order to ensure that data extraction leverages the entire file context. For most files, the pageRange will be the entire document, meaning that the singular extraction covers the entire file. However, in the case of large files (e.g., a legal contract that is 50 pages long), Cohesive will break up the extraction into groups of different pages and return a response for each group.

Here's what the response would look like for a very large file:

// Will return an array if the file is too large to process together
{
  "data": [
    {
      "pageRange": [
        0,
        1,
        2,
        3,
        4,
        5
      ],
      "extraction": null
    },
    {
      "pageRange": [
        6,
        7,
        8,
        9,
        10
      ],
      "extraction": null
    }
    ...
  }

Last updated