Detect the best model for a file
POST
/api/v1/models/detect
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/detect");
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, "{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }");
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/detect"), Headers = { { "X-Api-Key", "<X-Api-Key>" }, }, Content = new StringContent("{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }") { 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/detect"
payload := strings.NewReader("{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }")
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/detect")) .header("X-Api-Key", "<X-Api-Key>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }")) .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, "{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }");Request request = new Request.Builder() .url("https://api.langparse.dev/api/v1/models/detect") .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/detect', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, data: {file: {id: 'file_mrb1a2c3d4'}}};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://api.langparse.dev/api/v1/models/detect';const options = { method: 'POST', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"file":{"id":"file_mrb1a2c3d4"}}'};
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, "{ \"file\": { \"id\": \"file_mrb1a2c3d4\" } }")val request = Request.Builder() .url("https://api.langparse.dev/api/v1/models/detect") .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/detect";
let payload = json!({"file": json!({"id": "file_mrb1a2c3d4"})});
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/detect \ --header 'Content-Type: application/json' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "file": { "id": "file_mrb1a2c3d4" } }'wget --quiet \ --method POST \ --header 'X-Api-Key: <X-Api-Key>' \ --header 'Content-Type: application/json' \ --body-data '{ "file": { "id": "file_mrb1a2c3d4" } }' \ --output-document \ - https://api.langparse.dev/api/v1/models/detectClassify a file against all your models (no extraction). Async: the polled document carries the routed model + routerConfidence.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
file
required
One of:
By id
object
id
required
An existing file id (from POST /v1/files or a folder listing).
string
Inline base64
object
contents
required
Base64 bytes (optionally a data: URI).
string
name
string
contentType
string
From a URL
object
url
required
Public http(s) URL the server fetches (SSRF-guarded).
string
name
string
contentType
string
Example
{ "file": { "id": "file_mrb1a2c3d4" }}Responses
Section titled “Responses”Accepted — poll for the routed model.
Media typeapplication/json
object
data
required
Async accept — the parse is queued. Poll pollUrl.
object
id
string
status
string
debugId
string
pollUrl
string
Example
{ "data": { "id": "doc_mrb1x9y8z7", "status": "queued", "pollUrl": "/api/v1/documents/doc_mrb1x9y8z7" }}No models to classify against, or invalid body.
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"}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"}