Skip to main content
POST
/
api
/
governance
/
routing-rules
Error
A valid request URL is required to generate request examples
{
  "message": "<string>",
  "rule": {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "enabled": true,
    "cel_expression": "<string>",
    "targets": [
      {
        "weight": 0.5,
        "provider": "<string>",
        "model": "<string>",
        "key_id": "<string>"
      }
    ],
    "fallbacks": [
      "<string>"
    ],
    "scope_id": "<string>",
    "priority": 123,
    "query": {},
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Management API authentication for /api/* endpoints. Use the Authorization header with Bearer <API key>. Virtual keys, dashboard/user/session tokens, and x-api-key headers are not supported on management APIs.

Body

application/json

Request to create a routing rule

scope
enum<string>
required

Scope level for the rule

Available options:
global
name
string
required

Name of the routing rule

cel_expression
string
required

CEL expression for matching

targets
object[]
required

Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time

Minimum array length: 1
priority
integer
required

Priority for rule evaluation (lower number = higher priority)

description
string

Optional description

enabled
boolean

Whether the rule is enabled

fallbacks
string[]

Fallback providers in format "provider/model"

scope_id
string | null

ID for the scope (required if scope is not global)

query
object

Visual rule tree structure

Response

Routing rule created successfully

Response containing created/updated routing rule

message
string
rule
object

CEL-based routing rule for intelligent request routing