Appearance
Safety and limits
18 operations. Paths are relative to https://api.frege.io.
The rules that apply in this environment
GET/v1/projects/{id}/guardrails
This environment's own rules and its organization's, so somebody sees what they are subject to as well as what they set. Organization rules come first and cannot be edited here, then by name. A rule in record mode evaluates fully and writes its verdict but never acts — that is how you find out what a rule would do before it does it. Paginated by page/page_size like every other listing in this API: 20 per page by default, at most 100.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
page | query | integer | Page, from 1 |
page_size | query | integer | Page size, at most 100 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Add a rule to this environment
POST/v1/projects/{id}/guardrails
Ship it in record mode first. It then evaluates on every call and writes what it WOULD have done without doing it, so the count of near-misses is readable before anything is refused. Write it, attach it to an agent on that agent's own screen — a rule attached to nobody never fires.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.guardrailRequest.
| Field | Type | Description |
|---|---|---|
enabled | boolean | |
kinds | string[] | |
max_size | integer | |
message | string | |
mode | string | One of: record, enforce. |
name | string | |
rule | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 422 | Unprocessable Entity | error envelope |
Change a rule
PUT/v1/projects/{id}/guardrails/{guardrailID}
Flipping mode from record to enforce is the moment a rule starts refusing things, and it is recorded in the audit trail with what it was before.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
guardrailID (required) | path | integer | Guardrail ID |
Request body (application/json)
Schema: api.guardrailRequest.
| Field | Type | Description |
|---|---|---|
enabled | boolean | |
kinds | string[] | |
max_size | integer | |
message | string | |
mode | string | One of: record, enforce. |
name | string | |
rule | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a rule
DELETE/v1/projects/{id}/guardrails/{guardrailID}
Runs it already judged keep their record: the verdict rows hold the rule's name and settings, so history survives the rule.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
guardrailID (required) | path | integer | Guardrail ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |
The limit policies this environment is held to
GET/v1/projects/{id}/limits
Frege's caps, the organization's policies and this environment's own, in that order; only this environment's are editable here. Every policy that matches a subject holds it: the most restrictive decides.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Add a limit policy to this environment
POST/v1/projects/{id}/limits
As for an organization's (POST /orgs/{orgID}/limits), for this environment alone. At most 50 policies.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: settings.limitPolicyRequest.
| Field | Type | Description |
|---|---|---|
action | string | One of: refuse, record. |
burst | integer | |
enabled | boolean | |
key | string[] | |
match | settings.limitMatch | |
per_seconds | integer | |
rate | integer | |
surface | string | One of: agent.turn, tool.call, llm.tokens, message.out. |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Change a limit policy of this environment
PUT/v1/projects/{id}/limits/{policyID}
Replaces the policy with what is sent. Frege's caps, the organization's policies and another environment's are not found here.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
policyID (required) | path | integer | Policy ID |
Request body (application/json)
Schema: settings.limitPolicyRequest.
| Field | Type | Description |
|---|---|---|
action | string | One of: refuse, record. |
burst | integer | |
enabled | boolean | |
key | string[] | |
match | settings.limitMatch | |
per_seconds | integer | |
rate | integer | |
surface | string | One of: agent.turn, tool.call, llm.tokens, message.out. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a limit policy of this environment
DELETE/v1/projects/{id}/limits/{policyID}
Frege's caps, the organization's policies and another environment's are not found here.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
policyID (required) | path | integer | Policy ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Get a project's output-redaction settings
GET/v1/projects/{id}/redaction
Returns every redaction rule that applies to this environment — built-in patterns and custom rules alike — as one list, each row carrying its own key, label, description, regex and enabled state. A project with no override shows the built-in default patterns already ticked. enabled is the project-wide switch: when false, nothing in the list runs regardless of its own checkbox. With q, only rows whose label or key contains it (case-insensitively) are returned. Any project member may read it.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
q | query | string | Case-insensitive substring filter over each rule's label and key |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Enable or disable redaction for a project
PUT/v1/projects/{id}/redaction
Sets the project-wide switch: false stops every rule from running, built-in or custom, without discarding any of them. To change which individual patterns or rules apply, use the per-item endpoints under /redaction/items. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.setRedactionEnabledRequest.
| Field | Type | Description |
|---|---|---|
enabled | boolean |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Clear a project's output-redaction override
DELETE/v1/projects/{id}/redaction
Removes every custom rule and reverts every built-in pattern to the built-in default. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Add a custom redaction rule
POST/v1/projects/{id}/redaction/items
Adds a project-supplied rule to this environment's list, enabled from the start: {label, key, regex} masks what the regex matches anywhere in an answer, by label ([REDACTED:label]) or by its mask; {label, key, fields, mask} masks the fields named, at any depth and in lists, wherever an answer has them. A field is a key name or names joined by dots (passport.number), compared ignoring case, "_" and "-", so passport_number also matches passportNumber; up to 50. mask is remove (the key goes), hide ([hidden], the default for fields), initials (S. I.), phone (+998 ** *** ** 67), email (s***@mail.uz), last4 (**** 1111) or year (1987). A rule has a regex or fields, not both. Only field rules mask JSON numbers, so amounts and balances are never touched by a pattern. key must be unique among this stage's rules and cannot reuse a built-in pattern's key. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createRedactionItemRequest.
| Field | Type | Description |
|---|---|---|
description | string | |
fields | string[] | |
key | string | |
label | string | |
mask | string | One of: remove, hide, initials, phone, email, last4, year. |
regex | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | key already in use | error envelope |
| 422 | Unprocessable Entity | error envelope |
Update or toggle one redaction rule
PUT/v1/projects/{id}/redaction/items/{key}
Updates the rule named by key. For a BUILT-IN pattern only enabled is accepted — label, description and regex are fixed — so this is how a single built-in is turned on or off. For a CUSTOM rule any of label, description, regex, fields, mask and enabled may be given; omitted fields are left unchanged, and the rule must still have a regex or fields, not both. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
key (required) | path | string | Rule key, from the GET list |
Request body (application/json)
Schema: api.updateRedactionItemRequest.
| Field | Type | Description |
|---|---|---|
description | string | |
enabled | boolean | |
fields | string[] | |
label | string | |
mask | string | One of: remove, hide, initials, phone, email, last4, year. |
regex | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a custom redaction rule
DELETE/v1/projects/{id}/redaction/items/{key}
Deletes the custom rule named by key. A built-in pattern cannot be deleted — disable it instead via PUT with enabled=false. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
key (required) | path | string | Rule key, from the GET list |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | key names a built-in pattern | error envelope |
List the stage's wallet mandates
GET/v1/projects/{id}/wallet/mandates
The wallet's mandates (ADR-0062): what an agent may move for a customer through the stage's valued tools, per unit. A mandate with no customer_id is the stage's; one with a customer_id replaces it for that customer and unit. Amounts are in the unit's minor units (tiyin, cents); a cap left null does not apply. The stage's own come first, then each customer's.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Set a wallet mandate
PUT/v1/projects/{id}/wallet/mandates/{unit}
Sets the mandate for unit (a currency code, UZS) on the stage, or for one customer when customer_id is given, replacing the one there. A valued call is refused past per_call, per_day or per_week (a day and a week begin in time_zone, UTC by default) or when its side is not in sides (empty: any) or its arguments fail scope (a condition over args); it needs the customer's approval above ask_above or when its amount cannot be computed; else it runs. Amounts are minor units; per_call may not exceed per_day, nor per_day per_week. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
unit (required) | path | string | Currency code |
Request body (application/json)
Schema: api.putWalletMandateRequest.
| Field | Type | Description |
|---|---|---|
ask_above | integer | |
customer_id | integer | |
per_call | integer | |
per_day | integer | |
per_week | integer | |
scope | object | |
sides | string[] | |
time_zone | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a wallet mandate
DELETE/v1/projects/{id}/wallet/mandates/{unit}
Removes the stage's mandate for unit, or one customer's with customer_id, who then has the stage's. With none left, the unit's valued calls run as the write policy says. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
unit (required) | path | string | Currency code |
customer_id | query | integer | The customer whose mandate goes; without it, the stage's |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
List the stage's wallet moves
GET/v1/projects/{id}/wallet/moves
The wallet's ledger: each valued call an agent made for a customer, newest first, with what it moved (minor units), how it ended (reserved while running; executed, failed, or unknown when the upstream did not answer) and what let it through (mandate, approved, no_mandate). With customer_id, one customer's; next_before pages to older ones.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
customer_id | query | integer | One customer's moves |
before | query | integer | Moves older than this id (next_before) |
limit | query | integer | At most this many, 100 by default and at most |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |