---
title: "Create a routing rule"
method: POST
path: "/v2/routing-rules"
tags: ["Routing Rules"]
---

# Create a routing rule

`POST /v2/routing-rules`

Creates a routing rule with metadata and optional model, plugin, priority, and matching configuration. Rules default to disabled when `enabled` is omitted.

## Request body

- CreateRoutingRuleRequest
  - `display_name` string, required
  - `description` string
  - `project_id` string — Optional project scope. Omit for a workspace-wide rule.
  - `enabled` boolean — Whether the rule is active. Defaults to false when omitted.
  - `expression` RoutingRuleExpression
    - `config` object
    - `cel` string — CEL expression used to match requests. Empty means the rule always matches.
  - `models_config` RoutingRuleModelsConfig
    - `mode` string — Load-balancing mode.
    - `models` RoutingRuleModel[]
      - `model` string
      - `display_name` string
      - `weight` number, double
      - `integration_id` string
  - `plugins` RoutingRulePlugin[]
    - `id` string — Plugin discriminator.
    - `language` string
    - `entities` string[]
    - `on_failure` string
    - `threshold` number, double
    - `mask` string[]
  - `priority` integer
  - `cache_config` RoutingRuleCacheConfig
    - `ttl` integer, required — Cache time to live in seconds. Maximum 259200 seconds (3 days).

## Response `201`

Routing rule created successfully

- RoutingRule
  - `_id` string, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `created_by_id` string, required
  - `updated_by_id` string, required
  - `project_id` string, required — Project that contains the rule. Empty for workspace-wide rules.
  - `display_name` string, required — Human-readable routing-rule name.
  - `description` string, required
  - `enabled` boolean, required
  - `expression` RoutingRuleExpression
    - `config` object
    - `cel` string — CEL expression used to match requests. Empty means the rule always matches.
  - `models_config` RoutingRuleModelsConfig
    - `mode` string — Load-balancing mode.
    - `models` RoutingRuleModel[]
      - `model` string
      - `display_name` string
      - `weight` number, double
      - `integration_id` string
  - `plugins` RoutingRulePlugin[], required
    - `id` string — Plugin discriminator.
    - `language` string
    - `entities` string[]
    - `on_failure` string
    - `threshold` number, double
    - `mask` string[]
  - `priority` integer, required — Evaluation order. Lower values are evaluated first.
  - `cache_config` RoutingRuleCacheConfig
    - `ttl` integer, required — Cache time to live in seconds. Maximum 259200 seconds (3 days).

## Changes

> 263 revisions in range; 75 not diffed.

- **2026-08-24** `addad33219df` — 17 breaking, 18 info
  - the request property `models_config/models` became not nullable
  - removed the enum value `fallback` of the request property `models_config/mode`
  - removed the enum value `latency_based` of the request property `models_config/mode`
  - removed the enum value `round_robin` of the request property `models_config/mode`
  - …31 more
- **2026-08-21** `1586760a252f` — 12 breaking, 14 warning, 12 info
  - request property `models_config/mode` was restricted to a list of enum values
  - the request property `expression/cel` became required
  - the request property `models_config/mode` became required
  - the request property `models_config/models` became required
  - …34 more
- **2026-08-21** `4fdc24e562eb` — 17 breaking, 18 info
  - the request property `models_config/models` became not nullable
  - removed the enum value `fallback` of the request property `models_config/mode`
  - removed the enum value `latency_based` of the request property `models_config/mode`
  - removed the enum value `round_robin` of the request property `models_config/mode`
  - …31 more
- …earlier changes not shown

[Full history](https://skmtc.dev/orq-ai/apis/orq-ai-api/changes/v2/routing-rules/post.md)

---

[API](https://skmtc.dev/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.dev/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/revisions/a616ade1d86f/schema)
