API Schema

Welcome to Typless API reference!

Extract Data

post

Extract data from a document synchronously. The fields in the response are based on the document type.

Body
file_namestringRequired

The name of the file to be uploaded.

Example: example_file.pdf
filestringRequired

Base64 encoded file content.

Example: JVBERi0xLjQKJcfs... (truncated for brevity)
document_type_namestring · min: 1Required

The name of the document type based on which the extraction is performed. Result of the extraction will have fields defined in the document type.

Example: my-document-type
customerany ofOptional

Customer for which the extraction is performed. This can be used for billing purposes.

Example: my-customer-id
string · min: 1Optional
or
nullOptional
Responses
200

Successful Response

application/json
post
POST /api/v1/extract-data HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 153

{
  "file_name": "example_file.pdf",
  "file": "JVBERi0xLjQKJcfs... (truncated for brevity)",
  "document_type_name": "my-document-type",
  "customer": "my-customer-id"
}
{
  "object_id": "0d3d1054c2768f8360b934ebf6f9b41605e28734",
  "file_name": "invoice.pdf",
  "customer": null,
  "adjusted_s3_url": "https://adjusted_s3_url.com/invoice_adjusted.pdf",
  "extracted_fields": [
    {
      "name": "invoice_number",
      "data_type": "STRING",
      "values": [
        {
          "x": 358,
          "y": 737,
          "width": 557,
          "height": 33,
          "page_number": 0,
          "value": "123-123",
          "confidence_score": 0.95
        }
      ],
      "multiple_values": false
    },
    {
      "name": "invoice_date",
      "data_type": "DATE",
      "values": [
        {
          "x": 2899,
          "y": 737,
          "width": 420,
          "height": 33,
          "page_number": 0,
          "value": "2021-03-27",
          "confidence_score": 0.92
        }
      ],
      "multiple_values": false
    },
    {
      "name": "total_amount",
      "data_type": "NUMBER",
      "values": [
        {
          "x": 3000,
          "y": 1500,
          "width": 200,
          "height": 30,
          "page_number": 0,
          "value": "1210.00",
          "confidence_score": 0.99
        }
      ],
      "multiple_values": false
    }
  ],
  "line_items": [
    [
      {
        "name": "line_item_description",
        "data_type": "STRING",
        "values": [
          {
            "x": 100,
            "y": 1000,
            "width": 500,
            "height": 25,
            "page_number": 0,
            "value": "Product A",
            "confidence_score": 0.88
          }
        ]
      },
      {
        "name": "line_item_total",
        "data_type": "NUMBER",
        "values": [
          {
            "x": 800,
            "y": 1000,
            "width": 100,
            "height": 25,
            "page_number": 0,
            "value": "200.00",
            "confidence_score": 0.96
          }
        ]
      }
    ],
    [
      {
        "name": "line_item_description",
        "data_type": "STRING",
        "values": [
          {
            "x": 100,
            "y": 1030,
            "width": 500,
            "height": 25,
            "page_number": 0,
            "value": "Service B",
            "confidence_score": 0.85
          }
        ]
      },
      {
        "name": "line_item_total",
        "data_type": "NUMBER",
        "values": [
          {
            "x": 800,
            "y": 1030,
            "width": 100,
            "height": 25,
            "page_number": 0,
            "value": "1010.00",
            "confidence_score": 0.98
          }
        ]
      }
    ]
  ],
  "vat_rates": [
    [
      {
        "name": "vat_rate_percentage",
        "data_type": "NUMBER",
        "values": [
          {
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1,
            "value": "20.0",
            "confidence_score": 0.9
          }
        ]
      },
      {
        "name": "vat_rate_net",
        "data_type": "NUMBER",
        "values": [
          {
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1,
            "value": "1000.00",
            "confidence_score": 0.9
          }
        ]
      }
    ]
  ]
}

Extract Data Async

post

Extract data from a document asynchronously.

Body
file_namestringRequired

The name of the file to be uploaded.

Example: example_file.pdf
filestringRequired

Base64 encoded file content.

Example: JVBERi0xLjQKJcfs... (truncated for brevity)
document_type_namestring · min: 1Required

The name of the document type based on which the extraction is performed. Result of the extraction will have fields defined in the document type.

Example: my-document-type
parse_text_blocksbooleanOptional

If true, the text blocks will be parsed and returned in the result.

Default: false
customerany ofOptional

Customer for which the extraction is performed. This can be used for billing purposes.

Example: my-customer-id
string · min: 1Optional
or
nullOptional
Responses
202

Successful Response

application/json
post
POST /api/v1/extract-data-async HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 179

{
  "file_name": "example_file.pdf",
  "file": "JVBERi0xLjQKJcfs... (truncated for brevity)",
  "document_type_name": "my-document-type",
  "parse_text_blocks": false,
  "customer": "my-customer-id"
}
{
  "extraction_id": "1458b05b6b429f569c7c1512712d50b6e465595e"
}

Pretrained Extract Data Async By Model

post

Extract data from document asynchronously using a specific pretrained model.

Path parameters
model_namestring · enumRequiredPossible values:
Body
file_namestringRequired

The name of the file to be uploaded.

Example: example_file.pdf
fileany ofOptional

Base64 encoded file content. If not given, then file_url needs to be given.

Example: JVBERi0xLjQKJcfs... (truncated for brevity)
stringOptional
or
nullOptional
file_urlany ofOptional

URL of the file. Needs to be publicly accessible. If not given, then file needs to be given.

Example: https://url-of-some-file.example.com/file.pdf
string · uri · min: 1 · max: 2083Optional
or
nullOptional
for_customerany ofOptional

Customer for which the extraction is performed. This can be used for billing purposes.

Example: my-customer-id
stringOptional
or
nullOptional
Responses
202

Successful Response

application/json
post
POST /api/v1/pretrained-models/{model_name} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 176

{
  "file_name": "example_file.pdf",
  "file": "JVBERi0xLjQKJcfs... (truncated for brevity)",
  "file_url": "https://url-of-some-file.example.com/file.pdf",
  "for_customer": "my-customer-id"
}
{
  "extraction_id": "1458b05b6b429f569c7c1512712d50b6e465595e"
}

Get Documents Awaiting Poll

get

Get all documents that have been processed but haven't been polled yet.

Query parameters
customerany ofOptional
string · min: 1Optional
or
nullOptional
Responses
200

Successful Response

application/json
get
GET /api/v1/awaiting-poll HTTP/1.1
Host: 
Accept: */*
{
  "extraction_ids": [
    "1458b05b6b429f569c7c1512712d50b6e465595e"
  ]
}

Get Extraction Data

get

Get extraction data for a document with the given extraction ID, if the extraction has finished.

Query parameters
extraction_idstringRequired

Extraction ID of the document that was returned in the response of the async POST request.

Example: 1458b05b6b429f569c7c1512712d50b6e465595e
text_blocksbooleanOptional

Whether to include text blocks in the response.

Default: false
Responses
200

Successful Response

application/json
get
GET /api/v1/get-extraction-data?extraction_id=text HTTP/1.1
Host: 
Accept: */*
{
  "status": "IN_PROGRESS",
  "error": null,
  "result": null
}

Train All Document Type Models With Name

post

Train all document type models with the given name.

Body
document_type_namestringRequired

The name of the document type for which the training should be started.

Example: my-document-type
Responses
200

Successful Response

application/json
post
POST /api/v1/start-training HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 41

{
  "document_type_name": "my-document-type"
}
{
  "message": "Training started.",
  "details": [
    "Training started for Supplier A",
    "Training started for Supplier B"
  ]
}

Add Document To Data Set Async

post

Add new document to dataset. Useful for setting up new document types with existing data.

