API reference

September 4, 2026 · View on GitHub

Versioned REST routes live under /api/v1/; MCP is mounted separately at /mcp. A running deployment serves its authoritative OpenAPI schema at /api/openapi.json and interactive Swagger docs at /api/docs. The tables below are a curated map; use the schema for exact request and response shapes.

See also the public API stability contract and the API surface ownership charter.

Memory endpoints
EndpointMethodDescription
/memoriesPOSTWrite a memory. LLM enrichment + embedding + entity extraction + contradiction detection. "persist": false for extract-only preview
/memories/bulkPOSTWrite up to 100 memories. Batches embeddings, parallelizes enrichment, single transaction. Requires X-Bulk-Attempt-Id header (per-attempt idempotency); a retry with the same id resolves committed rows as duplicate_attempt instead of duplicating. Returns 200 (clean / all-error) or 207 Multi-Status (mixed) — read per-item status
/memoriesGETList memories (filter by type, status, agent; paginate)
/memories/{id}GETFull memory detail (embedding stats, entity links, RDF triple, temporal bounds)
/memories/{id}PATCHUpdate content or metadata. Re-embeds if content changes
/memories/{id}DELETESoft delete (sets status to deleted)
/memories/{id}/statusPATCHUpdate lifecycle status
/memories/{id}/contradictionsGETView contradiction chain
/memoriesDELETEBulk soft-delete
/memories/statsGETCounts by type, agent, and status
/searchPOSTHybrid semantic + keyword search with graph-enhanced retrieval
/recallPOSTSearch + LLM synthesis — summary is the answer to the query (the model reasons step by step internally; only its final answer is surfaced), alongside the source memories under both memories and items
/ingest/previewPOSTExtract 5-20 atomic facts from a URL or text (no writes)
/ingest/commitPOSTWrite previewed facts as memories
Knowledge graph endpoints
EndpointMethodDescription
/entitiesGETList entities (filter by type, search)
/entities/upsertPOSTCreate or update entity
/entities/{id}GETEntity detail with relations and linked memories
/relations/upsertPOSTCreate or update relation
/graphGETFull knowledge graph (entities + relations)
Evolve, Insights, Agents, Crystallizer, Documents, Fleet, Admin

Karpathy Loop / Evolve

EndpointMethodDescription
/evolve/reportPOSTReport an outcome (success/failure/partial) against recalled memories

Insights

EndpointMethodDescription
/insights/generatePOSTLLM-powered analysis. Focus: contradictions, failures, stale, divergence, patterns, discover

Agents

EndpointMethodDescription
/agentsGETList registered agents with trust levels
/agents/{id}GETSingle agent detail
/agents/{id}/trustPATCHSet trust level (0-3)

Memory Crystallizer

EndpointMethodDescription
/crystallizePOSTTrigger crystallization for a tenant
/crystallize/allPOSTTrigger for all tenants (admin key, nightly)
/crystallize/reportsGETList crystallization reports
/crystallize/latestGETMost recent completed report

Documents

EndpointMethodDescription
/documentsPOSTStore or update a structured JSON document
/documents/{id}GETRetrieve document by ID
/documents/queryPOSTQuery by field equality filters
/documents/{id}DELETEDelete a document

Fleet

EndpointMethodDescription
/fleet/heartbeatPOSTPlugin heartbeat — upserts node status, returns pending commands
/fleet/nodesGETList fleet nodes with status (online/stale/offline)
/fleet/commandsPOSTQueue a command for a node
/fleet/commandsGETList command history

Admin + System

EndpointMethodDescription
/healthGETLiveness check
/versionGETCurrent version
/tool-descriptionsGETCanonical MCP tool descriptions
/admin/tenantsGETList all tenants (admin key)
/admin/fleetsGETList fleets across all tenants (admin key)
/admin/memoriesGETList memories across all tenants with filters (admin key)
/admin/memories/statsGETMemory counts by tenant/type/status (admin key)
/settingsGET / PUTPer-tenant configuration
/audit-logGETAudit log entries
/mcpPOSTMCP Streamable HTTP endpoint (mounted at app root, NOT under /api/v1)

