API Documentation
Last updated
Last updated
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.
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'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: