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.

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.

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",
> "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 }'