Appearance
Customer sign-in
19 operations. Paths are relative to https://api.frege.io.
Client portal entry point
GET/v1/client/{projectID}
Public. Returns status "connected" for a returning client with a valid session cookie, or "login_required" plus the metadata needed to render the project's login flow.
Authentication: none.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectID (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
Get the client's chat
GET/v1/client/{projectID}/chat
Public, session-cookie authenticated. Returns the client's single chat thread and its history, creating it on first access.
Authentication: none.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectID (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 404 | Not Found | error envelope |
Send a message in the client's chat
POST/v1/client/{projectID}/chat/messages
Public, session-cookie authenticated. Streams the assistant's reply as server-sent events. A customer somebody has written grants for reaches only what those grants still allow; a customer nobody has scoped reaches the environment's tools, confined by their own upstream credential. Documentation search is off on this door.
Authentication: none.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectID (required) | path | string | Project ID |
Request body (application/json)
Schema: api.sendMessageRequest.
| Field | Type | Description |
|---|---|---|
message | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | SSE stream | |
| 401 | Unauthorized | |
| 404 | Not Found | |
| 422 | Unprocessable Entity |
Authenticate a client against the project's upstream
POST/v1/client/{projectID}/connect
Public. Runs the project's auth flow with the caller's own credentials. Multi-step flows return status "prompt" with a carry token. On success a session cookie is set and the client record is created or reconnected.
Authentication: none.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectID (required) | path | string | Project ID |
Request body (application/json)
Schema: api.portalConnectRequest.
| Field | Type | Description |
|---|---|---|
carry | integer[] | |
input | object (map) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 502 | Bad Gateway | error envelope |
Finish a customer sign-in begun on the sign-in page
POST/v1/client/{projectID}/session
Public. The page that ran the recipe posts here the sealed hand-off ticket t it was given; the ticket names this environment and expires within minutes. A valid ticket sets the customer's portal session cookie and answers the "signed in" page; an expired or foreign one answers an HTML notice with 400.
Authentication: none.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
projectID (required) | path | string | Project ID |
Request body (application/x-www-form-urlencoded)
Type: string or string.
Responses
| Status | Description | Body |
|---|---|---|
| 200 | HTML | |
| 400 | HTML | |
| 404 | Not Found |
Connect a customer to the environment's upstream (connect page API)
POST/v1/connect/{ref}/connect
Public door of the connect page /p/{ref}: the bearer is the customer's own MCP token. Runs the environment's sign-in recipe with the posted input; a multi-step recipe answers status "prompt" with a carry to post back, a redirect step status "redirect", and success status "connected" with the customer. 401 without a valid token; 404 for an unknown environment or one without a recipe; 429 after ten attempts a minute; 502/503 when the upstream refuses or is down.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
ref (required) | path | string | Environment reference |
Request body (application/json)
Schema: mcp.connectRequest.
| Field | Type | Description |
|---|---|---|
carry | object | |
input | object (map) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data: mcp.connectResponse |
| 400 | Bad Request | error envelope |
| 401 | Unauthorized | error envelope |
| 404 | Not Found | error envelope |
| 429 | Too Many Requests | error envelope |
| 502 | Bad Gateway | error envelope |
| 503 | Service Unavailable | error envelope |
Get the project's upstream auth configuration
GET/v1/projects/{id}/upstream
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 |
Get a stage's custom connect-flow page
GET/v1/projects/{id}/upstream/connect-pages/{kind}
The project's own HTML for one of the three connect-flow pages (signin, done, notice). For signin, step selects which of the recipe's interactive steps the page is for — omit it for the first one, which is also what every template uploaded before multi-step support still means. 404 when that (stage, kind, step) still serves Frege's own — the state every one starts in.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
kind (required) | path | string | signin, done, or notice |
step | query | string | Recipe step id (signin only); defaults to the first interactive step |
lang | query | string | en, ru or uz (signin only): html comes back with its data-frege-title/description/label/lang hooks filled in that language, as the customer would see them; omit it for the stored html as uploaded |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Upload the project's own HTML for a connect-flow page
PUT/v1/projects/{id}/upstream/connect-pages/{kind}
Replaces Frege's own signin/done/notice page with the project's plain HTML — see internal/connecttemplate for the contract (a <form> with matching <input> names for signin; optional data-frege="heading"/"body"/"error" hooks elsewhere). For the signin page, upload is refused unless the template's data-entry inputs are exactly the stage's recipe's own field names — a mismatch here is a customer meeting a broken or silently-discarding form, not a linting nitpick. A signin upload must also carry exactly one data-frege-title and one data-frege-description element, and a <label for="<input id>" data-frege-label> for every field; data-frege-lang links (en, ru, uz) are optional. While public docs are open, the first signin page is also how a docs reader gets in: <a data-frege-provider="google"> links are pointed at that provider's sign-in, and any element marked data-frege-docs is removed while the docs are shut. A first signin page without such links is still saved, with docs_providers_missing in warnings.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
kind (required) | path | string | signin, done, or notice |
step | query | string | Recipe step id (signin only); defaults to the first interactive step |
Request body (application/json)
Schema: api.setConnectPageRequest.
| Field | Type | Description |
|---|---|---|
html | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Revert a connect-flow page to Frege's own
DELETE/v1/projects/{id}/upstream/connect-pages/{kind}
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
kind (required) | path | string | signin, done, or notice |
step | query | string | Recipe step id (signin only); defaults to the first interactive step |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Get the authored recipe
GET/v1/projects/{id}/upstream/recipe
Returns the authored recipe without secret values so the builder can load it for editing.
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 |
Save the upstream auth-flow recipe
PUT/v1/projects/{id}/upstream/recipe
Compiles and stores the authored recipe. Secrets are stored encrypted; re-saving without a secret keeps the existing one.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.configureRecipeRequest.
| Field | Type | Description |
|---|---|---|
auth_flow_exists | boolean | |
recipe | upstreamauth.AuthoredSpecRecipe | |
secret | object (map) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Run a recipe against the real upstream
POST/v1/projects/{id}/upstream/recipe/test
Executes an auth recipe and returns a step-by-step trace: resolved URL, request headers and body, status, and the upstream's own response — including for the step that failed. The project's connection is untouched; a run that connects stores its credential only on the reserved test client (default_client_id), and the run itself records no identities there — only an update_client hook step does. A run that connects is a real sign-in of the test client: it starts the environment's sign_in hooks exactly as a customer's sign-in does, with the sign-in's upstream answers. They run for real and in the background — webhooks are sent, notifications go out, update_client records on the test client, tools allowed to write do — and each run is listed under GET /hooks/{hookID}/runs like any other. Pass recipe to test an unsaved draft, or omit it to test the saved one. Values bound from the project's stored secret or config are masked in the trace. Pass refresh: true to also test the recipe's Refresh sub-recipe once this run connects — its steps append to the same trace, and its own outcome is reported separately as refresh_status/refresh_error/refresh_captured, never folded into status. A recipe with no Refresh sub-recipe reports refresh_status: "failed" rather than being silently skipped, so a check that specifically asked about renewal cannot pass by omission.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.testRecipeRequest.
| Field | Type | Description |
|---|---|---|
carry | integer[] | |
input | object (map) | |
recipe | upstreamauth.AuthoredSpecRecipe | |
refresh | boolean |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 400 | Bad Request | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
| 429 | Too Many Requests | error envelope |
Get spec metadata for the recipe builder
GET/v1/projects/{id}/upstream/spec-meta
Returns the operations, parameters, and security schemes the auth-flow builder anchors a recipe against.
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 |
| 409 | Conflict | error envelope |
Get the upstream connection status
GET/v1/projects/{id}/upstream/status
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 |
List the environment's variables and secrets
GET/v1/projects/{id}/variables
Returns every named value the environment holds. A secret's value is never included — only whether one is set.
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 |
Add a variable or a secret to the environment
POST/v1/projects/{id}/variables
Names are unique per environment, and one name cannot be both a variable and a secret. Whether a value is secret is fixed at creation.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createVariableRequest.
| Field | Type | Description |
|---|---|---|
description | string | |
name | string | |
secret | boolean | |
value | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Change a variable's value or description
PATCH/v1/projects/{id}/variables/{name}
Whether a value is secret cannot be changed here; delete it and create it again, so the change is visible in the audit trail.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
name (required) | path | string | Variable name |
Request body (application/json)
Schema: api.updateVariableRequest.
| Field | Type | Description |
|---|---|---|
description | string | |
value | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove a variable or secret
DELETE/v1/projects/{id}/variables/{name}
A recipe that still references the name will stop compiling until it is changed.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
name (required) | path | string | Variable name |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |