Suggest a schema from sample files
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.langparse.dev/api/v1/models/suggest");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "X-Api-Key: <X-Api-Key>");headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.langparse.dev/api/v1/models/suggest"), Headers = { { "X-Api-Key", "<X-Api-Key>" }, }, Content = new StringContent("{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.langparse.dev/api/v1/models/suggest"
payload := strings.NewReader("{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<X-Api-Key>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.langparse.dev/api/v1/models/suggest")) .header("X-Api-Key", "<X-Api-Key>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }");Request request = new Request.Builder() .url("https://api.langparse.dev/api/v1/models/suggest") .post(body) .addHeader("X-Api-Key", "<X-Api-Key>") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'POST', url: 'https://api.langparse.dev/api/v1/models/suggest', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, data: { files: [{url: 'https://example.com/sample-invoice.pdf'}], prompt: 'Focus on totals and line items.' }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.langparse.dev/api/v1/models/suggest';const options = { method: 'POST', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"files":[{"url":"https://example.com/sample-invoice.pdf"}],"prompt":"Focus on totals and line items."}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"files\": [ { \"url\": \"https://example.com/sample-invoice.pdf\" } ], \"prompt\": \"Focus on totals and line items.\" }")val request = Request.Builder() .url("https://api.langparse.dev/api/v1/models/suggest") .post(body) .addHeader("X-Api-Key", "<X-Api-Key>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.langparse.dev/api/v1/models/suggest";
let payload = json!({ "files": (json!({"url": "https://example.com/sample-invoice.pdf"})), "prompt": "Focus on totals and line items." });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("X-Api-Key", "<X-Api-Key>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}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." }'wget --quiet \ --method POST \ --header 'X-Api-Key: <X-Api-Key>' \ --header 'Content-Type: application/json' \ --body-data '{ "files": [ { "url": "https://example.com/sample-invoice.pdf" } ], "prompt": "Focus on totals and line items." }' \ --output-document \ - https://api.langparse.dev/api/v1/models/suggestPropose 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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
An existing file id (from POST /v1/files or a folder listing).
object
Base64 bytes (optionally a data: URI).
object
Public http(s) URL the server fetches (SSRF-guarded).
Optional guidance for which fields to prioritise.
Example
{ "files": [ { "url": "https://example.com/sample-invoice.pdf" } ], "prompt": "Focus on totals and line items."}Responses
Section titled “Responses”A suggested schema.
object
object
object
Output JSON key. Any style (kept verbatim); snake_case is derived from title when omitted.
List: repeated rows (default true). object: array of objects (default false).
Per-field JS (value, doc) => newValue.
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.
Example
{ "data": { "documentType": "Invoice", "fields": [ { "title": "Invoice Number", "name": "invoice_number", "type": "text", "required": true } ] }}Missing or invalid API key.
Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.
object
Example
{ "statusCode": 404, "statusMessage": "Document not found"}