Skip to content

Suggest a schema from sample files

POST
/api/v1/models/suggest
curl --request POST \
--url https://api.langparse.dev/api/v1/models/suggest \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <X-Api-Key>' \
--data '{ "files": [ { "url": "https://example.com/sample-invoice.pdf" } ], "prompt": "Focus on totals and line items." }'

Propose a NEW extraction schema (document type + fields, incl. nested line items) from 1–8 sample files. Manage-scope key. For large samples reference files by id or url — inline base64 contents counts against the ~6 MB request limit, so a few big documents will exceed it.

Media typeapplication/json
object
files
required
Array
One of:
By id
object
id
required

An existing file id (from POST /v1/files or a folder listing).

string
prompt

Optional guidance for which fields to prioritise.

string
Example
{
"files": [
{
"url": "https://example.com/sample-invoice.pdf"
}
],
"prompt": "Focus on totals and line items."
}

A suggested schema.

Media typeapplication/json
object
data
required
object
documentType
string
fields
Array<object>
object
title
required
string
name

Output JSON key. Any style (kept verbatim); snake_case is derived from title when omitted.

string
type
required
string
Allowed values: text number date boolean select list object image synthesize
required
boolean
multiple

List: repeated rows (default true). object: array of objects (default false).

boolean
transform

Per-field JS (value, doc) => newValue.

string
validators

Validator ids to run on the value — built-in (e.g. iban, nzbn, abn, vat_eu, aba_routing, iso_date) or a custom val_…. A failure flags the document for review.

Array<string>
children
Array<object> recursive
Example
{
"data": {
"documentType": "Invoice",
"fields": [
{
"title": "Invoice Number",
"name": "invoice_number",
"type": "text",
"required": true
}
]
}
}

Missing or invalid API key.

Media typeapplication/json

Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.

object
statusCode
integer
statusMessage
string
Example
{
"statusCode": 404,
"statusMessage": "Document not found"
}