---
title: "Create a reroute rule (owner or admin only)"
method: POST
path: "/api/reroutes"
tags: ["rerouting"]
---

# Create a reroute rule (owner or admin only)

`POST /api/reroutes`

## Request

- Base URL: `https://www.spendline.ai`
- URL: `https://www.spendline.ai/api/reroutes`
- Auth: API key in header `x-spendline-key`

A cross-provider reroute requires an ACTIVE stored provider key for the target, which only a human can add. Without one this returns 400 missing_provider_key.

## Request body

- Reroute
  - `id` string, uuid
  - `from_model` string, required
  - `to_model` string, required: Must be routable and must differ from from_model.
  - `rollout_percent` number
  - `scope` object, nullable: Optional. Omit for an account-wide rule.
    - `agent_id` string
    - `customer_id` string

## Response `201`

Created.

## Other responses

- `400`: Identical models, an unroutable target, or missing_provider_key for a cross-provider target.
- `403`: Insufficient authority.

---

[API](https://skmtc.dev/spendline/apis/spendline-api.md) · [All operations](https://skmtc.dev/spendline/apis/spendline-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spendline/apis/spendline-api/revisions/eb22b9415a28?raw)
