CortexDB Docs
Docs for CortexDB 0.12.8, the version running on CortexDB Cloud (api.cortexdb.ai).
API Reference

/v1/auth

Identity and tokens — anonymous signup, service-account minting, whoami, and revoke.

POST
/v1/auth/signup

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/auth/signup" \  -H "Content-Type: application/json" \  -d '{}'
{  "token": "string",  "jti": "string",  "expires_at": "2019-08-24T14:15:22Z",  "user_id": "string",  "scope": "string",  "tier": "string"}
POST
/v1/auth/tokens
AuthorizationBearer <token>

PASETO v4 public token (or deployment gate key). Auth-disabled dev instances accept any caller. On a cluster data node a PASETO/JWT bearer (not the static key) gets 503 REVOCATION_UNAVAILABLE (retriable) on any route while the node's revocation lease has expired: the metadata group has not confirmed its revocation set for 10 s, or the node has just started. A single-node server never returns it.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/auth/tokens" \  -H "Content-Type: application/json" \  -d '{    "subject": "string"  }'
{  "token": "string",  "jti": "string",  "expires_at": "2019-08-24T14:15:22Z"}
GET
/v1/auth/whoami
AuthorizationBearer <token>

PASETO v4 public token (or deployment gate key). Auth-disabled dev instances accept any caller. On a cluster data node a PASETO/JWT bearer (not the static key) gets 503 REVOCATION_UNAVAILABLE (retriable) on any route while the node's revocation lease has expired: the metadata group has not confirmed its revocation set for 10 s, or the node has just started. A single-node server never returns it.

In: header

Response Body

application/json

application/json

curl -X GET "https://example.com/v1/auth/whoami"
{  "caller": "string",  "tenant_id": "string",  "deployment_preset": "string",  "token": {    "jti": "string",    "iss": "string",    "exp": 0  },  "effective_capabilities": [    "string"  ]}
POST
/v1/auth/revoke
AuthorizationBearer <token>

PASETO v4 public token (or deployment gate key). Auth-disabled dev instances accept any caller. On a cluster data node a PASETO/JWT bearer (not the static key) gets 503 REVOCATION_UNAVAILABLE (retriable) on any route while the node's revocation lease has expired: the metadata group has not confirmed its revocation set for 10 s, or the node has just started. A single-node server never returns it.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/auth/revoke" \  -H "Content-Type: application/json" \  -d '{    "jti": "string"  }'
Empty

CortexDB uses PASETO v4 public tokens. Every authenticated request carries Authorization: Bearer <token> and X-Cortex-Actor (which must match the token's sub).

Endpoints

  • POST /v1/auth/signup {} — anonymous free-tier token (7-day TTL). Returns { token, jti, user_id, scope, tier, expires_at } (jti is what /v1/auth/revoke takes). A server with CORTEX_DISABLE_ANON_SIGNUP=1 answers 404 (v0.12.6+); CortexDB Cloud does, since its accounts sign up at cortexdb.ai and create tokens on the dashboard.
  • POST /v1/auth/tokens — mint a service-account token (requires the auth.mint capability; ttl_seconds is clamped to a 60 s minimum; a 7-day TTL is honoured). Body: { subject, scope?, ttl_seconds?, caps?, scopes? }.
    • scope only says where your auth.mint is checked (omit it for a deployment-wide check). It does not confine the minted token.
    • caps narrows the token's capabilities; capabilities is still accepted as an alias.
    • scopes confines capabilities to subtrees, each entry <capability>:<scope-path>[/*], for example scope.read:org:acme/team:b/*. Entries are validated at mint: a bare path is 422 INVALID_BODY.
    • The CLI sends scopes with cortexdb auth tokens --confine CAP:PREFIX; its --scope is the check location.
    • tenant (v0.12.6+, hosted with CORTEX_V1_TENANT_AUDIENCES=1 only) names the billing tenant the token belongs to, for example acct_45: its audience becomes cortexdb:tenant:acct_45, so it reaches org:acct_45/... and never another tenant's records. It needs a deployment-wide mint (no scope) by a credential of the deployment's own audience, and every scopes entry (at least one) must lie in org:<tenant>; otherwise 422 INVALID_BODY. A tenant's own token never mints. This is how CortexDB Cloud issues each account's tokens; on a self-hosted server leave it out.
  • GET /v1/auth/whoami → { caller, tenant_id, deployment_preset, token: { jti, iss, exp }, effective_capabilities }.
  • POST /v1/auth/revoke { jti, reason } → 204.

Signup/tokens return 503 on a keyed server unless the minter is enabled

On a server with a key configured (or an auto-generated one) and the v1 minter disabled, POST /v1/auth/signup and POST /v1/auth/tokens return 503 NOT_CONFIGURED ("self-serve signup requires the v1 minter"). Enable minting with CORTEX_V1_MINTER_ENABLE=1, or have your IdP mint PASETO tokens that CortexDB verifies. Under CORTEX_INSECURE_NO_AUTH=1 signup is served without the minter flag. deployment_preset is dev_local on a keyed self-host, auth_disabled under CORTEX_INSECURE_NO_AUTH=1 (vs cloud_shared_saas on the cloud).

Token enforcement

A self-hosted server started with no CORTEX_API_KEY on a network bind generates a key and enforces it: a request with only X-Cortex-Actor and no Authorization gets 401 MISSING_TOKEN, and a minted token sent with a different actor gets 401 ACTOR_MISMATCH. Only CORTEX_INSECURE_NO_AUTH=1 serves requests without a token. Error codes follow the server's uppercase convention (MISSING_TOKEN, TOKEN_EXPIRED, ACTOR_MISMATCH, POLICY_DENIED). See Authorization.

On this page