Update a model (schema, strategy, output tags…)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");curl_easy_setopt(hnd, CURLOPT_URL, "https://api.langparse.dev/api/models/mdl_inv01");
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\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Put, RequestUri = new Uri("https://api.langparse.dev/api/models/mdl_inv01"), Headers = { { "X-Api-Key", "<X-Api-Key>" }, }, Content = new StringContent("{ \"name\": \"Invoice\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }") { 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/mdl_inv01"
payload := strings.NewReader("{ \"name\": \"Invoice\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }")
req, _ := http.NewRequest("PUT", 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/mdl_inv01")) .header("X-Api-Key", "<X-Api-Key>") .header("Content-Type", "application/json") .method("PUT", HttpRequest.BodyPublishers.ofString("{ \"name\": \"Invoice\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }")) .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\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }");Request request = new Request.Builder() .url("https://api.langparse.dev/api/models/mdl_inv01") .put(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: 'PUT', url: 'https://api.langparse.dev/api/models/mdl_inv01', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, data: { name: 'Invoice', slug: 'invoice', fields: [ { title: 'Invoice Number', name: 'example', type: 'text', required: true, multiple: true, transform: 'example', validators: ['example'], children: [] } ], rule: 'example', enhance: true, reconcile: {total: 'example', items: 'example', amount: 'example', tolerance: 1}, outputTags: [ { name: 'InvoiceTotal', expression: '${data.invoice_total}', toSource: true, toDestination: true } ], strategy: {} }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.langparse.dev/api/models/mdl_inv01';const options = { method: 'PUT', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"name":"Invoice","slug":"invoice","fields":[{"title":"Invoice Number","name":"example","type":"text","required":true,"multiple":true,"transform":"example","validators":["example"],"children":[]}],"rule":"example","enhance":true,"reconcile":{"total":"example","items":"example","amount":"example","tolerance":1},"outputTags":[{"name":"InvoiceTotal","expression":"${data.invoice_total}","toSource":true,"toDestination":true}],"strategy":{}}'};
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\", \"slug\": \"invoice\", \"fields\": [ { \"title\": \"Invoice Number\", \"name\": \"example\", \"type\": \"text\", \"required\": true, \"multiple\": true, \"transform\": \"example\", \"validators\": [ \"example\" ], \"children\": [] } ], \"rule\": \"example\", \"enhance\": true, \"reconcile\": { \"total\": \"example\", \"items\": \"example\", \"amount\": \"example\", \"tolerance\": 1 }, \"outputTags\": [ { \"name\": \"InvoiceTotal\", \"expression\": \"${data.invoice_total}\", \"toSource\": true, \"toDestination\": true } ], \"strategy\": {} }")val request = Request.Builder() .url("https://api.langparse.dev/api/models/mdl_inv01") .put(body) .addHeader("X-Api-Key", "<X-Api-Key>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use std::str::FromStr;use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://api.langparse.dev/api/models/mdl_inv01";
let payload = json!({ "name": "Invoice", "slug": "invoice", "fields": ( json!({ "title": "Invoice Number", "name": "example", "type": "text", "required": true, "multiple": true, "transform": "example", "validators": ("example"), "children": () }) ), "rule": "example", "enhance": true, "reconcile": json!({ "total": "example", "items": "example", "amount": "example", "tolerance": 1 }), "outputTags": ( json!({ "name": "InvoiceTotal", "expression": "${data.invoice_total}", "toSource": true, "toDestination": true }) ), "strategy": json!({}) });
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.request(reqwest::Method::from_str("PUT").unwrap(), url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request PUT \ --url https://api.langparse.dev/api/models/mdl_inv01 \ --header 'Content-Type: application/json' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "name": "Invoice", "slug": "invoice", "fields": [ { "title": "Invoice Number", "name": "example", "type": "text", "required": true, "multiple": true, "transform": "example", "validators": [ "example" ], "children": [] } ], "rule": "example", "enhance": true, "reconcile": { "total": "example", "items": "example", "amount": "example", "tolerance": 1 }, "outputTags": [ { "name": "InvoiceTotal", "expression": "${data.invoice_total}", "toSource": true, "toDestination": true } ], "strategy": {} }'wget --quiet \ --method PUT \ --header 'X-Api-Key: <X-Api-Key>' \ --header 'Content-Type: application/json' \ --body-data '{ "name": "Invoice", "slug": "invoice", "fields": [ { "title": "Invoice Number", "name": "example", "type": "text", "required": true, "multiple": true, "transform": "example", "validators": [ "example" ], "children": [] } ], "rule": "example", "enhance": true, "reconcile": { "total": "example", "items": "example", "amount": "example", "tolerance": 1 }, "outputTags": [ { "name": "InvoiceTotal", "expression": "${data.invoice_total}", "toSource": true, "toDestination": true } ], "strategy": {} }' \ --output-document \ - https://api.langparse.dev/api/models/mdl_inv01Update a model. Send the full model body — this replaces the schema, strategy, validation rule, and output tags, so omitted properties are cleared. Existing parsed documents are unaffected.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
mdl_inv01Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
InvoiceFriendly, URL-safe key (unique per org). Auto-derived from the name when omitted; editable. Usable in place of the model id.
Example
invoiceobject
Example
Invoice NumberOutput 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
Example
InvoiceTotalExample
${data.invoice_total}Tag the original source file (S3 sources).
Tag the delivered output object.
{ kind: single|consensus, extractors: […], judge? }
object
Responses
Section titled “Responses”The updated 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
Examplegenerated
{ "data": {}}Missing or invalid API key.
Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.
object
Example
{ "statusCode": 404, "statusMessage": "Document not found"}Model not found.
Error response. statusCode mirrors the HTTP status; statusMessage is human-readable.
object
Example
{ "statusCode": 404, "statusMessage": "Document not found"}