routing

Set Organization Routing Policy

Create or update a stored policy in one of the organization's workspaces.

Organization owners and admins only. workspace_id is required and must name a workspace of the caller's own organization; user_id is not accepted here.

post/v1/organizations/me/routing-policies

Request body

namestring required

Model name callers send, e.g. 'fast'.

rename_fromstring nullable

Current name of the policy to rename, in the same scope, meaning the same workspace and the same user. A rename never moves a policy between them. The stored row keeps its id and created_at and takes name and spec. Sending it asserts that policy exists, so a name with no stored row is a 404 rather than a create, even when it equals name. Omit to create or update the policy named name. Renaming changes what callers must send as model; usage already recorded keeps the old name.

specobject required

The policy body: select (with exactly one default entry, last), optional on_failure and guardrails. Same schema as a routing.policies entry in config.yml, and closed to unknown keys, so a typo is a 400 rather than a silently ignored setting.

user_idstring nullable

User this policy belongs to. Omit for a policy every caller in the workspace sees. A user-scoped policy resolves only for that user and shadows the workspace-wide one of the same name.

workspace_idstring uuid nullable

Workspace this policy belongs to. Omit for the deployment's default workspace. The policy resolves only for requests in that workspace, so two workspaces can each define their own 'fast'.

Response

Successful Response

created_atstring nullable
is_dynamicboolean
namestring required
sourcestring required
specobject required
updated_atstring nullable
user_idstring nullable
workspace_idstring uuid nullable

Changes