Skip to content

Create a router

POST
/api/routers
curl --request POST \
--url https://api.langparse.dev/api/routers \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <X-Api-Key>' \
--data '{ "name": "Accounts Payable", "candidates": [ { "modelId": "mdl_inv01", "name": "Invoice", "keywords": [ "invoice", "tax" ] } ] }'

Create a router from a set of candidate models. Optionally pre-filter each candidate by keywords, set a confidence threshold + a defaultModelId fallback, and enable multi-document splitting via extractSubDocuments.

Media typeapplication/json
object
name
required
string
candidates
required

Candidate models (with optional keyword pre-filter).

Array<object>
object
modelId
string
name
string
keywords
Array<string>
defaultModelId
string
threshold
number
extractSubDocuments
string
Allowed values: none page boundaries zonal
Example
{
"name": "Accounts Payable",
"candidates": [
{
"modelId": "mdl_inv01",
"name": "Invoice",
"keywords": [
"invoice",
"tax"
]
}
]
}

The created router.

Media typeapplication/json
object
data
required

A router. Own key id.

object
key
additional properties
any
Example
{
"data": {
"id": "rtr_ap01",
"name": "Accounts Payable",
"enabled": true,
"candidates": [
{
"modelId": "mdl_inv01",
"name": "Invoice",
"keywords": [
"invoice",
"tax"
]
}
]
}
}

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"
}