Skip to main content
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.

The Policy object

string
required
Unique policy identifier (UUID).
string
required
UUID of the organization that owns this policy.
string
required
Human-readable policy name.
string
Optional description of what the policy does.
string
Target LLM model (e.g., gpt-4). null means the policy applies to all models.
string
required
Action to take when the policy is triggered. One of: allow, block, alert, require_approval.
object
JSON object defining the conditions under which the policy fires. See Policy conditions below.
boolean
required
Whether the policy is currently active. Disabled policies are not evaluated.
string
required
ISO 8601 creation timestamp.
string
required
ISO 8601 last-updated timestamp.

Policy conditions

The conditions object expresses the criteria that must match for the policy to fire. Conditions use key-value pairs with operators:
This fires when the requesting user’s department is not in the engineering list.

List policies

Returns a cursor-paginated list of all policies in your organization.

Query parameters

string
Pagination cursor from next_cursor in the previous response.
integer
default:"25"
Items per page (1–100).

Example

Response

Create a policy

Creates a new policy for your organization.

Request body

string
required
Human-readable policy name. Maximum 255 characters.
string
required
Action to take when the policy fires. One of: allow, block, alert, require_approval.
string
Optional description.
string
Target model name. Omit or set to null to apply to all models.
object
JSON conditions object. See Policy conditions.
boolean
default:"true"
Whether the policy is active immediately after creation.

Example

Response (201 Created)

Get a policy

Returns a single policy by ID.

Path parameters

string
required
Policy UUID.

Example

Response (200 OK)

Update a policy

Updates an existing policy. All fields are optional — only the fields you include are changed.

Path parameters

string
required
Policy UUID.

Request body

string
New policy name. Maximum 255 characters.
string
New description.
string
New target model. Set to null to apply to all models.
string
New action: allow, block, alert, or require_approval.
object
Replacement conditions object.
boolean
Enable or disable the policy.

Example

Response (200 OK) — returns the updated Policy object.

Delete a policy

Permanently deletes a policy. This action cannot be undone.

Path parameters

string
required
Policy UUID.

Example

Response204 No Content with an empty body.
Deleting a policy is permanent. If you want to stop a policy from firing without losing its configuration, set enabled to false using the update endpoint instead.

Error responses