GET /v1/facts
Query the Facts layer — typed subject/predicate/object triples with bi-temporal validity.
Authorization
bearer Authorization: Bearer . Four credentials authenticate: (1) the operator key, the static CORTEX_API_KEY: the trusted operator, acting as the principal X-Cortex-Actor names (default user:local), in billing tenant default; (2) a PASETO v4 public token this server's minter signed (POST /v1/auth/tokens, POST /v1/auth/signup, the mint_offline tool), of audience CORTEX_V1_AUDIENCE or, with CORTEX_V1_TENANT_AUDIENCES=1, a billing tenant's own cortexdb:tenant:; (3) since 0.14.0 (principal_chain_v1), a JWT (RS256 or ES256) or PASETO v4 public token of an issuers-file entry (CORTEX_AUTH_ISSUERS_FILE; [auth] issuers_file on a cluster data node), whose subject, audience and token id (:) the entry maps; (4) a commitment transport token, on /v1/memory/commitments/* only. HS256, none and every symmetric JWT algorithm are refused. With auth disabled (no operator key: CORTEX_API_KEY unset on a loopback bind, or CORTEX_INSECURE_NO_AUTH) no token is verified and every request is served as the trusted operator, as the X-Cortex-Actor it names or user:local. On the operator key, with auth disabled and in the unsigned development mode, an X-Cortex-Actor that is not a principal id is 400 INVALID_HEADER, details {part: header, field: X-Cortex-Actor, reason: the parse error} (since 0.14.0; before, 401 INVALID_BODY). X-Cortex-Actor must equal the token's sub; a token of an issuers-file entry in prefix, hash or directory mode and a call of /mcp may leave it out (when present it must match). Any other token sent without it is verified first: a bearer of no known token form (a mistyped operator key) is 401 MISSING_TOKEN, any other bad token gets its own refusal, as with the header, and only a token that verifies answers 401 ACTOR_MISMATCH, the header is required. Every authenticated response carries X-Cortex-Token-Expires-In and X-Cortex-Token-Expires-At (and a Warning header within 72 h of expiry); every error of the auth layer carries X-Cortex-Request-ID.
Authentication refusals, the same on every authenticated route, none retriable unless marked. A token that carries none of the principal-chain claims and was not signed by an issuers-file entry gets each code with no details, as in 0.13.x; an entry's token, and a token that carries a chain claim other than minter, gets details.issuer (the entry's id, minter, commitment or unknown) and the details named here. 401 MISSING_TOKEN: no Authorization: Bearer header, or a bearer that is neither the operator key nor a PASETO v4 public or JWT token (a wrong operator key), with or without X-Cortex-Actor. 401 INVALID_TOKEN: a PASETO token no registered key verifies, a token signed by a key other than the issuer its iss names included. 401 INVALID_TOKEN_SIGNATURE: a bad signature, an iss no issuer is registered under, a JWT algorithm other than RS256 or ES256, a malformed token, or, on a token without chain claims, an iat ahead of the clock; for an issuers-file entry's token details.reason issuer_disabled, token_type, critical_header, algorithm, kid_revoked or unknown_kid (none for a bad signature). 401 EXPIRED_TOKEN. 401 REVOKED_TOKEN: the token's id is revoked (an entry's token goes by :). 401 WRONG_TENANT: an aud the token's issuer may not name, or one that names no tenant. 401 INVALID_TOKEN_CLAIM (since 0.14.0), details.claim and details.reason: a principal-chain claim malformed (malformed, not_an_agent, same_as_sub, not_a_service, person_with_agent, run_start_without_run, after_iat, run_too_old, out_of_range; unknown_critical_claim, with details.critical); an issuers-file entry's token without exp, iat or jti (missing), with iat or nbf ahead of the clock (ahead), or living longer than the entry's max_lifetime_s (claim exp, lifetime_over_maximum, details.lifetime_s, details.ceiling_s); a token this server's minter signed whose exp - iat is above the ceiling for its subject as this server runs it (CORTEX_MINT_MAX_LIFETIME_PERSON, _AGENT and _SERVICE since 0.14.1; by default 7,776,000 s for a user:, 604,800 s for an agent:, 2,592,000 s for a service: or system:) (claim exp, lifetime_over_ceiling, details.issuer minter, details.lifetime_s, details.ceiling_s; checked before the revocation, and counted instead while CORTEX_MINT_LIFETIME_ENFORCE=off); and, whatever issuer signed it, a token whose act names an AI employee of its tenant, the self of an employee record that is not delegable (claim act, act_not_delegable). 401 CLAIM_NOT_PERMITTED (since 0.14.0), details.claim: a chain claim the token's issuer is not bound to assert (an issuers-file entry's [issuer.claims]; minter from any issuer but this server's minter; the minter's own chain claims without the chain assertion), or an issuers-file entry's scopes entry outside its token's tenant root org: (claim scopes, details.entry). 401 SUBJECT_UNMAPPED (since 0.14.0), details.reason: an issuers-file entry's subject mapping produced no principal (missing, not_a_principal, kind, service, foreign_namespace, personal_data_in_id, malformed, too_long, not_in_directory, directory_not_here); and, on every route whatever issuer signed the credential, a principal whose entry in its tenant's directory (org:) is deactivated (deactivated; never the trusted operator). 410 TENANT_DELETED (since 0.14.0): the credential's tenant root, org:, is being deleted or was (POST /v1/erasures/tenant); never the trusted operator. 503 REVOCATION_UNAVAILABLE (retriable): the revocation list cannot answer, so every token is refused as an outage, never 401 REVOKED_TOKEN, and the list still fails closed: on a cluster data node 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), and on a single node once the list's journal failed (a refused write latches the list). 503 ISSUER_KEYS_UNAVAILABLE (retriable): an issuers-file entry's JWKS cannot be fetched and no pinned or cached key verifies the token; Retry-After is the whole seconds until the key cache's next fetch (its backoff, 3 s doubling to 60 s; 3 s before the first fetch), at least 1, also in details.retry_after_seconds. 503 WAL_UNAVAILABLE (retriable): the directory did not read, so a directory-mode subject's principal, or a principal's deactivation, is unknown.
Authorization refusals any route gives where it checks a capability or a roster, none retriable. 403 POLICY_DENIED, details.capability and details.denied_by_tier (deployment, tenant, actor or scope): the deployment's or the tenant's policy denies the capability, the token's caps leave it out, a scopes entry names it but not at this scope, or the scope's roster does not admit the caller. Since 0.14.0 a token that carries scopes holds only the capabilities an entry names (: its subtree, ! that one scope, :* every scope and the checks made without one); any other is refused with details.link confinement, and counted instead while CORTEX_TOKEN_CONFINEMENT_ENFORCE=off. An agent chain token (one that carries act or run, or app or client resolving to agent) is confined so whatever the switch, and without scopes holds no capability. A tenant-audience token's :* entry at a scope outside its own org: root is details.link tenant. A token another principal minted (minter a principal other than its sub) also needs that minter to hold the capability under the deployment's and the tenant's policy and the role on the scope's roster: details.link minter, denied_by_tier scope, counted instead while CORTEX_MINTER_LINK_ENFORCE=off. A read whose credential stops being current while it runs (expired or revoked, or its issuers-file entry disabled or reloaded without its audience) is refused 403 POLICY_DENIED before it delivers. 403 APP_NOT_ADMITTED (since 0.14.0): in a tenant whose root sets apps_enforced, a chain whose application (app, or unlisted) is not admitted at the scope. 403 RUN_REQUIRED (since 0.14.0), details.scope: on the write routes (POST /v1/experience, each item of /v1/experience/bulk and /v1/experiences, each JSONL import line, POST /v1/beliefs), a token with act and no run.
The operator key under CORTEX_OPERATOR_DATA_READS (since 0.14.0, operator_break_glass_v1): allow, audit or deny; unset, deny on the cloud_shared_saas preset and allow on the other presets and with auth disabled; a tenant's own mode (PUT /v1/admin/access/tenant-settings) overrides it in that tenant. 403 BREAK_GLASS_REQUIRED, details {mode, class, route}: under deny, without a well-formed X-Cortex-Break-Glass, an operator-key action of class stored_rows (a route that returns stored rows, or a forget or erasure preview whose selector names about_subject, about_entity or predicate), admin_content (a content-returning admin route), private_region (a read whose scope or extra_scopes lie in a private region) or in_band (a mint of a token that carries a data capability, can mint, carries a registry-write capability or is for an Owner of a private region; a registration, an auto-provisioning first write included; a roster or tree edit that widens a private region or adds a service: principal; a write into a private region or a shared org-tree scope; a migration out of a private region; lowering a tenant's mode from deny; a deployment minter's mint of a token that carries a data capability). 400 INVALID_HEADER, in every mode: that header malformed, sent twice or longer than 512 bytes, details {part: header, field: X-Cortex-Break-Glass, reason: what is wrong with it}. Both refusals write the request's audit row as decision deny, each with its denial (check operator_access, path request#x-cortex-break-glass, decided_by_tier request; reason the 403's class, or break_glass_invalid for the 400, which names no scope), within the operator key's bound (its billing tenant and X-Cortex-Actor) (AuditRow). Its form: reason=incident|legal|support|security|migration|restore|other; ticket=1 to 64 characters of [A-Za-z0-9._:-]; optionally note=percent-encoded UTF-8 of at most 256 bytes; no other key, separated by semicolons. It is read only on the operator key's requests and on a deployment minter's POST /v1/auth/tokens, and ignored on every other credential; a cross-origin browser page cannot send it. 503 NOTICE_UNAVAILABLE: under deny, a header-bearing read of a private region whose notice to the region's person did not commit, so nothing was delivered: details.reason moving, limit, members_behind (Retry-After: 30) or refused (details.refusal), each retriable; arming_disabled and reserved_path_in_use, not retriable. A by-id read's notice is its row's region's, committed once the row is read (since 0.14.0; scope_unnamed is gone).
Before authentication, a build that enforces licenses answers every data route 402 LICENSE_EXPIRED, or 402 LICENSE_REQUIRED when it never held a license, not retriable; health, version, ready, /metrics, the published contract (the OpenAPI document, GET /v1/schemas and /v1/schemas/{name}), the console, every GET /v1/admin/* route, GET /v1/auth/whoami, POST /v1/export and, since 0.14.0, deleting data (POST /v1/forget and its preview, POST /v1/erasures and its preview, /v1/erasures/person, /v1/erasures/tenant, /v1/erasures/{id}/cancel, and GET /v1/erasures/{id}, /verify and /receipt) pass. Not an authentication refusal, and answered only where a write needs a newer shard apply format than the node's shard is armed for (change sets, application records, directory and SCIM writes, a person's erasure and a tenant's deletion, writes that carry atoms or provenance, rehomes and watermarks, a declared belief with provenance): 503 FORMAT_UPGRADE_PENDING, details {reason, format, node, paths, count} (reason, format and node alone on the directory, SCIM, rehome and watermark writes; reason alone on an application record or a reference root), retriable with Retry-After: 30 for members_behind only (arming_disabled and reserved_path_in_use wait for the operator). A plain node arms for format 10 at its first boot of 0.14.0 under the default ceiling, one way, and then never answers it.
In: header
Query Parameters
The scope path to read (422 INVALID_SCOPE_GRAMMAR when it does not parse).
local (the default), granular, raw and structured read the scope exactly (structured still needs scope.read.holistic); holistic adds the authorized ancestors (never descendants); descend reads the authorized subtree. A walk never enters a private region it did not start in. Any other value, lineage included, is 422 INVALID_BODY (invalid view); the value is case-sensitive.
"local"Value in
- "local"
- "granular"
- "raw"
- "structured"
- "holistic"
- "descend"
Page size, default 50, clamped to 1..1000.
1 <= value <= 100050The previous page's next_cursor: a decimal offset into the filtered, ordered result (422 INVALID_CURSOR for any other value). Absent: the first page.
The subject: the ent_ id a fact is served with (subject.id), or the stored subject surface (for example Priya). A fact matches when its served id, or its stored surface, equals it (since 0.14.0; before, only the stored surface). Only a fact with a triple matches.
Exact match of the fact's stored predicate, the ontology canonical (for example plans_to). Only a fact with a triple matches.
RFC 3339. Keeps facts valid at that instant (valid_from <= as_of < valid_to) as the system knows them now (recorded_from <= now; a served fact never carries recorded_to), and implies include_superseded.
date-timeKeeps facts whose confidence is at or above it.
true keeps superseded facts (closed validity windows) in the listing.
falseSince 0.14.0, true returns each record's summary_embedding (a fact's embedding, a belief's or an episode's summary embedding), read back from the side store records are stored lean beside (binary16, within about 1e-3 of the vector embedded); a record that has none stays without. Omitted by default.
falsederivation_provenance_v1: derivation adds each row's derivation object (DerivationDetails) after its own fields; without it no response changes. A comma-separated list whose only value is derivation; any other value is 400 INVALID_QUERY.
Value in
- "derivation"
consistency_tokens_v1: a consistency token from an earlier response, unchanged. Before the route authorizes and runs the read, this node waits until its registry has reached the token's revision and its indexer has indexed below its offset (408 WAIT_TIMEOUT past CORTEX_CONSISTENCY_WAIT_MS, default 10000, at most 30000; 422 CONSISTENCY_TOKEN_INVALID for a token that cannot be this deployment's). The root is ?scope='s, else the token's own; a ?scope= that does not parse skips the wait. A successful response then carries the ConsistencyFields (consistency_token; consistency_reset, derived_through and access_restored_at when they apply) after its own fields.
Header Parameters
operator_break_glass_v1 (API reference §8.15.3): read only on a request the operator key (CORTEX_API_KEY) authenticates, and on a deployment minter's POST /v1/auth/tokens; ignored on every other credential. reason=<incident|legal|support|security|migration|restore|other>; ticket=<1 to 64 of [A-Za-z0-9._:-]>[; note=<percent-encoded UTF-8, at most 256 bytes>], exactly one header of at most 512 bytes; any other form is 400 INVALID_HEADER in every mode (details {part: header, field: X-Cortex-Break-Glass, reason}), and the request's audit row a deny. Under CORTEX_OPERATOR_DATA_READS=deny (the deployment's, or the tenant's own) an operator-key request that reads stored rows, a content-returning admin route, a private region's read, or an in-band path needs it, else 403 BREAK_GLASS_REQUIRED (details {mode, class, route}). A well-formed header is written to the audit row as {reason, ticket}, never the note.
length <= 512subject_token_shadow_v1: on a request the operator key authenticates, the token of the principal the operator acts for, verified by the same verifier (without waiting on the network and without the X-Cortex-Actor step) and evaluated in shadow by the access report (GET /v1/admin/access/report). It never changes the response: a repeated, oversized (over 8,192 bytes) or invalid header, or the operator key itself, is recorded as the shadow's invalid_token and the request runs as sent.
length <= 8192Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/v1/facts?scope=string"{ "items": [ { "id": "string", "scope": "string", "subject": { "type": "entity", "id": "string", "name": "string" }, "predicate": "string", "object": { "type": "entity", "id": "string", "name": "string" }, "supports": [ "string" ], "valid_from": "2019-08-24T14:15:22Z", "valid_to": "2019-08-24T14:15:22Z", "recorded_from": "2019-08-24T14:15:22Z", "recorded_to": "2019-08-24T14:15:22Z", "confidence": 0, "extractor": "string", "superseded_by": "string", "supersedes": "string", "atoms": [ { "scope": "string", "record": "string", "created_at": "2019-08-24T14:15:22Z" } ], "derivation": { "verdict": "accepted", "rule": "string", "policy_hash": "string", "model": "string", "entity_model": "string", "prompt_version": "string", "gate_version": 1, "topic": "string", "derived_by": {}, "pinned": true, "confirmed": true, "unsynced": true }, "stance": "supported", "summary_embedding": [ 0 ], "language": "string", "polarity": "affirmative", "quote": "string", "date_basis": "verbatim", "date_candidates": [ "string" ], "gloss": { "text_en": "string", "object_en": "string", "derived": true, "model": "string", "prompt_version": "string" }, "_partial": true, "_partial_reason": "string", "_progress": 0 } ], "next_cursor": "string", "has_more": true}Facts from text need enrichment; triple captures do not
Facts extracted from text are LLM-derived, so that part of the layer fills once you configure
enrichment (see Self-hosting defaults). A
triple capture writes its fact directly, with or without
enrichment, and the fact is on this endpoint as soon as a ?wait=indexed write returns.
Fact item shape
A fact is { id, scope, subject: { type, id }, predicate, object: { type, datatype, value }, supports, valid_from, valid_to, recorded_from, recorded_to, confidence, stance, polarity }:
- The key is
id;subjectis{ type, id };objectincludes itstype. stanceis e.g."supported";polarityisaffirmative,negatedorceased.- A superseded fact adds
superseded_byand a closedvalid_to.
Facts can also carry these optional fields (additive; rely on them once the
capability fact_surface_v1 appears in GET /v1/admin/version):
| Field | What it holds |
|---|---|
quote | The exact span of the capture's own text the fact came from |
language | The source's language tag, e.g. und-Deva, hi-Latn |
gloss | For a non-English fact, a derived English key: { text_en?, object_en?, derived: true, model, prompt_version }. It is used for search only and never appears in context_block or citations |
date_basis | How a dated fact got its date: refers_to, verbatim, extractor or ambiguous |
date_candidates | Every reading of an ambiguous day word (the fact is then stamped with none) |
Subjects and objects stay in the source script ("प्रिया … चाय"); predicates are English snake_case. Each
captured sentence also yields a states fact whose subject is ent_fact_subject_… and whose object is
the whole sentence.
Entity ids
A subject's id is ent_ plus its name when the name is pure ASCII (ent_Priya, case-sensitive). A
name with any non-ASCII character gets a hashed id: ent_<ascii-base>-<16 hex> when it has
ASCII letters (José → ent_jose-0f66606aa13f1258) or ent_u-<16 hex> when it has none (प्रिया →
ent_u-0133576006acc0d5). Ids stored by earlier releases still resolve on reads and forgets
(see Upgrading).
Negation, cessation and supersession (enrichment on)
- A denial of another value retires nothing. "Meera eats fish" and "Meera doesn't eat non-veg", or
"Amit works at Acme" and "Amit does not work at Globex", stay live side by side (the denial is stored
with
polarity: "negated", e.g.works_at | not Globex). - A change of state is an update. "Kavya doesn't work at Acme anymore" closes the earlier fact
(
valid_toset,superseded_byfilled) and leaves its beliefdeprecated. - A denial of the current value is a contradiction. When the extraction model reads a statement
as a denial of the same value (for example "Priya lives in Delhi", then a later statement stored as
lives_in | not Delhi), both facts stay, the belief becomescontradicted, and a conflict opens on/v1/conflicts, where you can resolve it. How a change is phrased, and the extraction model you use, decide which of the two it becomes.
Facts written wrongly by earlier releases with enrichment on can be repaired with the derived-data repair routes.
Filters
| Filter | What it does |
|---|---|
predicate | Only facts with that predicate (predicate=lives_in). |
subject | Only that subject's facts (subject=ent_Priya). |
min_confidence | Only facts at or above that confidence (0–1). |
as_of | Bi-temporal as-of: the value valid at that instant. |
include_superseded | true adds superseded facts. |
To narrow by object, filter the results on your side. summary_embedding is not returned on this GET;
POST /v1/beliefs/build returns embeddings for beliefs.
How a fact was made (include=derivation)
Needs capability derivation_provenance_v1. Every fact enrichment learns is stamped with
how it was made. include=derivation on GET /v1/facts, /v1/facts/{id} and /v1/facts/timeline
adds a derivation object to each row; without it no response changes, and no recall pack or answer
ever carries it.
"derivation": {"verdict": "accepted", "rule": "accept.default", "policy_hash": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"model": "claude-haiku-5-5", "entity_model": "gpt-4o-mini",
"prompt_version": "kx-default-batch:9c1e44a0", "gate_version": 1, "topic": "food",
"derived_by": null, "pinned": false, "confirmed": false, "unsynced": false}| Field | Meaning |
|---|---|
verdict | accepted for a fact enrichment learned; declared for your own write-back stamped with derived_by; null for a fact with no stamp (written before provenance was recorded, or a typed triple without derived_by) |
rule | The derivation policy rule that admitted it (accept.default, accept.consent.health, review.approved.<decision id>, …); null under no policy |
policy_hash | The effective policy it was learned under; dp1:none when no policy applied |
model, entity_model, prompt_version | The models and the exact prompt version that made it |
topic | The taxonomy topic the policy labelled it with, where the policy uses topics |
derived_by | A write-back's {name, version} stamp |
pinned, confirmed | A correction pins or confirms its claim |
unsynced | It was learned under another policy than the one in force at its scope now; see Re-derivation |
What became of one event (learned, nothing admitted, held for review, skipped and why) is
GET /v1/derivation/decisions.
Correcting a fact
A wrong fact is fixed with a correction (reject, replace,
pin, confirm), which stays applied when enrichment runs again. POST /v1/forget with
derived_only removes a fact but lets it be learned again from the same events.
Notes
- Envelope:
{ items, next_cursor, has_more }. GET /v1/facts/timeline?scope=&subject=&predicate=returns{ subject, predicate, timeline[] }, the supersession chain;subjectthere is{ id }only, and each entry is{ fact_id, value, valid_from, valid_to }(notefact_idhere, notid).- A triple capture takes only
subject,predicateandobject, and stores the fact asaffirmative. Negated facts come from extraction.