Create Routing Rule
Create a routing rule with POST /v1/routing-rules: conditions match document type or metadata, and the action assigns a schema when a document matches.
The POST /v1/routing-rules endpoint creates a document routing rule that automatically applies an action to incoming documents based on their metadata. Conditions define what to match (e.g. document type equals "invoice"), and the actions object defines what to do (e.g. assign the finance schema). Rules are evaluated on every document_classified event.
The typical workflow is: create rules ordered by specificity — put narrow, high-priority rules first (e.g. "contracts from vendor X") and broader catch-all rules last. New rules are active immediately upon creation, so the next classified document will be evaluated against them.
The response returns the rule with is_active: true, a trigger_type of document_classified, and the assigned priority (defaults to 100 if omitted). The action_type is resolved from the actions.type key and defaults to route_to_schema when not specified. Adjust the priority of a rule relative to others with PATCH /v1/routing-rules/{id}.
Pair with GET /v1/routing-rules to verify the full priority chain after creating a rule. Use source_connection_id to scope rules to documents from a specific source — documents from other sources will skip the rule entirely. To test a rule before going live, create it and immediately disable it via PATCH with is_active: false.
is_active: true by default. If you want to test a rule before activating it, create it, then immediately disable it via PATCH /v1/routing-rules/:id with is_active: false./v1/routing-rulesBody parameters
Request
Response
Response fields (201 Created)
Response (201 Created)
{
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"name": "Route contracts to legal schema",
"trigger_type": "document_classified",
"conditions": { "field": "document_type", "operator": "eq", "value": "contract" },
"action_type": "route_to_schema",
"actions": { "type": "assign_schema", "schema_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901" },
"priority": 100,
"is_active": true,
"review_required": false,
"source_connection_id": null,
"created_at": "2024-09-15T14:00:00.000Z",
"updated_at": null,
"links": {
"self": "/v1/routing-rules/c3d4e5f6-a7b8-9012-cdef-123456789012"
}
}Errors
Error responses