Create a model
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.langparse.dev/api/models");
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, "{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }");
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/models"), Headers = { { "X-Api-Key", "<X-Api-Key>" }, }, Content = new StringContent("{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }") { 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/models"
payload := strings.NewReader("{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }")
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/models")) .header("X-Api-Key", "<X-Api-Key>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }")) .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, "{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }");Request request = new Request.Builder() .url("https://api.langparse.dev/api/models") .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/models', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, data: { name: 'Invoice', fields: [{title: 'Invoice Number', type: 'text', required: true}] }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.langparse.dev/api/models';const options = { method: 'POST', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"name":"Invoice","fields":[{"title":"Invoice Number","type":"text","required":true}]}'};
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, "{ \"name\": \"Invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"type\": \"text\", \"required\": true } ] }")val request = Request.Builder() .url("https://api.langparse.dev/api/models") .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/models";
let payload = json!({ "name": "Invoice", "fields": ( json!({ "title": "Invoice Number", "type": "text", "required": true }) ) });
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/models \ --header 'Content-Type: application/json' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "name": "Invoice", "fields": [ { "title": "Invoice Number", "type": "text", "required": true } ] }'wget --quiet \ --method POST \ --header 'X-Api-Key: <X-Api-Key>' \ --header 'Content-Type: application/json' \ --body-data '{ "name": "Invoice", "fields": [ { "title": "Invoice Number", "type": "text", "required": true } ] }' \ --output-document \ - https://api.langparse.dev/api/modelsCreate a model — a named extraction schema. fields define what to pull (text / number / date / boolean / select / list / object); list and object fields nest their own children. Optionally attach an extraction strategy, a validation rule, and outputTags.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Friendly, URL-safe key (unique per org). Auto-derived from the name when omitted; editable. Usable in place of the model id.
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.
Document validation JS (doc, ctx) => void.
Enhance scan-like pages (deskew / denoise / contrast / crop) before extraction. Digital PDFs are untouched.
Totals reconciliation — flag when total ≠ sum of the items list’s amount field.
object
Top-level number field holding the document total.
Top-level list field holding the line items.
Field within each list row holding the line amount.
Absolute rounding tolerance (default 0.01).
An S3 object tag projected from parsed data. Use ${data.field}, ${dest.uri/bucket/key} or literals.
object
Tag the original source file (S3 sources).
Tag the delivered output object.
{ kind: single|consensus, extractors: […], judge? }
object
Example
{ "name": "Invoice", "fields": [ { "title": "Invoice Number", "type": "text", "required": true } ]}Responses
Section titled “Responses”The created model.
object
A model (schema + strategy + output tags). Own key id; slug is a friendly, unique-per-org handle accepted anywhere the id is.
object
Example
{ "data": { "id": "mdl_inv01", "slug": "invoice", "name": "Invoice", "description": "Supplier invoices with line items, taxes and totals.", "fieldCount": 12, "fieldPreview": [ "Invoice Number", "Invoice Date", "Total" ], "strategy": "single", "features": [], "coverUrl": null, "updatedAt": "2026-07-07T04:50:26.659Z", "fields": [] }}Missing or invalid API key.
Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.
object
Example
{ "statusCode": 404, "statusMessage": "Document not found"}