Write a fact
const url = 'https://example.com/v1/memory/facts';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"type":"example","scope":{"tenantId":"example","userId":"example","orgId":"example","projectId":"example","threadId":"example","sessionId":"example","participantId":"example"},"content":"example","retention":{"keepUntil":"2026-04-15T12:00:00Z","keepDays":1,"legalHold":true},"contentHash":"example","subjects":[{"kind":"participant","id":"example"}],"validFrom":"2026-04-15T12:00:00Z","validUntil":"2026-04-15T12:00:00Z","observedAt":"2026-04-15T12:00:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/memory/facts \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "example", "scope": { "tenantId": "example", "userId": "example", "orgId": "example", "projectId": "example", "threadId": "example", "sessionId": "example", "participantId": "example" }, "content": "example", "retention": { "keepUntil": "2026-04-15T12:00:00Z", "keepDays": 1, "legalHold": true }, "contentHash": "example", "subjects": [ { "kind": "participant", "id": "example" } ], "validFrom": "2026-04-15T12:00:00Z", "validUntil": "2026-04-15T12:00:00Z", "observedAt": "2026-04-15T12:00:00Z" }'Persists a new fact. type selects the retrieval policy (which indexes populate). Semantic-indexed types require an embedding provider bound on the deployment; if unavailable, the route returns 400 bad-input. The caller needs write where the scope says: write on its project (an end user’s or a conversation’s fact included), write on its conversation outside a project, admin on its org for an org-wide fact, being that user for a user’s fact, and workspace admin for a workspace-wide fact. The fact records who wrote it (attributedTo). A key or session limited to a project writes only in that project or one of its conversations: any other scope is 403 permission-denied, facts about its own person included.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered 503 idempotency-store-unavailable with Retry-After: nothing ran, so retry with the same key (from 0.3.0).
Request Bodyrequired
Section titled “Request Bodyrequired”Write a fact. type selects the retrieval-policy (which indexes populate); scope.tenantId MUST match the caller’s workspace. Optional retention overrides workspace defaults; optional contentHash is a caller-supplied idempotence hint (runtime computes its own hash regardless). subjects names whom it is about; validFrom/validUntil when it is true in the world; observedAt when it was said or seen.
object
Fact scope object. tenantId is required; every optional key narrows the fact (userId, orgId, projectId, threadId, sessionId, participantId). A fact is readable by whoever has every container it names. Additional keys accepted for forward compatibility.
object
An app’s end user, by the app’s own id: a fact private to that participant’s runs. Needs projectId.
Free-form structured payload.
object
Whom a fact is about: what access and erasure requests by person find.
object
Responses
Section titled “Responses”Fact written.
object
The fact id, kept across revisions (for a fact never superseded, also its one revision id).
This revision’s own id; absent where it equals id.
Fact type identifier (pack-defined; a few are framework-standard).
Fact scope object. tenantId is required; every optional key narrows the fact (userId, orgId, projectId, threadId, sessionId, participantId). A fact is readable by whoever has every container it names. Additional keys accepted for forward compatibility.
object
An app’s end user, by the app’s own id: a fact private to that participant’s runs. Needs projectId.
The revision number within the fact: 1, then one more per supersede or verify.
Free-form structured payload.
blob://<provider>/<bucket>/<key> when the payload is stored externally.
object
object
object
object
The revision this one replaced.
verified: a person with the right checked it. asserted: an app or a person wrote it. unverified: an agent remembered it during a conversation. Absent on facts from before trust was recorded: asserted.
Who asserted a fact, set by the server from the writer.
object
The run step that wrote a fact, for one an agent wrote.
object
Whom a fact is about: what access and erasure requests by person find.
object
When the fact starts being true in the world; absent: always.
When the fact stops being true in the world; absent: still true.
When it was said or seen.
When this revision stopped being current; absent: it is current.
user:<id> or service:<id>.
pending while a person must approve it: a pending fact is never retrieved.
When this revision stops being readable: from its retention (keepUntil, or keepDays from the fact’s first write), or an agent-remembered fact’s unverified window. No read returns it after; absent: it doesn’t expire.
Example
{ "source": { "kind": "http-api", "refresh": { "strategy": "on-read" } }, "trust": "verified", "attributedTo": { "kind": "user" }, "subjects": [ { "kind": "participant" } ], "invalidationReason": "superseded", "review": "pending"}Malformed body, or the fact type requires semantic indexing and no embedding provider is bound.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}permission-denied: the caller may not write in the fact’s scope. Without an authorization store, key-project-mismatch (details.keyProjectId): the API key or session is limited to a project, and this writes above it, to the workspace, an org or a team (with a store, that is permission-denied).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body; or an erasure of the fact’s person (by scope or subject) or conversation is in progress (erasure-in-progress): nothing new is stored for them until it completes. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
See also
GET /v1/memory/facts: List factsGET /v1/memory/facts/{factId}: Fetch a factDELETE /v1/memory/facts/{factId}: Delete a factGET /v1/memory/facts/{factId}/revisions: List a fact's revisions- Error code
authz-backend-unavailable - Error code
database-busy - Error code
erasure-in-progress - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code