Skip to content

Requests and responses ​

How every route of https://api.frege.io/v1 behaves.

Requests ​

  • Bodies are JSON (Content-Type: application/json), except uploads: a spec is sent as the document itself, files as multipart/form-data with the field file.
  • Project, agent and webhook source ids are UUIDs; a customer's id (client_id) is a number.
  • Project routes act on one environment: see Environments.

Responses ​

A success is wrapped in data:

json
{"data": {"id": "6f1c…", "name": "Shop"}}

A failure is wrapped in error; see Errors. A 204 has no body.

Pages ​

Lists answer one page at a time:

json
{"data": {"list": [{"id": 1}, {"id": 2}], "total": 120,
  "metadata": {"current_page": 1, "page_size": 50, "first_page": 1, "last_page": 3, "total_records": 120}}}
ParameterWhat it does
pageThe page, from 1 (the default).
page_sizeRows per page: 50 by default; each route says its maximum (100 to 500).
sortA field the route allows, with - before it for descending: sort=-created_at.
qA case-insensitive search, where the route offers one.

Some routes still take limit and offset instead of page and page_size; they are deprecated where the reference says so. Never send both pairs.

Conversations, handoffs and run events are read forward with a cursor instead: pass the previous answer's next_after as after, or for a run's events the last sequence number you saw.

Idempotency ​

Six routes take an Idempotency-Key header, a UUID: taking, transferring and closing a handoff, replying in one, uploading a file for a reply, and adding a note on a customer. A retry with the same key and body answers the first outcome again; the same key with another body answers 409 handoff_idempotency_conflict. Other routes take no such header.

For webhooks into Frege, a source's delivery_id_header deduplicates deliveries (see Webhooks). For webhooks out of Frege, Webhook-Id is the same on every attempt.

Rate limits ​

A request refused by one of Frege's limits answers 429 with code too_many_requests, and Retry-After says when to try again. Limits apply at several places:

  • the edge, per client address (it answers 429 too);
  • your organization's and environment's own limit policies (agent turns, tool calls, model tokens, outgoing messages), set with /v1/orgs/{orgID}/limits and /v1/projects/{id}/limits;
  • some routes' own: a recipe test ten times a minute per environment, a confirmation code once a minute, webhook sources 20 deliveries a second.

A tool call refused by a limit inside an agent turn or on MCP does not fail the request: the model is told rate_limited with retry_after_seconds.

Versioning ​

The API's version is in its path, /v1. Its contract is https://api.frege.io/v1/openapi.json, from the same source as the reference.

  • Changes inside v1 add: new routes, new optional fields, new error codes. A breaking change is a new version.
  • What tenants build on (API keys and the routes they reach, the MCP servers, hook delivery bodies) is deprecated at least 90 days before it goes, with Deprecation and Sunset headers and a notice.
  • Error codes are never renamed or given another meaning.

Read unknown fields as harmless: an answer may gain fields at any time.