REST API Reference
SynapseOrch exposes a REST API for integrating agents and orchestrations into external applications. All endpoints require an API key for authentication.
Base URL
The API lives at /api/v1 and /api/v2 under one origin:
| Where | Origin |
|---|---|
| Self-hosted | http://localhost:3000 — your SynapseOrch address and the web UI's port |
| SynapseOrch Cloud | https://api.synapseorch.com |
The examples on these pages use http://localhost:3000; put your origin in its place. A self-hosted install serves the API through the web UI's port, which forwards /api/v1 and /api/v2 to the backend. Where you can reach the backend directly, http://localhost:8765/api/v1 works too (8765, or your SYNAPSE_BACKEND_PORT); the Docker images bind the backend to 127.0.0.1.
The CLI takes the origin alone, in SYNAPSE_API_URL, and adds the path itself.
Authentication
Every /api/v1 and /api/v2 endpoint requires an API key as a Bearer token:
Authorization: Bearer sk-syn-...A missing, invalid or revoked key returns 401 with Invalid or revoked API key. The key goes in that header only: an API key in the URL (?token=…) is refused, so read a stream with fetch rather than a browser EventSource, which cannot send the header.
Synapse's own MCP endpoint, /api/v1/mcp, takes the same key.
Generating API keys
Go to Settings → API keys, enter a name for the key (e.g. "Slack Bot") and click Generate — or run synapse api-keys generate <name>. On SynapseOrch Cloud, owners and admins create keys under Settings → Developer — see API keys and the Developer page for what a Cloud key can and cannot reach. The key — sk-syn- followed by 32 hex characters — is shown once; copy it then.
SynapseOrch stores only a SHA-256 hash of each key, in its database, so a lost key can't be recovered: delete it and generate another.
The screens, step by step: The public API, in the Guides.
Content type
All request bodies must be JSON:
Content-Type: application/jsonResponse format
Responses are JSON, except the /stream endpoints, which return text/event-stream: data: {…} lines, plus a : ping comment line after 10 seconds without an event. SSE clients ignore comment lines; if you parse the stream yourself, skip lines that start with :.
Errors follow this format:
{
"detail": "Error message describing what went wrong"
}Endpoints — /api/v1
V1 runs everything in the API process, and its run and chat calls either wait for the result or stream it. The work belongs to the server, not the request: a caller that stops waiting or reading leaves it running to the end — cancel it to stop it.
| Method | Path | Description | Reference |
|---|---|---|---|
| POST | /chat | Synchronous chat | POST |
| POST | /chat/stream | SSE streaming chat | POST |
| POST | /chat/{session_id}/cancel | Stop a chat turn | POST |
| POST | /chat/{session_id}/approve | Answer the tool call a turn stopped on, and carry it on (SSE) | POST |
| GET | /agents | List agents, without Synapse AI's own | GET |
| GET | /agents/{agent_id} | Get agent details | GET |
| GET | /orchestrations | List the workspace's workflows, without Synapse AI's own | GET |
| GET | /orchestrations/{orch_id} | Get a workflow's definition | GET |
| POST | /orchestrations/{orch_id}/run | Run workflow (sync) | POST |
| POST | /orchestrations/{orch_id}/run/stream | Run workflow (SSE) | POST |
| GET | /orchestrations/runs | Recent runs, newest first, by status or workflow | GET |
| GET | /orchestrations/runs/{run_id} | A run's state, and its result once it has ended | GET |
| GET | /orchestrations/runs/{run_id}/events | The run's events, as JSON | GET |
| GET | /orchestrations/runs/{run_id}/events/stream | The run's events, then the run followed live (SSE) | GET |
| POST | /orchestrations/runs/{run_id}/resume | Resume paused run (sync) | POST |
| POST | /orchestrations/runs/{run_id}/resume/stream | Resume paused run (SSE) | POST |
| POST | /orchestrations/runs/{run_id}/cancel | Stop a run | POST |
| GET, POST | /schedules | List and create schedules | GET · POST |
| GET, PATCH, DELETE | /schedules/{schedule_id} | Read, change or delete a schedule — {"enabled": false} pauses it | GET · PATCH · DELETE |
| POST | /schedules/{schedule_id}/run | Run a schedule now, as a test | POST |
| POST | /mcp | Synapse's own MCP server | — |
| GET, POST, PATCH, DELETE | /knowledge/… | Knowledge bases: bases, uploads, records, web pages, documents and search | Knowledge |
| GET, POST, PATCH, DELETE | /webhooks/… | SynapseOrch Cloud: webhook endpoints | Webhooks |
See Chat API, Workflows API, Knowledge API and Webhooks. Each endpoint's page in the reference — under Reference: v1 in the sidebar — has its fields, every answer and samples in cURL, JavaScript, Python and Go.
Endpoints — /api/v2
V2 queues work for scale mode workers and answers at once. On a self-hosted install without scale mode, every V2 endpoint returns 503; SynapseOrch Cloud always serves it. Like v1, it does not list, serve or run Synapse AI's own workflow, nor read its runs. Each endpoint's page is under Reference: v2 in the sidebar.
| Method | Path | Description | Reference |
|---|---|---|---|
| GET | /orchestrations, /orchestrations/{orch_id} | List and get workflows | list · get |
| POST | /orchestrations/{orch_id}/run | Queue a run — 202 with run_id, stream_url, status_url | POST |
| GET | /orchestrations/runs | SynapseOrch Cloud: recent runs, newest first, by status or workflow | GET |
| GET | /orchestrations/runs/{run_id}/status | Run status | GET |
| GET | /orchestrations/runs/{run_id}/stream | SSE stream, resumable with Last-Event-ID | GET |
| GET | /orchestrations/runs/{run_id}/events | The run's stored events, as JSON | GET |
| POST | /orchestrations/runs/{run_id}/cancel | Cancel a run | POST |
| POST | /orchestrations/runs/{run_id}/resume | Resume a paused run — 202 | POST |
| GET | /agents, /agents/{agent_id} | List and get agents | list · get |
| POST | /chat | Queue an agent chat turn — 202 with session_id; an unknown agent is a 404 before anything is queued | POST |
| GET | /chat/{session_id}/stream, /status, /events | Follow a chat session | stream · status · events |
| POST | /chat/{session_id}/cancel | Cancel a chat turn | POST |
| GET | /workers, /queue/stats | Worker registry and queue statistics — self-hosted only | workers · stats |
Run and resume requests accept webhook_url and webhook_secret to be called back when the run ends. See Scale Architecture for the full round trip. A chat request accepts them too: the callback carries status completed with the answer, or failed with The agent encountered an error processing your request. when the turn failed — its model's own error included, which is never sent as the answer.
The run stream is resumable with Last-Event-ID; read it with fetch and the Authorization header, never a browser EventSource with the key in the URL, which is a 401. A chat stream's or events' error says which kind of failure it was — the model's quota, a refusal, a rate limit, an outage, or no usable answer — and never passes on the provider's own words. /chat/{session_id}/status returns the conversation's messages; an assistant message may carry reasoning and thoughts, lists of the newest 20 of each, each at most 4,000 characters.
Agent resolution
The chat endpoints of both /api/v1 and /api/v2 accept an optional agent parameter (name or ID). It is matched in this order:
- Exact ID match
- Exact name match, ignoring case
Anything else — a partial or misspelt name — returns 404; there is no fallback to another agent. With no agent given, the workspace's first agent, the oldest in the store, answers. Synapse AI's own agents are never chosen or matched, and GET /api/v1/agents does not list them.
Rate limits
On a self-hosted install, /api/v1 does not enforce rate limits — limits are determined by your model provider's quotas. /api/v2 run submissions are limited per tenant (1,000 per second by default) and return 429 above it, as they do when 1,000 runs are already queued, running or paused; a nested run counts as part of the run that started it. A full queue returns 503. See Configuration.
SynapseOrch Cloud limits each key to 300 requests a minute, and each organisation to 1,200. Starting work — a run, a chat turn, an answer to a paused run — has its own limit of 60 a minute per key, and a key holds at most 25 open streams. Above any of these the answer is 429 with Retry-After. Knowledge searches have their own limit, 120 a minute per key, shared with MCP's search_knowledge. A run also needs credits. One started beyond your plan's runs at once is not refused: it waits in line and reads queued, with its queue_position, until a slot frees — see Capacity. 429 then means the line itself is full.
Error codes
| Code | Meaning |
|---|---|
400 | Chat with no agent given, and no agents configured |
401 | Missing, invalid or revoked API key |
403 | SynapseOrch Cloud: a key not made with Can also build asked to change the setup — a schedule, a knowledge base, a webhook endpoint (What a key can do) |
404 | Agent, workflow or run not found |
202 | SynapseOrch Cloud: a synchronous /api/v1 run, answer or chat still running after 300 seconds — {"status": "running", "run_id", "status_url"}, or "queued" with queue_position for a run still waiting for a slot; the work carries on, so read it back |
409 | A resume for a run that is not waiting for an answer, or a second answer to it queued at the same moment; /api/v1 chat: a reply is still being written in that session, or an approve for a call the conversation is not waiting on |
422 | The request body is missing a required field, has the wrong type, or has a field the endpoint does not take (named in the error); an empty answer to a resume; an initial_state key starting with _; a chat image malformed or over the limits |
429 | /api/v2: rate limit or queued-run limit reached; SynapseOrch Cloud: a key or organisation limit, or as many runs already waiting for a slot as the plan lets wait, with Retry-After |
500 | An error while handling the request |
503 | /api/v1 chat: the server is still starting; /api/v2: scale mode is not enabled, or the queue is full |