import json
import requests
url = 'https://api.ade.landing.ai/v2/ground'
headers = {'Authorization': 'Bearer YOUR_API_KEY'}
with open('parse.json') as f:
parse = json.load(f)
with open('extract.json') as f:
extract = json.load(f)
payload = {
'extraction_metadata': extract['extraction_metadata'],
'structure': parse['structure'],
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())curl -X POST 'https://api.ade.landing.ai/v2/ground' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'extraction_metadata=<extraction-metadata.json' \
-F 'structure=<structure.json'const axios = require('axios');
const fs = require('fs');
const parse = JSON.parse(fs.readFileSync('parse.json', 'utf8'));
const extract = JSON.parse(fs.readFileSync('extract.json', 'utf8'));
axios.post('https://api.ade.landing.ai/v2/ground', {
extraction_metadata: extract.extraction_metadata,
structure: parse.structure,
}, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));{
"grounding": {
"invoice_number": [
{
"atomic_grounding": [],
"block_id": "text-1",
"grounding": {
"box": {
"xmax": 0.42,
"xmin": 0.1,
"ymax": 0.15,
"ymin": 0.12
},
"page": 1,
"range": {
"end": 31,
"start": 13
}
},
"type": "text"
}
]
},
"metadata": {
"job_id": "<string>",
"duration_ms": 123,
"openapi_spec": "<string>",
"billing": {
"service_tier": "standard",
"total_credits": 123
}
}
}{
"code": "<string>",
"message": "<string>"
}ADE Ground
Map extracted fields to the document blocks they were quoted from. Takes the extraction_metadata from an extract call and the structure tree from the parse call the markdown came from, and returns, for every extracted field, the overlapping blocks with their ids, page numbers, and bounding boxes. Runs synchronously and returns the result inline.
import json
import requests
url = 'https://api.ade.landing.ai/v2/ground'
headers = {'Authorization': 'Bearer YOUR_API_KEY'}
with open('parse.json') as f:
parse = json.load(f)
with open('extract.json') as f:
extract = json.load(f)
payload = {
'extraction_metadata': extract['extraction_metadata'],
'structure': parse['structure'],
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())curl -X POST 'https://api.ade.landing.ai/v2/ground' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'extraction_metadata=<extraction-metadata.json' \
-F 'structure=<structure.json'const axios = require('axios');
const fs = require('fs');
const parse = JSON.parse(fs.readFileSync('parse.json', 'utf8'));
const extract = JSON.parse(fs.readFileSync('extract.json', 'utf8'));
axios.post('https://api.ade.landing.ai/v2/ground', {
extraction_metadata: extract.extraction_metadata,
structure: parse.structure,
}, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));{
"grounding": {
"invoice_number": [
{
"atomic_grounding": [],
"block_id": "text-1",
"grounding": {
"box": {
"xmax": 0.42,
"xmin": 0.1,
"ymax": 0.15,
"ymin": 0.12
},
"page": 1,
"range": {
"end": 31,
"start": 13
}
},
"type": "text"
}
]
},
"metadata": {
"job_id": "<string>",
"duration_ms": 123,
"openapi_spec": "<string>",
"billing": {
"service_tier": "standard",
"total_credits": 123
}
}
}{
"code": "<string>",
"message": "<string>"
}Body
Input to V2GroundOperationWorkflow — the /v2/ground request body.
A pure, stateless join: each extraction_metadata leaf's ranges
(char offsets into the markdown both artifacts were produced from) is
overlapped against the grounding.range carried on every structure
block, and the matching blocks are returned. Nothing is stored server-side,
so block ids in the response resolve only against the structure tree
supplied here — pairing an extraction with the parse result it actually
came from is the caller's responsibility.
The extraction_metadata object returned by POST /v2/extract (or the pipeline's extract step): a tree mirroring your extraction schema whose leaves are {value, ranges} objects, where ranges are {start, end} Unicode code point offsets into the parse markdown.
{
"invoice_number": {
"ranges": [{ "end": 31, "start": 13 }],
"value": "INV-042"
}
}
The structure tree from the parse response the extraction was produced from. Every block in the tree carries its grounding ({page, range, box}) inline; block ids in the response resolve against this exact tree.
Response
v2-ground result
Result returned by V2GroundOperationWorkflow — the /v2/ground
response body.
grounding MIRRORS the extraction_metadata tree: nested objects and
arrays keep their shape, and each {value, ranges} leaf is replaced by
the list of structure blocks its ranges overlap (the block-hit shape
documented on the field). It is NOT a flat map — a nested schema field like
issuer.name resolves to grounding["issuer"]["name"].
A tree mirroring extraction_metadata: nested objects and arrays keep their shape, and each {value, ranges} leaf is replaced by the list of blocks its ranges overlap, in reading order. Each entry carries block_id and type identifying the matched structure block, parent_id naming the enclosing block for nested blocks (table cells), and the block's own grounding object ({page, range, box}) verbatim. When the block itself carries atomic_grounding, the entry also lists the overlapping subset as {index, page, range, box} objects, where index is the position in the block's own atomic_grounding array; [] means the block matched but no individual entry did, and the key is omitted for blocks that carry no atomic_grounding. A leaf is null when its ranges was null (a synthesised value, with no supporting passage to look up) and [] when valid ranges overlapped no block (which usually indicates a mismatched extraction/structure pair).
{
"invoice_number": [
{
"atomic_grounding": [],
"block_id": "text-1",
"grounding": {
"box": {
"xmax": 0.42,
"xmin": 0.1,
"ymax": 0.15,
"ymin": 0.12
},
"page": 1,
"range": { "end": 31, "start": 13 }
},
"type": "text"
}
]
}
Request metadata (job_id, duration_ms, credit_usage).
Show child attributes
Show child attributes
Was this page helpful?