Policies define rules that govern how users in your organization can use LLM models. When a policy is triggered, Toktra takes the configured action — allowing, blocking, alerting, or requiring approval for the request.Documentation Index
Fetch the complete documentation index at: https://docs.toktra.dev/llms.txt
Use this file to discover all available pages before exploring further.
The Policy object
Unique policy identifier (UUID).
UUID of the organization that owns this policy.
Human-readable policy name.
Optional description of what the policy does.
Target LLM model (e.g.,
gpt-4). null means the policy applies to all models.Action to take when the policy is triggered. One of:
allow, block, alert, require_approval.JSON object defining the conditions under which the policy fires. See Policy conditions below.
Whether the policy is currently active. Disabled policies are not evaluated.
ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
Policy conditions
Theconditions object expresses the criteria that must match for the policy to fire. Conditions use key-value pairs with operators:
engineering list.
List policies
Returns a cursor-paginated list of all policies in your organization.Query parameters
Pagination cursor from
next_cursor in the previous response.Items per page (1–100).
Example
Create a policy
Creates a new policy for your organization.Request body
Human-readable policy name. Maximum 255 characters.
Action to take when the policy fires. One of:
allow, block, alert, require_approval.Optional description.
Target model name. Omit or set to
null to apply to all models.JSON conditions object. See Policy conditions.
Whether the policy is active immediately after creation.
Example
201 Created)
Get a policy
Returns a single policy by ID.Path parameters
Policy UUID.
Example
200 OK)
Update a policy
Updates an existing policy. All fields are optional — only the fields you include are changed.Path parameters
Policy UUID.
Request body
New policy name. Maximum 255 characters.
New description.
New target model. Set to
null to apply to all models.New action:
allow, block, alert, or require_approval.Replacement conditions object.
Enable or disable the policy.
Example
200 OK) — returns the updated Policy object.
Delete a policy
Permanently deletes a policy. This action cannot be undone.Path parameters
Policy UUID.
Example
204 No Content with an empty body.
Error responses
| Status | Error | Description |
|---|---|---|
400 | bad_request | Missing required field or invalid value |
401 | unauthorized | Invalid or expired token |
404 | not_found | Policy ID does not exist |
429 | rate_limited | Rate limit exceeded |