Cohesive
  • 👋 Welcome!
  • ✨Getting Started
  • Reference
    • API Documentation
      • POST: upload
      • POST: upload_async
      • Guide: Having a custom response schema
        • Template: Metrics Data
        • Template: Order Data
      • Guide: Tabular Data
    • Workflow Documentation
      • Overview
      • Templates
        • Lists
        • Math Expressions
        • Date Expressions
      • Integrations
        • ERP Integrations
        • CRM Integrations
        • Communication Integrations
    • Security Policy
Powered by GitBook
On this page
  • API Overview
  • Cohesive Response Format
  1. Reference

API Documentation

PreviousGetting StartedNextPOST: upload

Last updated 1 year ago

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.

Cohesive support can assist you with setting up a custom response schema to fit your needs - let us know.

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.

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.

For small files (e.g., a typical contract/invoice or a financial statement), you can expect a response in under 30 seconds. However, for larger files, responses can take up to a minute.

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
    }
    ...
  }
POST: upload
POST: upload_async