API reference
The CognitiveX HTTP API on api.cognitivx.io — base URL, auth, conventions, errors, and the per-surface reference pages.
The CognitiveX (iCog) API is a JSON-over-HTTP interface to your memory, chat,
agents, reflexes, connectors, and billing. Every product endpoint lives under
the unversioned /api prefix. There is no path versioning and no
Accept-Version header: the contract evolves additively.
Base URL
https://api.cognitivx.ioAll product routes are mounted under /api (for example POST /api/recall).
The machine-readable spec reports iCog API version 1.0.0; that is the
document version, not a URL path segment.
Authentication
Every product endpoint requires authentication. You authenticate with an
icog_-prefixed API key, created at
developers.cognitivx.io/keys, or with a
short-lived JWT access token. There are two accepted headers:
| Header | Value |
|---|---|
Authorization | Bearer <key-or-jwt> |
X-API-Key | <key> |
An icog_ key value is accepted in the Authorization: Bearer header too, so a
single header works for both keys and tokens. Missing or invalid credentials
return 401 with a WWW-Authenticate: Bearer header.
curl https://api.cognitivx.io/api/recall \
-H 'X-API-Key: icog_...' \
-H 'Content-Type: application/json' \
-d '{"query":"what did we decide about billing","limit":5}'The full key is shown exactly once, at creation. Store it then; the API only
ever returns the key_prefix (the first eight characters) afterward. See
Authentication for key lifecycle, org context
(X-Org-ID), and SSE streaming auth.
Reference pages
Each surface has a hand-written contract page with request and response shapes, parameter tables, copy-pasteable examples, and the meaningful failure modes.
Memory
remember, recall, update, forget, and the /api/memories management routes.
Chat
Conversational endpoints and session management, including SSE streaming.
Agents
Register, inspect, message, and retire custom agents.
Reflexes
Situation-triggered reflexes: create, fire, confirm, and cost-account.
Billing
Subscriptions, pay-as-you-go credits, spend caps, and usage.
Authentication
Bearer keys, X-API-Key, JWT tokens, org context, and key management.
Connectors
Attach external MCP servers and read the public provider catalog.
Conventions
- JSON everywhere. Request and response bodies are JSON unless a route is explicitly documented otherwise (for example SSE streams and redirects).
- Timestamps are ISO 8601 strings in UTC (
created_at,occurred_at,last_used_at). - IDs are UUID strings (users, sessions, messages, orgs, memories). There
are no typed ID prefixes. The only prefix convention is
icog_on API keys. - Money. Credits are the user-facing unit and are returned as integers
(
balance_credits). USD floats (*_usd,cost_usd) are the internal billing detail. There is noamount_centsorcurrencyfield. See Billing. - Pagination. The dominant convention is
limit/offsetquery params (offsetis zero-based; each route capslimit). A few admin and audit lists usepage/page_sizeinstead. List search usesq. List responses are typically{ "items": [...], "count": N }or{ "<plural>": [...], "count": N }(for example recall returns{ "memories": [...], "count": N }). - Request IDs. Every response carries an
X-Request-IDheader (a uuid4 hex string). Quote it when reporting an issue.
There is no HTTP Idempotency-Key support and no X-RateLimit-* headers.
The only Retry-After header in the API is on the per-user limiter for
/api/url. Do not build clients that depend on Stripe-style idempotency keys
or rate-limit headers.
Errors
Errors use the standard FastAPI shape: a JSON body with a detail field and a
4xx or 5xx status. detail is usually a string, but several gated and quota
errors return a structured object (for example { "error": "tier_insufficient", "current_tier": ..., "required_tier": ..., "upgrade_url": ... }).
Validation errors (422) use the array form:
{
"detail": [
{ "loc": ["body", "query"], "msg": "field required", "type": "missing" }
]
}Uncaught server errors return { "detail": "Internal server error", "path": "<request path>" }.
| Status | When |
|---|---|
200 / 201 / 204 | Success (with body / created / no body). |
400 | Malformed or rejected input (for example an un-anchored foundational memory). |
401 | Missing or invalid credentials, or an expired token. |
402 | Org seat / billing gate (org routes only). |
403 | Authenticated but not allowed: unverified email, insufficient tier, feature gate, non-member, or non-admin. |
404 | Resource does not exist or is not owned by the caller (also unknown routes). |
409 | Uniqueness or state conflict (for example duplicate signup). |
410 | One-time link or vault entry already consumed. |
413 | Upload exceeds the size cap (for example audio over 25 MB on /api/transcribe). |
422 | Request body or params failed validation. |
429 | Auth rate limit (5/min/IP on auth routes), tier quota, or credit depletion. The three cases return distinct bodies. |
500 | Uncaught server error. |
502 | Upstream extraction failure (for example /api/url). |
503 | A dependency is not ready (database, LLM router, or cold-start bootstrap). |
The 429 status is overloaded. It covers the narrow 5/min per-IP limiter on
auth endpoints (/api/auth/signup, /signin, /forgot-password,
/reset-password, /resend-verification), tier usage quotas, and credit
depletion. There is no standing per-key request-rate throttle. The auth
limiter does not emit Retry-After or X-RateLimit-* headers. See
Rate limits.
OpenAPI
The full machine-readable spec is published at:
- api.cognitivx.io/openapi.json — OpenAPI 3.1.0 document.
- api.cognitivx.io/docs — interactive Swagger UI.
A per-endpoint reference, auto-generated from this spec on every deploy, lives under Generated endpoints in the sidebar.
The OpenAPI document declares a single OAuth2PasswordBearer security scheme
and no top-level security requirement, so it does not advertise the
X-API-Key mechanism even though the API fully supports it. A code generator
reading only the spec will see Bearer auth; add X-API-Key by hand if your
generated client needs it.