Skip to content

Write a fact

POST
/v1/memory/facts
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" }, "content": "example", "retention": { "keepUntil": "2026-04-15T12:00:00Z", "keepDays": 1, "legalHold": true }, "contentHash": "example" }'

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.

Idempotency-Key
string
>= 1 characters

Caller-supplied idempotency key. Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1).

Media typeapplication/json

Write a fact. type selects the retrieval-policy (which indexes populate); scope.tenantId MUST match the caller’s tenant. Optional retention overrides tenant defaults; optional contentHash is a caller-supplied idempotence hint (runtime computes its own hash regardless).

object
type
required
string
>= 1 characters
scope
required

Fact scope object. tenantId is required; every optional key narrows the fact (userId, orgId, projectId, threadId, sessionId). Additional keys accepted for forward compatibility.

object
tenantId
required
string
userId
string
orgId
string
projectId
string
threadId
string
sessionId
string
key
additional properties
any
content
required

Free-form structured payload.

retention
object
keepUntil
string format: date-time
keepDays
integer
>= 1
legalHold
boolean
contentHash
string
Examplegenerated
{
"type": "example",
"scope": {
"tenantId": "example",
"userId": "example",
"orgId": "example",
"projectId": "example",
"threadId": "example",
"sessionId": "example"
},
"content": "example",
"retention": {
"keepUntil": "2026-04-15T12:00:00Z",
"keepDays": 1,
"legalHold": true
},
"contentHash": "example"
}

Fact written.

Media typeapplication/json
object
id
required

FactId.

string
type
required

Fact type identifier (pack-defined; a few are framework-standard).

string
scope
required

Fact scope object. tenantId is required; every optional key narrows the fact (userId, orgId, projectId, threadId, sessionId). Additional keys accepted for forward compatibility.

object
tenantId
required
string
userId
string
orgId
string
projectId
string
threadId
string
sessionId
string
key
additional properties
any
version
required

Monotonic version within (scope, id). Supersession increments.

integer
>= 1
createdAt
required
string format: date-time
updatedAt
string format: date-time
content

Free-form structured payload.

contentRef

blob://<provider>/<bucket>/<key> when the payload is stored externally.

string
contentHash
string
size
integer
embeddingModel
string
retention
object
keepUntil
string format: date-time
keepDays
integer
>= 1
legalHold
boolean
source
object
kind
required
string
Allowed values: http-api blob mcp-tool external-db user-input
uri
string
freshness
required
object
ttlSeconds
integer
lastVerifiedAt
string format: date-time
etag
string
sourceVersion
string
refresh
required
object
strategy
required
string
Allowed values: on-read background manual
handler
string
priority
integer
causedByLogId
Array<string>
supersedes

FactId of the predecessor when this row supersedes another.

string
Example
{
"source": {
"kind": "http-api",
"refresh": {
"strategy": "on-read"
}
}
}

Malformed body, or the fact type requires semantic indexing and no embedding provider is bound.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

Missing / malformed / expired / revoked bearer token.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

Idempotency-Key was reused with a different body, or resource-state conflict.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

Server error (unmapped domain code or framework crash).

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}