API Reference
Complete REST API documentation for Hippocortex. All endpoints require authentication and return JSON responses.
Base URL
https://api.hippocortex.dev/v1Authentication
All API requests require a Bearer token in the Authorization header. Use your API key directly as the Bearer token.
Authorization: Bearer hx_live_abc123...API Key Formats
hx_live_*Production keys. Use for live applications. Events are persisted and processed.hx_test_*Test keys. Use for development and testing. Events are processed but may have separate quotas.API keys support scoped permissions (read, write, admin) configured at creation time. Keys are hashed server-side and cannot be retrieved after initial generation. Rotation is supported without downtime by creating a new key before revoking the old one.
Response Format
All responses follow a consistent envelope format. Successful responses have ok: true with data in the data field. Error responses have ok: false with error details. Every response includes a meta object with request tracking information.
{
"ok": true,
"data": { ... },
"meta": {
"requestId": "req_abc123",
"tenantId": "ten_xyz789",
"durationMs": 42
}
}{
"ok": false,
"error": {
"code": "validation_error",
"message": "type is required and must be a string",
"details": [
{ "field": "type" }
]
},
"meta": {
"requestId": "req_abc123",
"tenantId": "ten_xyz789",
"durationMs": 5
}
}Rate Limiting
API requests are rate-limited per API key and per tenant. When you exceed the rate limit, the API responds with HTTP 429 and a Retry-After header indicating how many seconds to wait before retrying.
Idempotency
The POST /v1/capture and POST /v1/capture/batch endpoints support idempotency keys. Include an idempotencyKey field in your event payload to prevent duplicate processing. If a request with the same idempotency key has already been processed, the API returns the original result without re-processing.
Endpoints
/v1/captureCapture a single agent event. The event is validated and queued for asynchronous processing via Redis/BullMQ workers. Returns immediately with a 202 status and a job reference.
Request Headers
Authorization: Bearer hx_live_...
Content-Type: application/jsonRequest Body
{
"type": "message",
"sessionId": "sess-001",
"payload": {
"role": "user",
"content": "Deploy the payment service"
},
"metadata": {
"agentId": "deploy-bot",
"source": "api"
},
"idempotencyKey": "idem-abc123"
}Response
{
"ok": true,
"data": {
"jobId": "job_abc123",
"status": "queued",
"idempotencyKey": "idem-abc123"
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 12
}
}Status Codes
202Event accepted and queued for processing.401Invalid or missing API key.422Invalid request body or missing required fields.429Rate limit exceeded.curl Example
curl -X POST https://api.hippocortex.dev/v1/capture \
-H "Authorization: Bearer hx_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"type": "message",
"sessionId": "sess-001",
"payload": {"role": "user", "content": "Deploy to staging"}
}'/v1/capture/batchCapture multiple events in a single request. Maximum batch size is 1,000 events. Events are validated individually. Valid events are queued even if some fail validation. Returns a 202 with a batch summary.
Request Body
{
"events": [
{
"type": "message",
"sessionId": "sess-001",
"payload": {"role": "user", "content": "Hello"}
},
{
"type": "tool_call",
"sessionId": "sess-001",
"payload": {"tool_name": "search", "input": "query string"}
}
]
}Response
{
"ok": true,
"data": {
"batchId": "batch_xyz",
"queued": 2,
"errors": 0,
"total": 2
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 28
}
}Status Codes
202Batch accepted. Check response for per-event errors.401Invalid or missing API key.422events field missing or not an array, or batch exceeds 1,000 events.429Rate limit exceeded.curl Example
curl -X POST https://api.hippocortex.dev/v1/capture/batch \
-H "Authorization: Bearer hx_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"events": [
{"type": "message", "sessionId": "s1", "payload": {"role": "user", "content": "Hi"}},
{"type": "message", "sessionId": "s1", "payload": {"role": "assistant", "content": "Hello!"}}
]
}'/v1/synthesizeSynthesize compressed context from semantic memories and compiled artifacts. This is a synchronous endpoint that returns results immediately. The response contains context entries packed within the specified token budget, prioritized by relevance to the query.
Request Body
{
"query": "deploy payment service",
"agentId": "ops-agent",
"maxTokens": 4000,
"includeArtifacts": true,
"includeMemories": true,
"tags": ["deployment", "payments"]
}Response
{
"ok": true,
"data": {
"sections": [
{
"type": "memory",
"content": "Payment service deployment requires staging validation...",
"source": "mem_abc123",
"confidence": 0.87
},
{
"type": "artifact",
"content": "Task schema: deploy-payment-service...",
"source": "art_xyz789"
}
],
"totalTokens": 1842,
"query": "deploy payment service",
"contextPack": {
"entries": 5,
"estimatedTokens": 1842,
"maxTokens": 4000
}
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 156
}
}Status Codes
200Context synthesized successfully.401Invalid or missing API key.429Rate limit exceeded.curl Example
curl -X POST https://api.hippocortex.dev/v1/synthesize \
-H "Authorization: Bearer hx_live_abc123" \
-H "Content-Type: application/json" \
-d '{"query": "deploy payment service", "maxTokens": 4000}'/v1/learnTrigger an asynchronous compilation job that processes captured events into semantic memories and compiled knowledge artifacts. The job runs in the background via BullMQ workers. Returns immediately with a 202 and a job reference.
Request Body
{
"agentId": "ops-agent",
"sessionId": "sess-001",
"eventIds": ["evt_1", "evt_2"],
"options": {
"maxEvents": 500,
"artifactType": "task_schema"
}
}All fields are optional. An empty request body processes all unprocessed events for the tenant.
Response
{
"ok": true,
"data": {
"jobId": "job_learn_abc123",
"status": "queued"
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 8
}
}Status Codes
202Compilation job queued successfully.401Invalid or missing API key.429Rate limit exceeded.curl Example
curl -X POST https://api.hippocortex.dev/v1/learn \
-H "Authorization: Bearer hx_live_abc123" \
-H "Content-Type: application/json" \
-d '{}'/v1/artifactsList compiled knowledge artifacts for the authenticated tenant. Supports filtering by type, offset-based pagination, and a configurable page size (max 100).
Query Parameters
Response
{
"ok": true,
"data": {
"items": [
{
"id": "art_abc123",
"type": "task_schema",
"title": "Payment Service Deployment",
"version": 3,
"tokenCount": 450,
"isActive": true,
"compiledAt": "2026-03-14T10:30:00Z",
"createdAt": "2026-03-10T08:00:00Z"
}
],
"total": 42,
"limit": 50,
"offset": 0,
"hasMore": false
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 35
}
}Status Codes
200Artifacts listed successfully.401Invalid or missing API key.curl Example
curl https://api.hippocortex.dev/v1/artifacts?type=task_schema&limit=10 \
-H "Authorization: Bearer hx_live_abc123"/v1/artifacts/:idRetrieve a single compiled artifact by its ID. Returns the full artifact including content, source references, and metadata.
Path Parameters
Response
{
"ok": true,
"data": {
"id": "art_abc123",
"type": "task_schema",
"title": "Payment Service Deployment",
"content": { "steps": [...], "preconditions": [...] },
"version": 3,
"tokenCount": 450,
"sourceEvents": ["evt_1", "evt_2", "evt_3"],
"sourceMemories": ["mem_1", "mem_2"],
"metadata": { "compiledBy": "compiler-v2" },
"isActive": true,
"compiledAt": "2026-03-14T10:30:00Z",
"createdAt": "2026-03-10T08:00:00Z",
"updatedAt": "2026-03-14T10:30:00Z"
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 18
}
}Status Codes
200Artifact retrieved successfully.401Invalid or missing API key.404Artifact not found.curl Example
curl https://api.hippocortex.dev/v1/artifacts/art_abc123 \
-H "Authorization: Bearer hx_live_abc123"/v1/usage-metricsRetrieve usage statistics and quota information for the authenticated tenant. Includes event counts, compilation activity, synthesis usage, and remaining quota.
Response
{
"ok": true,
"data": {
"plan": "developer",
"period": {
"month": "2026-03",
"day": "2026-03-14"
},
"usage": {
"eventsThisMonth": 12450,
"synthesesToday": 84,
"compilationsToday": 3,
"requestsThisMinute": 12
},
"totals": {
"events": 45230,
"memories": 8120,
"artifacts": 156
}
},
"meta": {
"requestId": "req_xyz",
"tenantId": "ten_123",
"durationMs": 45
}
}Status Codes
200Metrics retrieved successfully.401Invalid or missing API key.curl Example
curl https://api.hippocortex.dev/v1/usage-metrics \
-H "Authorization: Bearer hx_live_abc123"/v1/healthSystem health check endpoint. Returns the status of all subsystems including PostgreSQL, Redis, worker queues, and active alerts. Does not require authentication.
Response
{
"ok": true,
"data": {
"status": "healthy",
"version": "1.1.0",
"uptime": 86400,
"timestamp": "2026-03-14T10:00:00Z",
"subsystems": {
"postgres": {
"status": "healthy",
"connections": {
"total": 5,
"idle": 3,
"waiting": 0,
"max": 20,
"utilizationPercent": 25
}
},
"redis": {
"status": "healthy",
"latencyMs": 1,
"persistence": {
"aof_enabled": true,
"rdb_last_save_time": 1710410400
},
"memory": {
"used_memory_mb": 128,
"maxmemory_mb": 512,
"maxmemory_policy": "noeviction"
}
},
"workers": {
"status": "healthy",
"queues": {
"capture": { "waiting": 0, "active": 2, "failed": 0 },
"learn": { "waiting": 0, "active": 0, "failed": 0 }
},
"totalBacklog": 0
}
},
"alerts": {
"firing": 0
}
}
}Status Codes
200All systems healthy.503One or more subsystems are degraded or unhealthy.curl Example
curl https://api.hippocortex.dev/v1/health