Optimal Engine API reference

Base URLhttp://127.0.0.1:4200/api on a self-hosted Engine. /v1/... is an alias of /api/....
On MIOSAhttps://api.miosa.ai/api/v1/engines/<engine id>/engine-api/api/... with an Engine client key; see Optimal Engine on MIOSA
API versionv1
AuthAuthorization: Bearer <key> or X-API-Key: <key>
BodyJSON with Content-Type: application/json
Errors{"error": "<code>"}, sometimes with a detail

The Engine has about 300 routes. This page covers the ones most apps and agents use. The complete list, with the grant each route needs, is generated from the router into docs/reference/api.md, and a test fails whenever the two disagree.

E=http://127.0.0.1:4200
K="Authorization: Bearer $OPTIMAL_ENGINE_API_KEY"

Keys and errors

When OPTIMAL_AUTH_REQUIRED=true, every route needs a key, including /api/health.

StatuserrorWhen
400invalid_json, invalid_parameter, workspace_requiredThe request is malformed, or a key limited to named workspaces did not name one
401missing_api_key, invalid_api_key, api_key_revoked, api_key_expiredThe key is missing or not usable
403workspace_scope_deniedThe key does not cover that workspace
403permission_scope_deniedThe key does not have the scope the route needs
404not found, workspace not foundNo such route, or a workspace of another tenant
413request_too_largeThe body is over 8 MB
426client_incompatibleAn optimal CLI or MCP server of another major version
429rate_limitedOver the key’s rate limit; the body has retry_after_ms
503busyThe store is busy, for example right after boot; retry after Retry-After

Rate limits

Each key has its own budget per minute, set by the size profile: 1,200 requests a minute on the default business profile. Requests without a valid key share their IP address’s budget. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. /api/health, /api/status, and /api/metrics/prometheus are not counted.

Paging

List routes take offset and limit (1 to 200, default 50) and answer with:

"pagination": {"offset": 0, "limit": 50, "total": 132, "has_more": true}

Engine

RouteReturns
GET /api/healthstatus (up, degraded, down), checks, warnings, and the release. ?full=true runs ten store diagnostics for one workspace.
GET /api/statusThe same, plus api_version
GET /api/versionversion, git_sha, build_timestamp, release_channel, api_version, expected_migration, capabilities
GET /api/metricsJSON counters, latencies, and size gauges
GET /api/metrics/prometheusPrometheus text format
GET /api/auth/whoamiThe key’s own scopes and workspaces

Workspaces and nodes

Create a workspace

POST /api/workspaces

curl -s -X POST $E/api/workspaces -H "$K" -H "Content-Type: application/json" 
  -d '{"slug": "sales", "name": "Sales"}'
FieldRequiredMeaning
slugyesLowercase name, unique in the tenant
nameyesDisplay name
descriptionno
external_idnoYour own id for this workspace, unique in the tenant

201 returns the workspace: id (default:sales), tenant_id, slug, name, status, created_at. Errors: 400 for a missing or invalid slug or name, 409 slug_taken, 409 external_id_taken.

RouteWhat it does
GET /api/workspacesList workspaces, paged
GET /api/workspaces/:id, PATCH /api/workspaces/:idRead or rename one
POST /api/workspaces/:id/archiveArchive it; its data is kept
GET /api/workspaces/:id/config, PATCH ...Workspace settings

Create a node

POST /api/nodes with {"name", "kind", "slug", "workspace", "description"} answers {"ok": true, "id", "slug", "kind"}. kind is one of the node kinds in Concepts.

Ingest

POST /api/ingest stores text as a source. See Sources and ingestion for the fields, files, chat sessions, Notion, and connectors.

curl -s -X POST $E/api/ingest -H "$K" -H "Content-Type: application/json" 
  -d '{"workspace": "default:sales", "title": "Auth decision", "text": "Decided: refresh-token rotation ships in v2."}'
{"ok": true, "signal_id": "...", "genre": "...", "type": "...", "entities": [], "source_package_id": "..."}

GET /api/search?q=&workspace=&limit=&offset=&mode=&type=&as_of=

curl -s "$E/api/search?q=refresh%20token&workspace=default:sales&limit=5" -H "$K"
{
  "query": "refresh token",
  "results": [
    {
      "id": "...",
      "title": "Auth decision",
      "uri": "optimal://...",
      "content": "Decided: refresh-token rotation ships in v2.",
      "l0_abstract": "...",
      "score": 0.82,
      "workspace_id": "default:sales",
      "inherited": false
    }
  ],
  "pagination": {"offset": 0, "limit": 5, "total": 1, "has_more": false}
}

mode=hybrid answers 503 hybrid_unavailable when no embedding model answers. A bad as_of answers 400.

RouteWhat it does
GET /api/grep?q=Matching chunks, with intent, scale, modality, literal, and path filters
GET /api/read?uri=&tier=One item by its optimal:// URI; tier is l0, l1, or full
GET /api/recall/who, when, where, owns, actionsTargeted recall over people, time, places, ownership, and actions
GET /api/profileA workspace profile: ground truth, recent activity, and top entities
GET /api/graph, /api/graph/hubs, /api/graph/clustersThe knowledge graph

Ask and assemble

POST /api/rag returns context for one question; GET /api/rag/stream streams it as server-sent events. POST /api/assemble returns a tiered context package for an agent. See Memory and retrieval for fields and responses.

curl -s -X POST $E/api/rag -H "$K" -H "Content-Type: application/json" 
  -d '{"query": "What did we decide about auth?", "workspace": "default:sales", "format": "markdown", "bandwidth": "small"}'

curl -N "$E/api/rag/stream?query=auth%20decision&workspace=default:sales" -H "$K"

Memory

RouteWhat it does
POST /api/memoryStore a memory: {"content", "workspace", "is_static", "audience", "citation_uri", "metadata"}. Answers 201 with the memory, its version, and was_existing.
POST /api/memory/rememberStore through the gate; answers {"action", "memory", "pending_claim_id", "gate"}
GET /api/memoryList; q, audience, include_forgotten, paging
GET /api/memory/:idOne memory
GET /api/memory/:id/versions, /relationsIts history and links
POST /api/memory/:id/update, /extend, /deriveA new linked version
POST /api/memory/:id/forgetHide it
DELETE /api/memory/:idDelete it

Claims

RouteScope
GET /api/memory-core/claim-reviewread
GET /api/memory-core/claims, /claims/:idread
POST /api/memory-core/claims/:id/promoteclaims:review
POST /api/memory-core/claims/:id/rejectclaims:review

Chat sessions

RouteWhat it does
POST /api/sessions/commitStore a chat; see Sources and ingestion
GET /api/sessionsCommitted chats, newest first
GET /api/sessions/:idOne chat and the review state of what it learned

Operations

These need an admin key.

RouteWhat it does
POST /api/auth/keys, GET /api/auth/keysMint and list keys
POST /api/auth/keys/:id/revoke, DELETE /api/auth/keys/:idRevoke or delete a key
POST /api/backupTake a backup now
GET /api/backup/offsiteOffsite backups
POST /api/workspaces/:id/bundle, POST /api/bundles/importExport or import a workspace bundle
GET /api/stores, GET /api/storageStores, providers, and usage against the size profile
/api/sync/*Replication; see Operations
Was this page helpful?