Context & facts
Get facts
Read the typed facts Korely extracted from your memories, deterministically, with no model call. Filter by entity or predicate family, and travel back in time with as_of.
/v1/facts
SDK: korely.get_facts(...). This is a pure SQL filter-and-sort
over the facts extracted from your memories, no embeddings, no LLM, fully
deterministic. Every fact is a typed (subject, predicate, object)
triple with bi-temporal validity, so you can ask "what was true on this date"
with as_of.
Authentication
HTTP header, required: Authorization: Bearer kor_live_.... The key must carry the memories:read scope.
Query parameters
All parameters are optional. With none set, you get the most recent valid facts across all your end users.
| Parameter | Type | Default | Description |
|---|---|---|---|
user_id | string | None | Filter to one end user. When omitted, facts are returned across all end users (no end-user scoping). |
agent_id | string | None | Optional agent-namespace filter. |
subject | string | None | Match the subject side of the triple only. Exact and case-insensitive on the subject's current name: a former name (an alias) finds the same entity. An alias belongs to the end user and agent whose memory stated it, so across end users each fact is matched under what its own end user means by the name: if Maria's Acme is now Globex and Luca's Acme is still Acme, subject=Acme without user_id returns both. |
entity | string | None | Match the subject or the object side, every fact mentioning this entity. Same matching as subject. |
predicate | string | None | Filter by one predicate (e.g. works_at). Normalized like a written predicate (works at becomes works_at) and resolved through your project's learned vocabulary, then matched on the canonical predicate. |
predicate_family | string | None | Filter by predicate family: one of preferences, instructions, people, places, work, ownership, health, financial, events, identity, other. Case-insensitive; an unknown family returns an empty list, not an error. Expanded at the SQL level to every predicate in the family. |
include_invalidated | boolean | false | When true, also include facts that are no longer true. They carry invalid_at and invalidated_by so you can trace the supersede chain. Ignored when as_of is set. |
as_of | string | None | ISO date or datetime, point-in-time validity. Returns the facts that were valid at that instant. A naive value is coerced to UTC; a bare date (2026-06-01) means midnight. |
limit | integer | 50 | Page size. Range 1-200. |
offset | integer | 0 | Pagination offset. Minimum 0. |
Example request
curl -G https://api.korely.ai/v1/facts \ -H "Authorization: Bearer kor_live_..." \ --data-urlencode "user_id=customer-giulia-4812" \ --data-urlencode "predicate_family=work" \ --data-urlencode "limit=50"Response
200 OK. A page of typed facts plus the total matching count
(before paging).
{ "facts": [ { "id": "fct_a1", "subject": "Giulia", "subject_type": "person", "predicate": "works_at", "predicate_raw": "works at", "object": "Acme Corp", "object_is_literal": false, "predicate_family": "work", "confidence": 0.92, "user_id": "customer-giulia-4812", "agent_id": "support-bot", "valid_from": "2026-03-01T00:00:00+00:00", "invalid_at": null, "invalidated_by": null, "source_memory_id": "mem_8f2c1a", "created_at": "2026-03-01T09:14:22+00:00", "subject_canonical": "Giulia", "object_canonical": "Acme Corp", "tense": "current", "last_confirmed_at": "2026-05-12T16:40:03+00:00", "observation_count": 2, "source_memory_ids": ["mem_8f2c1a", "mem_41d0e7"] } ], "total": 1}| Field | Type | Description |
|---|---|---|
facts | array<object> | The page of serialized facts. Each item carries the fields below. |
facts[].id | string | The fact id, e.g. fct_a1. |
facts[].subject | string | The subject of the triple. |
facts[].subject_type | string | From extraction: person, organization, product, place, concept, event or unknown. On a fact written with POST /v1/facts, what the caller sent. |
facts[].predicate | string | The normalized predicate, e.g. works_at. |
facts[].predicate_raw | string | The predicate as it appeared in the source text, e.g. works at. |
facts[].object | string | The object of the triple. |
facts[].object_is_literal | boolean | true when the object is a literal value rather than an entity. |
facts[].predicate_family | string | The family the predicate belongs to, e.g. work. |
facts[].confidence | number · null | Extraction confidence, 0-1, rounded to three decimals. |
facts[].user_id / facts[].agent_id | string · null | The scope the fact belongs to (null if unscoped). |
facts[].valid_from | string · null | ISO 8601, when the fact became true (bi-temporal valid time). |
facts[].invalid_at | string · null | ISO 8601, when the fact stopped, or will stop, being true: a contradiction, a correction, a forget or a past write. null while it is open; a future value is a known end date, and the fact is true until then. |
facts[].invalidated_by | string · null | The id of the fact that superseded this one, or null. |
facts[].source_memory_id | string · null | The memory this fact was first extracted from; null for a fact written directly with POST /v1/facts. |
facts[].created_at | string · null | ISO 8601, when the store learned the fact. |
facts[].subject_canonical | string | The subject's current name after aliases (subject keeps the words as written). |
facts[].object_canonical | string | The object's current name after aliases. |
facts[].tense | string | current, past or planned, as the text or the writer said it. |
facts[].last_confirmed_at | string · null | ISO 8601, when a memory last restated the fact. |
facts[].observation_count | integer | How many memories assert the fact. Above 1 it was reconfirmed, not duplicated. |
facts[].source_memory_ids | array<string> | Every mem_ id that asserts the fact. |
total | integer | Total facts matching the filters, before limit / offset paging. |
Errors
| Status | Code | Cause |
|---|---|---|
401 | invalid_key | Missing or invalid Authorization header. Message: Invalid or missing API key: ..., then what is wrong; response carries WWW-Authenticate: Bearer. |
403 | forbidden | The API key lacks the memories:read scope. Message: API key missing required scope(s): memories:read. |
422 | invalid_request | as_of is not a parseable ISO date or datetime. Message: as_of must be an ISO date (2026-06-01) or datetime. A standard validation 422 is also returned if limit or offset falls outside its range. |
429 | rate_limit_exceeded | Per-tier minute / hour / day request limit exceeded. Message: Rate limit exceeded (... per ...). Retry shortly.; response carries Retry-After and X-RateLimit-* headers. |
429 | quota_exceeded | Monthly query quota (plus 10% grace) exhausted. The body adds limit (the plan's figure), used and resets_at (00:00 UTC on the 1st) to code and message ("Monthly query limit reached: ... queries on the ... plan, plus a 10% grace. It starts again on ..."). No Retry-After: read resets_at. |
Notes
- Deterministic. No model or LLM call, a pure SQL filter and sort. The same query returns the same facts every time.
- Travel through time.
as_ofaccepts an ISO date (2026-06-01→ midnight) or a full datetime; naive values are coerced to UTC. It returns the facts that were valid at that instant. - Supersede, not delete. Facts that are no longer true are excluded by default: a fact is current while
valid_fromis not in the future andinvalid_atisnullor still ahead. Passinclude_invalidated=trueto surface the others, they carryinvalid_atandinvalidated_byso you can walk the chain. - Order. Without
as_of, the most recently confirmed first (last_confirmed_at, elsevalid_from, descending); withas_of, byvalid_fromdescending. - Entity vs subject.
entitymatches the subject or the object side;subjectmatches only the subject.predicate_familyis expanded at the SQL level to every predicate in that family. - Scope. When
user_idis omitted there is no end-user scoping, facts are returned across all your end users. - Paging.
limitdefaults to 50 (range 1-200),offsetdefaults to 0.totalreflects the full match count before paging.
Related
- Get context, the assembled recall block, facts and memories in one call.
- Write a fact, add a typed triple directly.
- SDK reference, the
get_factsmethod and its arguments.