Auth: Most data endpoints require an X-API-Key; admin endpoints require the admin key. Intentional public exceptions include the health/version/tool description probes, /api/v1/whoami, and the plugin/skill bootstrap routes (/api/v1/plugin-*, /api/v1/install-*, and /api/v1/skill/*). These public routes expose generic software or identity-probe data, not tenant data.

Gateway-injected headers (trusted only behind the enterprise gateway):

HeaderEffect
X-Agent-IDScopes the request to this agent
X-Org-Read-Only: trueRead-only mode — creates/updates return 403
X-Tenant-IDTenant identity when using the shared CAURA_API_KEY gate

The identity headers are trusted on the gateway-header auth path. Set GATEWAY_SHARED_SECRET so that path also requires a matching X-Gateway-Secret. A network-exposed OSS deployment without a gateway should set CAURA_API_KEY; that shared-key path authenticates first and prevents the header-trust path from being reached.

This holds on both surfaces. /mcp is a separate ASGI mount with its own auth middleware rather than a route behind get_auth_context, so "authenticates first" is a property each surface has to implement for itself. When the key is set, send it as X-API-Key (or a Bearer token) on MCP calls too; without it the request is refused 401 before any identity header is consulted.

Rate limiting (managed platform)

These limits apply to the managed platform at caura.ai. A self-hosted deployment enforces its own, looser per-route limits out of the box — see the self-hosted rate limiting section.

ScopeLimit
Memory writes60 req/min per API key
Memory searches120 req/min per API key
General reads300 req/min per API key
Auth endpoints10 req/min per IP
Global DDoS floor1000 req/min per IP

Exceeded limits return HTTP 429 with a Retry-After header. Rate-limited routes also carry X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset on successful responses, so a client can back off before it is throttled rather than after.

Configuration

Configuration is supplied through environment variables or .env. See .env.example for the common OSS settings; the table below also includes production-only safety controls.

The stock Compose file sets the storage service's DATABASE_URL to its bundled PostgreSQL service. A custom storage deployment should set DATABASE_URL directly. A complete ALLOYDB_HOST, ALLOYDB_USER, ALLOYDB_PASSWORD, and ALLOYDB_DATABASE set (plus optional ALLOYDB_PORT) is also supported when DATABASE_URL is absent; these are storage-service inputs, not aliases for the POSTGRES_* fields.

VariableDefaultDescription
POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DBlocal PostgreSQL defaultsInputs used by migration/dev helpers; the stock Compose file hardcodes its container connection values
DATABASE_URLlocal PostgreSQL URLStorage-service primary connection URL; set directly outside the stock Compose deployment
READ_DATABASE_URL(empty)Optional storage-service read-replica URL
ADMIN_API_KEY(empty)Admin API key — bypasses tenant enforcement
CAURA_API_KEY(empty)Shared perimeter key for a network-exposed OSS deployment
GATEWAY_SHARED_SECRET(empty)Secret required in X-Gateway-Secret before gateway identity headers are trusted
JWT_SECRETchange-me-in-productionJWT signing secret; must be changed in production
EMBEDDING_PROVIDERopenaiopenai, local, or fake
ENTITY_EXTRACTION_PROVIDERopenaiopenai, gemini, anthropic, openrouter, fake, or none
ENTITY_EXTRACTION_MODELgpt-5.4-nanoLLM model for enrichment and entity extraction
OPENAI_API_KEYRequired for OpenAI embeddings and enrichment
USE_LLM_FOR_MEMORY_CREATIONtrueLLM auto-classifies type, weight, title, summary on write
ANTHROPIC_API_KEYRequired for Anthropic
OPENROUTER_API_KEYRequired for OpenRouter
GEMINI_API_KEYRequired for Gemini (Developer API, from AI Studio)
CORS_ORIGINShttp://localhost:3000Comma-separated allowed CORS origins
ENVIRONMENTdevelopmentdevelopment or production
SETTINGS_ENCRYPTION_KEYFernet key for encrypting tenant settings. Required in production
PLATFORM_LLM_PROVIDER(empty)Platform-default LLM: openai, vertex, or empty to disable
PLATFORM_LLM_MODEL(empty)Model override (e.g. gpt-5.4-nano, gemini-3.1-flash-lite-preview)
PLATFORM_LLM_API_KEYOpenAI API key for the platform LLM singleton
PLATFORM_LLM_GCP_PROJECT_IDGCP project for platform Vertex LLM
PLATFORM_LLM_GCP_LOCATIONus-central1GCP region for platform Vertex LLM
PLATFORM_EMBEDDING_PROVIDER(empty)Platform-default embeddings: openai or empty to disable
PLATFORM_EMBEDDING_MODEL(empty)Embedding model override (e.g. text-embedding-3-small)
PLATFORM_EMBEDDING_API_KEYOpenAI API key for platform embeddings

With ENVIRONMENT=production, startup additionally requires ADMIN_API_KEY, a non-default JWT_SECRET, SETTINGS_ENCRYPTION_KEY, and either GATEWAY_SHARED_SECRET or CAURA_API_KEY. Standalone mode is rejected in production.

Project structure

caura/
├── core-api/                      # Main FastAPI service
│   └── src/core_api/
│       ├── app.py                 # FastAPI app, lifespan, middleware
│       ├── mcp_server.py          # MCP server (Streamable HTTP, 12 tools)
│       ├── constants.py           # Limits and ranking parameters
│       ├── config.py              # Settings (env vars)
│       ├── auth.py                # API key + JWT auth, tenant enforcement
│       ├── routes/                # Route handlers
│       ├── services/              # Business logic
│       ├── providers/             # LLM/embedding abstraction + fallback
│       ├── pipeline/              # Composable write/search pipelines
│       └── tools/                 # MCP tool implementations

├── core-storage-api/              # PostgreSQL CRUD microservice
│   └── src/core_storage_api/
│       ├── routers/               # Memory, entity, document, fleet CRUD
│       ├── services/              # ORM operations
│       └── database/              # Engine initialization and Alembic migrations

├── plugin/                        # OpenClaw plugin (TypeScript)
│   └── src/
│       ├── tools.ts               # Tool implementations
│       ├── agent-auth.ts          # Per-agent credentials (agent-scoped mc_ keys)
│       ├── context-engine.ts      # Auto-read/write lifecycle
│       ├── heartbeat.ts           # 60s heartbeat → Caura API
│       └── educate.ts             # Agent education delivery

├── common/                        # Shared SQLAlchemy ORM models and constants
├── tests/                         # Test suite
├── scripts/                       # Smoke tests, benchmarks, export tools
├── docker-compose.yml             # Production-like stack
├── docker-compose.dev.yml         # Dev stack
└── .env.example                   # Common OSS configuration template

Latency benchmarks

Typical results on a single-instance deployment (OpenAI embeddings + GPT-5.4 Nano):

OperationMeanP50P95
caura_write~2000ms~2000ms~2300ms
caura_recall~650ms~640ms~670ms
caura_recall (with include_brief=true)~1300ms~1200ms~2100ms

Write latency is dominated by LLM enrichment. Recall latency by the embedding API call.

See BENCHMARKS.md and the performance guide for current methodology and reproducible benchmarks.