ultrarouter docs
API reference

Preflight

Ask what the gateway would decide before a non-proxied call — model, fallbacks, learned knowledge, placement.

Ask what the gateway would decide before a non-proxied call — model, fallbacks, learned knowledge, placement.

This page is GENERATED from the OpenAPI spec (openapi.yaml) — it can never drift from the served API. Set UR_BASE_URL (required: your gateway’s URL) and UR_API_KEY (an ur_sk_* key); secrets are always the $UR_API_KEY placeholder.

Ask what the gateway would decide — model, fallbacks, learned knowledge, placement, grant

POST /v1/preflight

For a customer who does NOT proxy through the gateway: which model + fallbacks would route (the SAME routing engine the proxy runs), which learned module would inject (through the ONE shared resolve→rebuild→admit path the inject seam runs) and WHERE (after_stable_prefix), PLUS the exposure grant so ONE call gives both what to apply AND the arm it is in. The grant is minted by the SAME sanctioned owner the POST /v1/flywheel/grants route uses — supply an artifact_key or trace_id to receive one (else grant is null with grant_reason). The standing holdout is honoured: a holdout-arm grant withholds the learned module in the same response (knowledge_reason: "holdout"). Profile level only — there is no request-to-situation ranker. Two cache lifetimes: the module/pin/candidates part is config-versioned (Cache-Control: private, max-age=5 + a strong ETag; If-None-Match ⇒ 304); the health-ordered fallbacks are the 30 s live part (routing.max_age_s). The grant is NEVER cached — it is excluded from the ETag and served on the uncached X-UR-Grant header (a 304 revalidation still carries a fresh one). Requires the gateway:invoke scope (a READ of what an invoke would do). NEVER a body/PII in logs. Requires API-key scope: gateway:invoke.

Auth: API key (Authorization: Bearer ur_sk_…).

curl -sS -X POST "$UR_BASE_URL/v1/preflight" \
  -H "Authorization: Bearer $UR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "call_type": "string"
  }'