Appearance
Projects
27 operations. Paths are relative to https://api.frege.io.
List the caller's projects in one organization
GET/v1/projects
Returns the projects the caller can reach WITHIN the given organization — those in an organization they admin, plus those they are a member of — each annotated with their effective role. Archived projects are excluded unless archived=true. org_id is required: this endpoint used to answer across every organization at once and leave the client to discard the rest, which is a filter a client can forget. An organization the caller cannot reach returns an empty list rather than 404, so the response never reveals which organization ids exist. q filters case-insensitively over name and description before the page is cut, so total reflects the filtered set.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
org_id (required) | query | string | Organization to list within (required) |
archived | query | boolean | Include archived projects (default false) |
q | query | string | Case-insensitive filter over name and description |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 200) |
sort | query | string | Order: created_at, name, id, each also accepted with a leading - for descending |
limit | query | integer | DEPRECATED, use page_size. Max projects per page (max 200) |
offset | query | integer | DEPRECATED, use page. Rows to skip (default 0) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 422 | org_id missing or not a valid id | error envelope |
Create a project
POST/v1/projects
Creates a project in an organization the caller admins. org_id is only required when the caller admins more than one organization. The upstream base URL is not set here — a fresh project has none until it is configured afterward, per stage, via PATCH /projects/{id} or the upstream endpoints.
Authentication: bearer token.
Request body (application/json)
Schema: api.createProjectRequest.
| Field | Type | Description |
|---|---|---|
description | string | |
name | string | |
org_id | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Get a project
GET/v1/projects/{id}
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 |
Update a project
PATCH/v1/projects/{id}
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.updateProjectRequest.
| Field | Type | Description |
|---|---|---|
default_locale | string | |
description | string | |
name | string | |
upstream_base_url | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Delete a project
DELETE/v1/projects/{id}
Permanently deletes the project and everything belonging to it (spec, docs, chats, clients, memberships). Refused (409) once the project has been published — its MCP address may already be in customers' AI clients; archive it instead. Only the organization admin can delete.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |
| 409 | Already published — archive it instead | error envelope |
A channel's report
GET/v1/projects/{id}/analytics/channels
The environment's handoffs — created, accepted, resolved, returned, the rates and the time to accept, by reason and by agent — and the widget's traffic, over [from, to) in Asia/Tashkent days, with the previous window of equal length and a series by day or week (weeks from Monday). door narrows to one channel. Rates are fractions 0 to 1, and null means unavailable, not zero; totals come from totals, never from summing series. At most 366 days.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
from (required) | query | string | First day, YYYY-MM-DD |
to (required) | query | string | Day after the last, YYYY-MM-DD |
bucket (required) | query | string | Series step One of: day, week. |
door | query | string | Only this channel One of: embed, portal, telegram, voice. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
The operations' report
GET/v1/projects/{id}/analytics/operations
One page of the environment's goal operations over [from, to) in Asia/Tashkent days. The call counts are the tool gateway's and not handed to the CRM yet: they are null, unavailable. door and sort are checked and kept for when they are; page from 1, page_size at most 100 (20 by default).
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
from (required) | query | string | First day, YYYY-MM-DD |
to (required) | query | string | Day after the last, YYYY-MM-DD |
door | query | string | Only this channel One of: embed, portal, telegram, voice. |
sort | query | string | Order One of: calls, clients, failures, success_rate. |
page | query | integer | Page, from 1 |
page_size | query | integer | Page size, at most 100 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
The widget's funnel
GET/v1/projects/{id}/analytics/widget-funnel
The widget's impressions, opens and first messages over [from, to) in Asia/Tashkent days, in all and by embedding site; origin narrows to one site. identified and goals are the other modules' counts and null, unavailable, as is coverage. At most 366 days.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
from (required) | query | string | First day, YYYY-MM-DD |
to (required) | query | string | Day after the last, YYYY-MM-DD |
origin | query | string | Only this embedding site |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
List a project's API keys
GET/v1/projects/{id}/api-keys
Returns the project's API keys, newest first, without their secrets. 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 |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Mint an API key for a project
POST/v1/projects/{id}/api-keys
Creates a key that lets an organization's own code call this project's tools with no human sign-in — list operations and invoke tools, bounded by the project's write policy, and nothing else. A widget key (kind widget) is the one to put in a web page: it only starts the chat widget for a person that page signed in, and every other route refuses it. The secret is returned once in this response and never again; store it now. 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.createAPIKeyRequest.
| Field | Type | Description |
|---|---|---|
expires_at | string | |
kind | string | |
name | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Revoke an API key
DELETE/v1/projects/{id}/api-keys/{keyID}
Stops a key working, immediately and permanently. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
keyID (required) | path | integer | API key ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Archive a project
POST/v1/projects/{id}/archive
Archives the project without deleting any of its data: its MCP server stops serving on every endpoint and it drops out of the default project listing. Reversible via unarchive. Only the organization admin can archive.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
List a project's audit events
GET/v1/projects/{id}/audit
Newest-first security-relevant events for the project: management actions (token regeneration, redaction changes, membership changes, spec uploads, upstream configuration, archive/delete) and, when kind is unset or "tool", per-tool-call events (project.tool.call — who executed which operation, its outcome, its upstream status, and for a failure a classified reason drawn from a fixed vocabulary: dns_failure, egress_refused, timeout, no_credential and so on, never the upstream's own words). Filter with kind=admin (management only) or kind=tool (tool calls only), actor_email, action and/or actions. WHICH ENVIRONMENT: ?stage=live, ?stage=staging or ?stage=all; with no stage query the X-Frege-Stage header is used, and with neither you get both. The query parameter deliberately WINS over the header here, because the header is the client's ambient environment while the query is an explicit choice about this list. Paginated by page/page_size like every other listing in this API, newest first by default. Organization admin or a manager of production reads every event; a manager of staging only, without production access, may read staging's events alone — stage must then resolve to staging, so asking for live or for all is refused.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
kind | query | string | Filter by class: 'tool' (tool calls only) or 'admin' (management only); omit for all One of: tool, admin. |
X-Frege-Stage | header | string | Ambient environment, used when no stage query parameter is given One of: live, staging. |
stage | query | string | Which environment: 'live', 'staging', or 'all' for both (org admin / production manager only). Overrides the X-Frege-Stage header. One of: live, staging, all. |
actor_email | query | string | Case-insensitive filter over the acting user's email |
action | query | string | Case-insensitive SUBSTRING filter over the action name, e.g. 'redaction' or 'project.spec.upload' |
actions | query | string[] | EXACT-match multi-select over the action name, from the fixed vocabulary at GET /v1/audit/actions. Repeat the parameter (actions=a&actions=b) or comma-separate one (actions=a,b); an unrecognised name 422s. Combined with action, not a replacement for it. |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 200) |
sort | query | string | Order: created_at, also accepted with a leading - for descending (default -created_at) |
limit | query | integer | DEPRECATED, use page_size. Max events per page (max 200) |
offset | query | integer | DEPRECATED, use page. Rows to skip (default 0) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
List a project's outstanding invitations
GET/v1/projects/{id}/invitations
Only live invitations — accepted ones are members and appear under /members instead, and revoked or expired ones are not offers. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 200) |
sort | query | string | Order: created_at, email, role, id, each also accepted with a leading - for descending |
limit | query | integer | DEPRECATED, use page_size. Max invitations per page (max 200) |
offset | query | integer | DEPRECATED, use page. Rows to skip (default 0) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Invite someone to a project
POST/v1/projects/{id}/invitations
Sends an invitation email with an accept link. NOTHING is granted until the recipient accepts — no membership row, and no user account for an address that has not registered. Re-inviting an address that already has an invitation outstanding replaces it: the role and expiry are refreshed and the previous link stops working. Refused (409) for an address that is already the organization admin or already a member of this environment. Organization admin or project manager only; only the org admin may invite a manager.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createInvitationRequest.
| Field | Type | Description |
|---|---|---|
email | string | |
role | string | One of: manager, developer, viewer. |
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 |
Withdraw an outstanding invitation
DELETE/v1/projects/{id}/invitations/{invitationID}
The link stops working immediately. An invitation that was already accepted cannot be revoked — remove the member instead — and that returns 409 rather than pretending the access was undone. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
invitationID (required) | path | integer | Invitation ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
List a project's members
GET/v1/projects/{id}/members
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 200) |
sort | query | string | Order: created_at, name, email, role, id, each also accepted with a leading - for descending |
limit | query | integer | DEPRECATED, use page_size. Max members per page (max 200) |
offset | query | integer | DEPRECATED, use page. Rows to skip (default 0) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Change a member's project role
PATCH/v1/projects/{id}/members/{userID}
The org admin can set any role; project managers can only move members between developer and viewer.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
userID (required) | path | integer | User ID |
Request body (application/json)
Schema: api.updateMemberRequest.
| Field | Type | Description |
|---|---|---|
role | string | One of: manager, developer, viewer. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a member from a project
DELETE/v1/projects/{id}/members/{userID}
The org admin can remove anyone; project managers can only remove developers and viewers.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
userID (required) | path | integer | User ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Grant a member "Run as a client" access
PUT/v1/projects/{id}/members/{userID}/run-as-client
Lets userID run this project's tools as one of its connected customers via POST /projects/{id}/tools/{toolName}/invoke's client_id — spending that customer's real, stored credential against their real account. This REPLACES the project-role check that action used to enforce: a manager no longer gets it for free, and a developer can hold it without being promoted. Scoped to the whole project, not one environment. An optional body narrows WHICH tools: {"tool_names": ["create_invoice"]} permits only those (matched against the names tools/list and /spec/operations already use); omitting the body, or sending tool_names: null, grants NOTHING — a member never gets every tool by default, so the organization admin must name the tools explicitly to permit any; sending tool_names: [] is the same empty grant made explicit. To grant every tool, send the reserved sentinel {"tool_names": ["$all"]} — the explicit, unambiguous way to request an unrestricted grant. Organization admin only. Idempotent, and re-PUTting with a different tool_names REPLACES the previous scope outright — there is no separate endpoint to narrow or widen an existing grant.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
userID (required) | path | integer | User ID — must already be a member of this project, in either environment |
Request body (application/json)
Schema: api.grantRunAsClientRequest.
| Field | Type | Description |
|---|---|---|
tool_names | string[] |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Revoke a member's "Run as a client" access
DELETE/v1/projects/{id}/members/{userID}/run-as-client
Removes the grant POST .../members/{userID}/run-as-client gave: userID can no longer impersonate this project's customers, regardless of their project role. 404 if they never held it. Organization admin only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
userID (required) | path | integer | User ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
What changes on the environment, as it changes
GET/v1/projects/{id}/notices
Server-sent events, one stream per environment (ADR-0061): each says that something changed, never what it is now, so the page reads it again through its own route. The first event is ready, and ready again means notices may have been missed: read what is shown again. The kinds, each with the id of what changed: agent.eval_run.changed (a run), agent.eval_comparison.changed (a comparison), agent.playground_session.changed (a playground session), llm.usage.priced, hooks.run.changed (a hook), knowledge.source.changed (a document source), upstream.customer.forgotten (a purged customer, whose purge it ends), voice.call.changed (a call), identity.domain.changed (a project whose domain was checked), billing.card.bound (a card the payment gateway confirmed), mcp.wallet.moved (a customer whose wallet moved: a call reserved or settled). A stream also hears its organization's notices. A comment line keeps a quiet stream open every 15 seconds; the stream ends after 5 minutes, and a reconnect checks access again.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | SSE stream | |
| 401 | Unauthorized | |
| 403 | Forbidden | |
| 404 | Not Found | |
| 422 | Unprocessable Entity |
A project's setup guide
GET/v1/projects/{id}/setup
Which of the setup guide's six steps the project has done (ADR-0063): spec (a spec uploaded), sign_in (upstream sign-in configured), agent (an agent created), playground (a playground session opened), channel (one of the channels in channels set up: a bot, the chat on the member's site, the MCP server published) and promote (a spec promoted to Production). A step counts once its action was ever recorded in the project's audit trail, in either environment, so it never turns back. The same in both environments: X-Frege-Stage is not read. Anyone who may see the project.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 404 | Not Found | error envelope |
The caller's sidebar in a project
GET/v1/projects/{id}/sidebar
What the dashboard's sidebar shows for the caller in this project (ADR-0063). guided is true for a project made since the setup guide: its sidebar grows as the guide's steps (GET /projects/{id}/setup) are done; a project made before shows every page. pinned is the pages the caller added to the sidebar, in order: dashboard page names, kept as given. The same in both environments. Signed-in people only: an API key has no sidebar (401).
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 404 | Not Found | error envelope |
Pin pages to the caller's sidebar
PUT/v1/projects/{id}/sidebar
Replaces the pages the caller pinned in this project with pinned, in its order (ADR-0063). Each is a page name: a lowercase letter, then lowercase letters, digits or dashes, at most 40 characters; at most 40 pages; a repeat is dropped. An empty list unpins every page. Not audited: a pin is a view preference. Signed-in people only (401 for an API key).
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.pinPagesRequest.
| Field | Type | Description |
|---|---|---|
pinned | string[] |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
List a project's environments
GET/v1/projects/{id}/stages
Both environments — Production and Staging — with each one's MCP address, publish state, upstream host and serving spec version. The address is empty until the environment has a spec generating at least one tool and a configured upstream credential; once ready, it is returned whether or not it is published, because it is a name rather than a secret and a screen has to show what it will be.
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 |
Unarchive a project
POST/v1/projects/{id}/unarchive
Restores an archived project: its MCP server serves again and it reappears in listings. Only the organization admin can unarchive.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |