Data extraction
How to successfully extract data from documents
Before extracting data you need to:
Once you successfully completed the above steps, you can use the /extract-data endpoint to extract data. We prepared a sample code to help you out:
1 Open file as base64 string (Lines 4-6)
Open the file in a binary mode and correctly decode it into a base64 string. Make sure that your file is in the same directory as the script.
2 Create payload (Lines 8-12)
Create request payload with all the required parameters:
file
file_name
document_type_name
4 Authorize with your API key (Line 19)
You can get your API key at https://app.typless.com/settings/profile
Response:
Supported file types
Typless supports the following file types:
PDF
JPG
PNG
TIFF
If you are working with scanned documents, we recommend using a resolution of 300 DPI to achieve optimal results.
🚧 Are you having problems with document quality?
We wrote a short blog on how to solve your problems here.
Line item extraction
If you want to extract line items, make sure you have defined the line-item structure in the document type.
Request parameters
document_type_name
string
YES
Name of the document type that you use for extraction.
file
string (Base64 encoded)
YES
The original file of the document that you are extracting data from.
file_name
string
YES
Name of the original file of the document that you are extracting data from. Name must include file type suffix, e.g., document.pdf
customer
string
NO
Your internal customer identification, used for .csv usage report. e.g., "my customer"
Understanding response
In the response, you will always find all of the fields you defined in the document type. Values for fields will be sorted by the confidence score. If the field is not present on the document, the value will be set to null.
Response base params
file_name
string
Same value as provided in request
extracted_fields
list
List of extracted fields
customer
string
Same value as provided in request
Extracted fields params
values
list
List of values for the field
Extracted values params
x
int
Top left bounding box corner. If value is null this value will be -1
y
int
Top left bounding box corner. If value is null this bounding box corner value will be -1
width
int
Bounding box width. If value is null this width will be -1
height
int
Bounding box height. If value is null this height will be -1
confidence_score
string
Value between 0 and 1. Bigger the value more confident the system is
page_number
int
Page on which value is present. If value is null this page number will be -1
📘 Field supplier_name will never carry any positional data - Just value!
All the positional parameters will always be -1, except for confidence_score and the value.
Example full response
Example null response:
Last updated