Skip to content

API Endpoints

Complete HTTP REST endpoint reference for the Cerememory Protocol.

Base URL

plaintext
http://localhost:8420

All API endpoints are prefixed with /v1/. Health and metrics endpoints are at the root level.

Authentication

When auth.enabled = true, all /v1/* endpoints require a Bearer token in the Authorization header:

plaintext
Authorization: Bearer sk-cerememory-prod-abc123

Health endpoints (/health, /readiness) bypass authentication and rate limiting. The /metrics endpoint is disabled by default and, when enabled, follows the configured auth and rate-limit policy.

Endpoint Reference

Health & Metrics

MethodPathAuthDescription
GET/healthNoLiveness probe -- returns {"status": "ok"}
GET/readinessNoReadiness probe -- verifies the engine can answer an internal stats request
GET/metricsDependsPrometheus metrics (text format). Only present when http.metrics_enabled = true

Encode

MethodPathAuthRequest BodyResponse
POST/v1/encodeYesEncodeStoreRequestEncodeStoreResponse (200)
POST/v1/encode/batchYesEncodeBatchRequestEncodeBatchResponse (200)
PATCH/v1/encode/:record_idYesEncodeUpdateRequest204 No Content
POST/v1/encode/rawYesEncodeStoreRawRequestEncodeStoreRawResponse (200)
POST/v1/encode/raw/batchYesEncodeBatchStoreRawRequestEncodeBatchStoreRawResponse (200)

Recall

MethodPathAuthRequest BodyResponse
POST/v1/recall/queryYesRecallQueryRequestRecallQueryResponse (200)
POST/v1/recall/associate/:record_idYesRecallAssociateRequestRecallAssociateResponse (200)
POST/v1/recall/timelineYesRecallTimelineRequestRecallTimelineResponse (200)
POST/v1/recall/graphYesRecallGraphRequestRecallGraphResponse (200)
POST/v1/recall/rawYesRecallRawQueryRequestRecallRawQueryResponse (200)

Lifecycle

MethodPathAuthRequest BodyResponse
POST/v1/lifecycle/consolidateYesConsolidateRequestConsolidateResponse (200)
POST/v1/lifecycle/decay-tickYesDecayTickRequestDecayTickResponse (200)
POST/v1/lifecycle/dream-tickYesDreamTickRequestDreamTickResponse (200)
PUT/v1/lifecycle/modeYesSetModeRequest204 No Content
DELETE/v1/lifecycle/forgetYesForgetRequest{"records_deleted": N} (200)
POST/v1/lifecycle/exportYesExportRequestExportResponse (200)
POST/v1/lifecycle/importYesImportRequestImportResponse (200)

Introspect

MethodPathAuthRequest BodyResponse
GET/v1/introspect/statsYes--StatsResponse (200)
GET/v1/introspect/record/:record_idYes--MemoryRecord (200)
POST/v1/introspect/decay-forecastYesDecayForecastRequestDecayForecastResponse (200)
GET/v1/introspect/evolutionYes--EvolutionMetrics (200)

Error Responses

All errors return a CMPError JSON envelope:

json
{
  "code": "RECORD_NOT_FOUND",
  "message": "Record not found: 01916e3a-...",
  "details": null,
  "retry_after": null
}

HTTP Status Code Mapping

CMP Error CodeHTTP StatusDescription
RECORD_NOT_FOUND404Record does not exist
STORE_INVALID400Unknown store name
CONTENT_TOO_LARGE413Exceeds modality size limit
VALIDATION_ERROR400Malformed request or invalid values
MODALITY_UNSUPPORTED400Provider does not support this modality
WORKING_MEMORY_FULL503Working memory capacity exceeded
DECAY_ENGINE_BUSY503Decay tick already in progress
CONSOLIDATION_IN_PROGRESS503Consolidation already running
EXPORT_FAILED500Archive export failed
IMPORT_CONFLICT409Import conflict detected
FORGET_UNCONFIRMED400Missing confirm: true
VERSION_MISMATCH400Optimistic concurrency conflict
UNAUTHORIZED401Missing or invalid API key
RATE_LIMITED429Rate limit exceeded (includes Retry-After header)
INTERNAL_ERROR500Unexpected server error

Rate Limiting

API endpoints are rate-limited using a token bucket algorithm. When the limit is exceeded, the server returns:

  • HTTP status 429 Too Many Requests
  • Retry-After header with the number of seconds to wait
  • CMPError body with code: "RATE_LIMITED" and retry_after field

Default limits: 100 requests/second with a burst of 50.

Request Size Limits

HTTP API routes under /v1/* are capped at 64 MB request bodies (large enough for archive imports). This is separate from modality-level limits enforced by the engine itself.

CORS

CORS is configured via http.cors_origins.

  • When the list is empty, Cerememory emits no CORS headers
  • When origins are specified, only those origins receive CORS headers
  • Use an explicit "*" entry only if you intentionally want browser-wide access

Request Tracing

Every request receives an X-Request-Id header (UUID). This ID is propagated through all logging and can be used to correlate requests with server-side logs.

Next Steps

CLI Reference

Complete CLI command reference

CMP Protocol

Protocol specification details