routing

Set Policy

Create or update a stored policy in one workspace, optionally for one user.

Omitting workspace_id means the deployment's default workspace, which is where an operator acting deployment-wide writes.

post/v1/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

Changed in 3 of the 143 revisions of this API.4

    • added the new optional request property

      new-optional-request-property

    • added the optional property to the response with the status

      response-optional-property-added

    • added the new optional request property

      new-optional-request-property

    • endpoint added

      endpoint-added