The structured extraction API helps in extracting structured data from documents. It’s ideal for automating data extraction from invoices, RFPs, tax and financial statements, and other structured documents.

Quick Start

1

Define a Schema

Define a schema for the document you want to extract data from. Schemas are defined as JSON Schema.

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "string"
    }
  },
  "required": [
    "name",
    "age"
  ]
}
2

Define a Prompt

Structured Extraction is carried out using a combination of prompts and JSON Schema. If you want to override the prompt we use internally, you can provide your own prompt -

 Extract the name and age of the person from the document.
 Don't make up any information.
3

Upload the Document

4

Extract Data

Get the result from the API.

curl -X GET https://api.tensorlake.ai/documents/v1/result \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "file": "tensorlake://b5dee680-c07c-4bad-ba00-7bd16d28975d"
}'