Project routing

Give a project its own routing policy, or route via the org default

A project either routes via your organization’s default policy or carries its own project-scoped routing policy. The policy uses the same shape as Embedded Routing Stack policies: PRIORITY tries a ranked list in order, INTELLIGENT picks per request from an allowed set. The two field sets are mutually exclusive by strategy.

These are the dashboard’s Priority and Intelligent strategies under API names; the axis values COST, PERFORMANCE, and CAPABILITY map to the dashboard’s Cost Optimized, Balanced, and Quality First. Dashboard-only strategies (Least Latency, Lowest Cost, Build Your Own Router) can’t be expressed over the API; see the strategy comparison.

Two fields on the project control this:

FieldMeaning
uses_organization_default_routingtrue (default): no scoped policy, the org default applies. false: routing_policy is required
routing_policyThe scoped policy. name is optional and defaults to “<project name> routing policy”

Supplying routing_policy together with uses_organization_default_routing: true is rejected with 422, as is false without a policy.

Create a project with its own routing

$curl -X POST https://api-gateway.merge.dev/v1/projects \
> -H "Authorization: Bearer mgmt_<your_management_key>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "Field Mappings",
> "uses_organization_default_routing": false,
> "routing_policy": {
> "strategy": "PRIORITY",
> "priority_order": [
> { "model": "openai/gpt-5.5", "priority": 1 },
> { "model": "anthropic/claude-opus-4-8", "priority": 2 }
> ]
> }
> }'

For INTELLIGENT, allowed_providers is derived from allowed_models; if you supply it, it must match. An optional axis (COST, PERFORMANCE, or CAPABILITY) sets what the router optimizes for and defaults to COST.

Replace the policy

routing_policy on PATCH is a full replacement, applied in place: the policy id is stable across updates, so IaC diffs stay clean. Sending a policy to a project that routes via the org default creates the scoped policy.

$curl -X PATCH https://api-gateway.merge.dev/v1/projects/{project_id} \
> -H "Authorization: Bearer mgmt_<your_management_key>" \
> -H "Content-Type: application/json" \
> -d '{
> "routing_policy": {
> "strategy": "INTELLIGENT",
> "axis": "CAPABILITY",
> "allowed_models": ["openai/gpt-5.5", "anthropic/claude-opus-4-8"]
> }
> }'

Back to org default routing

Send uses_organization_default_routing: true to delete the scoped policy and fall back to the org default. The response returns routing_policy: null.

$curl -X PATCH https://api-gateway.merge.dev/v1/projects/{project_id} \
> -H "Authorization: Bearer mgmt_<your_management_key>" \
> -H "Content-Type: application/json" \
> -d '{ "uses_organization_default_routing": true }'