Skip to main content
POST
/
v1
/
ade
/
extract
/
build-schema
cURL
curl -X POST 'https://api.va.landing.ai/v1/ade/extract/build-schema' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'markdowns=@markdown.md' \
  -F 'model=extract-latest' \
  -F 'prompt=Extract invoice fields including vendor, date, and total amount'
import requests

headers = {
'Authorization': 'Bearer YOUR_API_KEY'
}

url = 'https://api.va.landing.ai/v1/ade/extract/build-schema'

# Prepare files and data
files = [('markdowns', open('markdown.md', 'rb'))]
data = {
'model': 'extract-latest',
'prompt': 'Extract invoice fields including vendor, date, and total amount'
}

response = requests.post(url, files=files, data=data, headers=headers)
print(response.json())
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();
form.append('markdowns', fs.createReadStream('markdown.md'));
form.append('model', 'extract-latest');
form.append('prompt', 'Extract invoice fields including vendor, date, and total amount');

axios.post('https://api.va.landing.ai/v1/ade/extract/build-schema', form, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
...form.getHeaders()
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
{
  "extraction_schema": "<string>",
  "metadata": {
    "filename": "<string>",
    "org_id": "<string>",
    "duration_ms": 0,
    "credit_usage": 0,
    "job_id": "",
    "version": "<string>",
    "warnings": [
      {
        "msg": "<string>"
      }
    ]
  }
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Your unique API key for authentication.

Get your API key here: https://va.landing.ai/settings/api-key.

If using the EU endpoint, get your API key here: https://va.eu-west-1.landing.ai/settings/api-key.

Body

multipart/form-data
model
string | null

The version of the model to use for schema generation. Use extract-latest to use the latest version.

markdowns
(file | string)[] | null

Markdown files or inline content strings to analyze for schema generation. Multiple documents can be provided for better schema coverage.

markdown_urls
string[] | null

URLs to Markdown files to analyze for schema generation.

prompt
string | null

Instructions for how to generate or modify the schema.

schema
string | null

Existing JSON schema to iterate on or refine.

Response

Successful Response

extraction_schema
string
required

The generated JSON schema as a string.

metadata
BuildSchemaMetadata · object
required

The metadata for the schema generation process.