Skip to main content
POST
Create Routing Preference
Create a new Routing Studio preference. Idempotent — the same Idempotency-Key header replays the same response. Creating a preference does not auto-bind it to a key. Use PUT /api/v1/keys//routing-preference to opt a key in, or edit rules directly on a key via PUT /api/v1/keys//routing-rules.

Authentication

Requires a Bearer token with the billing API key scope.

Body

string
required
Preference name. 1–128 chars. May not reference upstream provider names (Claude, OpenAI, Anthropic, Gemini, fal.ai, etc.).
string
Free-text description. Up to 512 chars.
object[]
Up to 50 keyword/regex rules. Each rule has pattern (ECMAScript regex source, ≤512 chars), target_mode (a Theo mode), optional target_engine (Theo-branded engine id), confidence (clamped server-side to [0.5, 0.99]), and an optional description.
object[]
Up to 30 few-shot examples injected into the classifier’s system prompt. Each example has prompt (≤1024 chars), expected_mode, and optional expected_engine.
object
Per-mode replacements for the global 0.85 promotion floor. Values are clamped to [0.5, 0.99].
string
"personal" (default) or "team". Team scope requires an active org and the manageWebhooks permission.
boolean
Mark this preference as the default for its scope. At most one default per scope.

Request Examples

Errors

  • 400 routing_preference_invalid — Vendor-named label or pattern, uncompilable regex, unknown engine, or rule/example cap exceeded.
  • 400 org_requiredscope: "team" without an active organization.
  • 403 missing_scope — API key lacks the billing scope.
  • 409 conflictis_default: true already set for this scope.