Beta Launch: Decoupled Parse and Extraction APIs
In our original launch of , the field extraction function was part of the parsing function; every time you wanted to run extraction, you had to run parsing, even if you had already parsed the document. We are now introducing two new beta endpoints that separate these functions: and . These beta APIs allow you to decouple parsing and extraction workflows for greater flexibility. You can now parse the document once with the API, and then use the API to run field extraction on that output multiple times. This is helpful if you want to experiment with different extraction schemas or you have multiple extraction tasks.Important Considerations
The and APIs are in beta. These APIs are still in development and may not return accurate results. Do not use these APIs in production environments. The and APIs are not available in the agentic-doc library. To use these endpoints, you must call them directly.Process Overview
- Create an extraction schema. The easiest way is to use the Schema Wizard in the Playground to generate a schema.
- Run the API. This returns the parsed content as Markdown.
- Run a script to save the returned Markdown text as a Markdown file.
- Run the API on the Markdown output from the API.
- If needed, connect the extracted fields to their original locations in the document.
Use ADE Parse to Parse Documents
See the full API reference here. Use the API to parse data from documents.Rotation detection can be enabled upon request. To request this feature, contact support@landing.ai.
Specify Documents to Parse
The API offers two parameters for specifying the document you want to parse:document
: Specify the actual file you want to parse.document_url
: Include the URL to the file that you want to parse.
Set Up Splits for Parsing
By default, the full document is parsed when you call the API. However, you can set thesplit
parameter to page
to parse each page of the document separately. When this is selected, the splits
object in the API output contains a set of data for each page.
Parsed Output
When you run , the API returns this response in JSON:Differences Between the Parsed Output from Original API & New API
If you’ve been calling the original API endpoint (https://api.va.landing.ai/v1/tools/agentic-document-analysis), you will notice that the output for the new API is different. If you’re switching from that endpoint to the new endpoint, you may need to update any scripts you have that interact with the parsed output. Here are some key ways in which the output is different:- The output doesn’t include any extraction data, because the API doesn’t perform extraction.
- The output is not wrapped in a
data
object. - Each
chunks
object now has amarkdown
attribute - The chunk type is defined in the
type
attribute. (The original endpoint defines this inchunk_type
.) - The chunk ID is defined in the
id
attribute. (The original endpoint defines this inchunk_id
.) - The coordinates of each chunk’s bounding box is now spelled out in the attribute:
left
,top
,right
,bottom
. (The original API abbreviates the coordinates:l
,t
,r
,b
.) - The output includes a
splits
object that shows how the document was split during the parsing process. - The output includes a
metadata
object that includes important information about the parsing process.
Use ADE Extract to Extract Fields from Markdown
See the full API reference here. Use the API to extract data from the Markdown output created by the API.Specify Documents to Run Extraction On
The API offers two parameters for specifying the document you want to parse:markdown
: Specify the actual Markdown file you want to run extraction on.markdown_url
: Include the URL to the Markdown file you want to run extraction on.
Set the Extraction Schema
Set the extraction schema in theschema
parameter. This must be a valid JSON schema. To learn more about extraction schemas and how to create them, go to Overview: Extract Data.
Extracted Output
When you run , the API returns this response in JSON:Differences Between the Extracted Output from Original API & New API
If you’ve been calling the original API endpoint (https://api.va.landing.ai/v1/tools/agentic-document-analysis), you will notice that the output for the new API is different. If you’re switching from that endpoint to the new endpoint, you may need to update any scripts you have that interact with the extraction output. Here is the key way in which the output is different:- The output doesn’t include confidence scores.
- The output doesn’t contain the coordinates to the bounding boxes for each chunk. Instead, it contains a unique ID (
id
) for the chunk that an extracted key-value pair is from. If you need to locate the source of a key-value pair, you can create a script that connects theid
to the bounding box coordinates from the output. To get a sample script that does this, go to End-to-End Workflow: Parse, Extract, and Visually Ground Extracted Fields.
End-to-End Workflow: Parse and Extract
This tutorial walks you through how to parse a document with the API and then extract a subset of fields from it using the API. We provide a separate script for each endpoint, so you can choose to skip the extraction steps if you don’t need them. Scenario and materials:- Parse this PDF: Wire Transfer Form
- Extract these fields: Bank Account and Bank Account Number
- JSON extraction schema: Schema for Wire Transfer
1. Parse and Save Content as a Markdown File
First, run the script below to parse the document and save the content in themarkdown
response to a Markdown file. The Markdown file will be similar to this one: Markdown for Wire Transfer.
id
. For example, the first chunk is the text ”# WIRE TRANSFER FORM”. The id
for that chunk is 33335548-e7c3-40bd-898e-4f23d6c99d34
.
2. Create a JSON Extraction Schema
As a reminder, we want to extract these fields from the Wire Transfer form: Bank Account and Bank Account Number. To do this, create a JSON extraction schema that identifies these fields. We will use this JSON file when we run the ADE Extract API in the next step. We’ve created the JSON schema below for you to use. You can also download this schema here: Schema for Wire Transfer.To learn more about extraction schemas and how to create them, go to Overview: Extract Data.
3. Use the Extraction Schema to Extract Data from the Markdown File
Now that we have the parsed output in a Markdown file and a JSON extraction schema, we’re ready to extract these fields: Bank Account and Bank Account Number. To do this, run the script below.End-to-End Workflow: Parse, Extract, and Visually Ground Extracted Fields
This tutorial walks you through how to parse a document, extract a subset of fields, and then connect the fields back to their original locations in the document. We provide a single script for the full workflow. Running this script saves images of the locations of the fields as PNGs. Scenario and materials:- Parse this PDF: Wire Transfer Form
- Extract these fields: Bank Account and Bank Account Number
- JSON extraction schema: Schema for Wire Transfer
Pricing: ADE Parse
The API uses the same number of credits as the original endpoint. The number of credits used to process a document is based on the number of pages and the features used in parsing, as shown in the following table.Feature | Credit Cost | Notes |
---|---|---|
Parsing | 3 credits/page | Each page processed includes parsing. |
ZDR (HIPAA/BAA) | 1 credit/page | This feature is available on the Team, Visionary, and Enterprise plans. |
Pricing: ADE Extract
The cost for the API is based on both the number of input characters and output characters, and is rounded up to the nearest 0.1 credits.Factor | Credit Cost | Notes |
---|---|---|
5,000 input characters | 1 credit | Input characters are the number of characters in the Markdown file that is passed to the API. |
1,000 output characters | 1 credit | Output characters are the number of characters in the extraction object returned by the API, excluding whitespace used for indentation. (Other spaces, like the spaces after colons in key-value pairs, are not removed.) |
Example ADE Extract Pricing
Input Characters Let’s say you run the API on a Markdown file with the following content. The file has 2,270 characters. Therefore, the number of input characters is 2,270.extraction
object returned by the API. The response has 475 characters. Therefore, the number of output characters is 475.