REST API
HTTP API surface — all endpoint groups, authentication, pagination, errors, and rate limits.
Sophon exposes every feature through a REST API at /api/* on the Gateway. The Dashboard, CLI, and Mobile app all use the same API; there are no internal endpoints.
Base URL
https://<gateway>/apiDefault Gateway port in development: 8080.
Authentication
| Mode | Used by | Header |
|---|---|---|
| JWT Bearer | Dashboard, CLI after sophon login, Mobile | Authorization: Bearer <jwt> |
| API tokens | CI, scripts, long-lived integrations | Authorization: Bearer sk_... |
| OIDC SSO | Enterprise SSO-configured deployments | JWT from IdP after OIDC exchange |
| No auth | Personal tier with AutoAdmin: true in config (dev only) | — |
Tokens are user-scoped. Multi-tenant deployments also require tenant context (see Tenants).
Endpoint groups
All endpoints live under /api. Major groups:
Identity & auth
POST /auth/login— email + password → JWTPOST /auth/logout— revoke current sessionPOST /auth/refresh— renew JWT before idle timeoutPOST /auth/tokens— create API tokenGET /auth/me— current user infoGET /auth/sessions— active sessions for current userDELETE /auth/sessions/{id}— revoke a session
Agents
GET /agents/POST /agents/GET|PATCH|DELETE /agents/{id}GET|PUT /agents/{id}/soul— read/write SOUL.mdGET|PUT /agents/{id}/boot— BOOT.mdGET|PUT /agents/{id}/heartbeat— HEARTBEAT.mdGET|PUT /agents/{id}/tools— tool allowlist
Chat + sessions
POST /chat— send a message synchronously (returns immediately, task runs in background)GET /sessions— listGET /sessions/{id}— describeGET /sessions/{id}/messages— message historyPOST /sessions/{id}/fork— fork a sessionDELETE /sessions/{id}— delete
Memory
GET /memory/entries— paginated list with filters (scope, category, agent)POST /memory/entries— createGET|PATCH|DELETE /memory/entries/{id}GET /memory/search?q=&scope=&limit=POST /memory/entries/{id}/forget— gated via approvalGET /memory/graph?entity=&depth=— traverse the entity graphGET /memory/daily-logs?date=
Workflows
GET|POST /workflowsGET|PATCH|DELETE /workflows/{id}POST /workflows/{id}/triggerPOST /workflows/{id}/pause/POST /workflows/{id}/resumePOST /workflows/{id}/cloneGET /workflows/{id}/runsGET /workflows/{id}/runs/{runId}GET /workflows/{id}/history
Skills
GET /skills— installedPOST /skills/install— from URL or marketplace nameDELETE /skills/{name}GET /skills/{name}— manifest + detailsPOST /skills/author— generate via LLMPOST /skills/{name}/enable/DELETE /skills/{name}/enable(per-agent)
Documents
POST /documents/upload— multipart/form-dataGET /documents— paginated, filterableGET /documents/{id}— metadata + extracted textGET /documents/{id}/raw— original filePOST /documents/{id}/summarizePOST /documents/{id}/extract— structured extractionPOST /documents/compare— multi-doc analysisDELETE /documents/{id}
Channels
GET /channels— list configuredPOST /channels— addGET|PATCH|DELETE /channels/{id}POST /channels/{id}/test
Connections
GET /connectionsPOST /connections/{service}/authorize— start OAuth flowGET /connections/{service}/callback— OAuth callbackPOST /connections— API key / manual credentialsGET|DELETE /connections/{id}POST /connections/{id}/testPOST /connections/{id}/rotate
Cron jobs
GET|POST /cronGET|PATCH|DELETE /cron/{id}POST /cron/{id}/triggerPOST /cron/{id}/pause/POST /cron/{id}/resumeGET /cron/{id}/history
Webhooks
GET|POST /webhooksGET|PATCH|DELETE /webhooks/{id}POST /webhooks/{id}/testGET /webhooks/{id}/deliveriesPOST /webhooks/{id}/deliveries/{deliveryId}/retryPOST /webhooks/{id}/rotate-secretPOST /webhooks/receive/{slug}— inbound webhook target
Tasks
GET /tasks/activeGET /tasks/historyGET /tasks/{id}POST /tasks/{id}/cancel
Canvas
GET /canvas?session=— list canvases in a sessionGET /canvas/{id}POST /canvas/{id}/forkGET /canvas/{id}/export— zip of filesDELETE /canvas/{id}
Claude Code
GET|POST /claude-codeGET|DELETE /claude-code/{id}POST /claude-code/{id}/messages— send a messageGET /claude-code/{id}/events— event stream (SSE)POST /claude-code/{id}/exec— shell commandGET /claude-code/{id}/export— zip of project
Discussions
GET|POST /discussionsGET|PATCH|DELETE /discussions/{id}POST /discussions/{id}/runs— start a runGET /discussions/{id}/runs— list runsGET /discussions/runs/{runId}POST /discussions/runs/{runId}/cancel
Insights
GET /insights/metrics?window=GET /insights/summaryGET /insights/cardsPOST /insights/cards/{id}/dismissPOST /insights/query
Approvals
GET /approvals— pendingGET /approvals/{id}POST /approvals/{id}/approvePOST /approvals/{id}/edit— approve with modificationsPOST /approvals/{id}/rejectGET /approvals/history
Voice
GET /voice/providersGET /voice/voices?provider=POST /voice/speak— synthesize (returns audio stream)POST /voice/transcribe— transcribe audioGET|PUT /voice/config
Home feed
GET /home— composed home feed (hero, insights, thought, summary, on-this-day, active tasks)
Sophon Node
GET|POST /nodesGET|PATCH|DELETE /nodes/{id}POST /nodes/{id}/approvePOST /nodes/{id}/scopesPOST /nodes/{id}/command— execute commandGET /nodes/me/commands— polled by the node (fallback transport)POST /nodes/me/pair— pairing flowPOST /nodes/me/heartbeat
MCP
GET|POST /mcp/servers— client-side MCP server registrationsGET|PATCH|DELETE /mcp/servers/{id}POST /mcp/servers/{id}/testGET /mcp/servers/{id}/toolsGET /mcp/server/status— own server statusGET|PUT /mcp/server/configGET|POST /mcp/server/tokensDELETE /mcp/server/tokens/{id}GET /mcp/sse/GET /mcp/http— transport endpoints (MCP clients connect here; not for general REST callers)
Push notifications
POST /push/devices— registerGET /push/devicesDELETE /push/devices/{id}GET|PUT /push/devices/{id}/preferencesPOST /push/test
Admin (requires Admin role)
GET|POST /admin/usersGET|PATCH|DELETE /admin/users/{id}POST /admin/users/{id}/logoutGET|POST /admin/rolesGET|PATCH|DELETE /admin/roles/{id}GET /admin/audit?filter=...GET /admin/audit/exportGET|POST /admin/licensePOST /admin/license/verifyGET|POST /admin/onboarding— remote-access tickets
Tenants (Enterprise)
GET|POST /admin/tenantsGET|PATCH|DELETE /admin/tenants/{id}GET /admin/tenants/{id}/users— tenant membershipPOST /admin/tenants/{id}/users— assign userPOST /admin/tenants/{id}/exportPOST /admin/tenants/import
Operations (Operator/Admin)
GET /ops/health— deep health checkGET /ops/system— resource usagePOST /ops/pause/POST /ops/resume/POST /ops/drainPOST /ops/services/{name}/restartPOST /ops/caches/{name}/flushPOST /ops/diagnostics/runGET /ops/diagnostics/bundle
Compliance
POST /compliance/reports— generateGET /compliance/reports/{id}GET /compliance/reports/{id}/downloadPOST /compliance/dsar— data subject access requestGET|POST /compliance/retentionPOST /compliance/access-reviews
Backup
POST /backup— createGET /backup/{id}/statusGET /backup/{id}/downloadPOST /backup/restorePOST /backup/verify
Public
GET /health— shallow health (load balancers)GET /versionGET /tools— available tool catalog
Pagination
List endpoints support offset or cursor pagination (depending on resource):
GET /memory/entries?limit=50&cursor=<opaque>Response:
{
"items": [...],
"nextCursor": "eyJpZCI6Im1lbV94eXoiLCJ...",
"hasMore": true
}Cursor tokens are opaque — don't parse them, just pass them back.
Error format
{
"error": {
"code": "not_authorized",
"message": "Missing required permission: ManageWorkflows",
"details": { "permission": "ManageWorkflows" },
"requestId": "req_abc123"
}
}Common codes:
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_request | Malformed body / params |
| 401 | unauthenticated | Missing / expired token |
| 403 | not_authorized | Missing permission / tenant mismatch |
| 404 | not_found | Resource doesn't exist or you can't see it |
| 409 | conflict | Resource state conflict (e.g., pair already complete) |
| 413 | payload_too_large | Over upload / body size limit |
| 422 | validation_failed | Schema validation error |
| 429 | rate_limited | Hit a rate limit (headers include Retry-After) |
| 500 | internal_error | Unexpected |
| 502 | upstream_unavailable | LLM provider / external service failed |
| 503 | service_unavailable | Gateway in drain mode |
Include X-Sophon-Request-Id with support tickets.
Rate limits
Default per-user rate limits (configurable):
| Category | Limit |
|---|---|
| Read-heavy (GET list / describe) | 120/min |
| Write-heavy (POST, PATCH, DELETE) | 60/min |
| Approval / cancel | 30/min |
| Expensive (doc upload, backup, DSAR) | 10/min |
| Send message / chat | 60/min |
Exceeding limits returns 429 with Retry-After header. Limits are per-user; API tokens have separate per-token limits.
Content types
- Requests:
application/jsonunless otherwise noted - Responses:
application/json - Uploads:
multipart/form-datafor files - Event streams (Claude Code):
text/event-stream(SSE)
Tenant context
For multi-tenant deployments, specify tenant via:
X-Sophon-Tenant: acmeOr use tenant-scoped URL prefixes:
/api/tenants/acme/workflowsSee Tenants.
OpenAPI
The Gateway exposes Swagger / OpenAPI at:
https://<gateway>/swagger
https://<gateway>/swagger/v1/swagger.jsonUse this to generate SDKs in any language:
npx @openapitools/openapi-generator-cli generate \
-i https://gw.example.com/swagger/v1/swagger.json \
-g typescript-fetch \
-o ./sdk