Body
file_namestringRequired

The name of the file to be uploaded.

Example: example_file.pdf
filestringRequired

Base64 encoded file content.

Example: JVBERi0xLjQKJcfs... (truncated for brevity)
document_type_namestring · min: 1Required

The name of the document type based on which the extraction is performed. Result of the extraction will have fields defined in the document type.

Example: my-document-type
Responses
202

Successful Response

application/json
post
POST /api/v1/add-document-async HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 499

{
  "file_name": "example_file.pdf",
  "file": "JVBERi0xLjQKJcfs... (truncated for brevity)",
  "document_type_name": "my-document-type",
  "learning_fields": [
    {
      "name": "invoice_number",
      "value": [
        {
          "value": "INV-1",
          "x": -1,
          "y": -1,
          "width": -1,
          "height": -1,
          "page_number": 1
        }
      ]
    }
  ],
  "line_items": [
    [
      {
        "name": "invoice_number",
        "value": [
          {
            "value": "INV-1",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": 1
          }
        ]
      }
    ]
  ],
  "vat_rates": [
    [
      {
        "name": "invoice_number",
        "value": [
          {
            "value": "INV-1",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": 1
          }
        ]
      }
    ]
  ]
}
{
  "message": "Document added successfully.",
  "details": "14a58b05b6b429f569c7c1512712d50b6e465595e"
}

Add Document Feedback

post

Add output values for selected data set element for which the extraction was performed earlier.

Body
document_type_namestring · min: 1Required

The name of the document type to which the dataset element is added.

Example: my-document-type
document_object_idstring · min: 1Required
Responses
200

Successful Response

application/json
post
POST /api/v1/add-document-feedback HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 413

{
  "document_type_name": "my-document-type",
  "learning_fields": [
    {
      "name": "text",
      "value": [
        {
          "value": "text",
          "x": -1,
          "y": -1,
          "width": -1,
          "height": -1,
          "page_number": -1
        }
      ]
    }
  ],
  "line_items": [
    [
      {
        "name": "text",
        "value": [
          {
            "value": "text",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1
          }
        ]
      }
    ]
  ],
  "vat_rates": [
    [
      {
        "name": "text",
        "value": [
          {
            "value": "text",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1
          }
        ]
      }
    ]
  ],
  "document_object_id": "text"
}
{
  "message": "Values added successfully.",
  "details": "1458b05b6b429f569c7c1512712d50b6e465595e"
}

Add Document To Data Set

post

Add new document to dataset synchronously. Useful for filling up new document types with existing data.

Body
document_type_nameany ofOptional

The name of the document type to which the dataset element is added.

Example: my-document-type
stringOptional
or
nullOptional
file_namestringRequired

The name of the file to be uploaded.

Example: example_file.pdf
filestringRequired

Base64 encoded file content.

Example: JVBERi0xLjQKJcfs... (truncated for brevity)
Responses
200

Successful Response

application/json
post
POST /api/v1/add-document HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 469

{
  "document_type_name": "my-document-type",
  "learning_fields": [
    {
      "name": "text",
      "value": [
        {
          "value": "text",
          "x": -1,
          "y": -1,
          "width": -1,
          "height": -1,
          "page_number": -1
        }
      ]
    }
  ],
  "line_items": [
    [
      {
        "name": "text",
        "value": [
          {
            "value": "text",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1
          }
        ]
      }
    ]
  ],
  "vat_rates": [
    [
      {
        "name": "text",
        "value": [
          {
            "value": "text",
            "x": -1,
            "y": -1,
            "width": -1,
            "height": -1,
            "page_number": -1
          }
        ]
      }
    ]
  ],
  "file_name": "example_file.pdf",
  "file": "JVBERi0xLjQKJcfs... (truncated for brevity)"
}
{
  "message": "Document added successfully.",
  "details": "1458b05b6b429f569c7c1512712d50b6e465595e"
}

Last updated