Memories API
The Memories API shows what the Memories page shows. It returns what your agents have learned: each agent’s core memory plus the long-term facts they learned from their work, filtered by layer, fact type, scope, and free text. To search long-term memory as it is right now, use Search Long-Term Memory; to forget a memory, Forget Memories.
Reads require the memory:read scope. The filters and privacy rules are the same ones the Memories page uses.
Memory Object
{
"id": "kh7abc123def456",
"text": "The Q3 launch moved to October 14.",
"scope": "workspace",
"layer": "long_term",
"factType": "world",
"status": "active",
"proofCount": 3,
"firstSeenAt": "2025-01-10T12:00:00.000Z",
"lastUsedAt": "2025-01-16T09:30:00.000Z"
}Field Reference
| Field | Type | Description |
|---|---|---|
id | string | The memory’s id. Forget Memories takes it |
text | string | The memory itself, as stored |
scope | string | Visibility scope: workspace, or pair:<humanUserId>:<agentUserId> for something one person shared with one agent |
layer | string | core (an agent’s core memory: its name and role, from the agent’s record; read-only) or long_term (what your agents learned from work and conversations) |
factType | string | null | Fact classification. Known values: observation, world, experience. Null when the row carries none |
status | string | active, archived, or deleted. Archived memories were set aside automatically because they went out of date or unused, and can be restored; deleted memories were removed |
proofCount | number | null | How many times the memory has been confirmed, when known |
firstSeenAt | string | ISO 8601 timestamp of when the memory was first recorded |
lastUsedAt | string | ISO 8601 timestamp of when the memory was last used |
List Memories
GET /api/v1/memoriesReturns memories readable by the calling key’s user in the current workspace. Requires memory:read scope.
Each page reads the most recent memories, applies your filters, and returns what is left sorted by lastUsedAt, newest first. Memories in scopes you cannot read, such as another member’s pair: memories, are never returned.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
layer | string | Filter by layer. Comma-separated for multiple values. Valid: long_term, core |
factType | string | Filter by fact type. Comma-separated for multiple values. Any string is accepted; the known values are observation, world, experience |
notFactType | string | Exclude fact types. Comma-separated for multiple values. True negation — a memory with no factType survives every notFactType filter |
status | string | Filter by status. Comma-separated for multiple values. Valid: active, archived, deleted. Defaults to active |
scope | string | Filter to one exact scope string, e.g. workspace |
search | string | Case-insensitive substring match against the memory text |
limit | integer | Page size. Default 25, max 100. Values above 100 are capped and meta.limitCapped is set in the response |
cursor | string | Pagination cursor from a previous response’s cursor field. Opaque — do not construct one. A malformed cursor is ignored and the scan starts from the top |
Invalid layer or status values return 400 with the valid values listed. factType, notFactType and scope are free-form strings and are never rejected — an unknown value simply matches nothing.
Response
{
"data": [
{
"id": "kh7abc123def456",
"text": "The Q3 launch moved to October 14.",
"scope": "workspace",
"layer": "long_term",
"factType": "world",
"status": "active",
"proofCount": 3,
"firstSeenAt": "2025-01-10T12:00:00.000Z",
"lastUsedAt": "2025-01-16T09:30:00.000Z"
},
{
"id": "kh7ghi789jkl012",
"text": "Mara is the workspace's personal assistant.",
"scope": "workspace",
"layer": "core",
"factType": null,
"status": "active",
"proofCount": null,
"firstSeenAt": "2025-01-08T08:15:00.000Z",
"lastUsedAt": "2025-01-15T22:04:00.000Z"
}
],
"cursor": "1736510400000",
"hasMore": true,
"meta": {
"scannedCount": 25,
"hiddenConsolidatedCount": 4
}
}Example
curl "https://api.cohort.bot/api/v1/memories?layer=long_term&factType=world&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"No total
This endpoint returns no total, unlike the other paginated list endpoints. Read meta instead:
| Field | Type | Description |
|---|---|---|
scannedCount | integer | How many memories this page looked at before your filters. Lets you tell “nothing matched” from “nothing in range” |
hiddenConsolidatedCount | integer | How many facts the default view left out because an observation it shows already covers them (see below) |
limitCapped | boolean | Present only when the requested limit exceeded 100 and was reduced |
maxLimit | integer | Present alongside limitCapped. Currently 100 |
Because filters apply after a page is read, data can hold fewer than limit items while hasMore is still true. Paginate on hasMore and cursor, never on data.length.
The default view shows each fact once
Long-term memory keeps the facts it learns and observations that sum them up. With no fact-type filter supplied, data holds the observations plus every long-term fact that no observation in the list already covers. A world or experience fact that an observation shown here covers is left out (it is never deleted) and counted in meta.hiddenConsolidatedCount, so an unfiltered browse shows each fact once.
Supplying any fact-type filter turns the default off — factType or notFactType, inclusive or negated. Asking for a fact type is you stating what you want, and it wins outright. To see every fact, held by an observation or not, pass factType=world,experience.
Fact-type filter semantics
Fact-type filters apply uniformly to every layer — core rows are not exempt. A memory with no factType is not a member of any fact type, so:
- it matches no
factTypefilter, and - it survives every
notFactTypefilter.
Search Long-Term Memory
POST /api/v1/memories/recallSearches the workspace’s long-term memory as it is right now and returns what is relevant to query, most relevant first. GET /api/v1/memories can take a while to show the newest learning; this endpoint finds a fact learned a minute ago. Requires memory:read scope.
Your scope rules still apply: a memory in a scope the key’s user cannot read, or one someone deleted, is never returned. Results are long-term memory only. Each call runs a live search, so call it when you need an answer rather than in a loop.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | What to look for, in plain language. 1 to 400 characters |
limit | integer | No | Most results to return, 1 to 50. Default 10 |
Response
{
"data": [
{
"id": "kh7abc123def456",
"text": "The launch moved to Friday after the legal review.",
"layer": "long_term",
"factType": "observation",
"mentionedAt": "2026-10-01T16:00:00.000Z"
}
],
"meta": { "latencyMs": 812 }
}An empty data means nothing relevant is known. Each result’s id is the same memory’s id in GET /api/v1/memories, even for something learned a minute ago, and it is what Forget Memories takes.
| Status | Meaning |
|---|---|
| 400 | Missing or too-long query, limit out of range, or an unknown field |
| 409 | Long term agent memory is turned off for this workspace |
| 503 | Memory could not be searched right now (MEMORY_UNAVAILABLE). Retry after Retry-After seconds |
Example
curl -X POST "https://api.cohort.bot/api/v1/memories/recall" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "When is the launch?", "limit": 5}'Forget Memories
POST /api/v1/memories/forgetForgets memories by their id, the one List Memories and Search Long-Term Memory return. It is the same as deleting on the Memories page: the memory leaves GET /api/v1/memories at once, and your agents stop using it shortly after. Forgetting a long-term memory also removes the summaries built from it. Core memory comes from the agent’s record, so it can’t be forgotten here: its id answers read_only. Requires memory:write scope. It works while long term agent memory is turned off.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
ids | string[] | Yes | The ids of the memories to forget, 1 to 25 |
Response
{
"data": [
{ "id": "kh7abc123def456", "status": "forgotten" },
{ "id": "kh7zzz999yyy888", "status": "not_found" }
]
}Each id is answered on its own, in the order given:
| Status | Meaning |
|---|---|
forgotten | Forgotten now, or already forgotten |
not_found | No such memory that this key’s user can see: another member’s private memory, or one in another workspace |
invalid | Not a memory id |
read_only | A core memory: it comes from the agent’s record and can’t be forgotten here |
| HTTP status | Meaning |
|---|---|
| 400 | ids missing, empty, longer than 25 or not strings, or an unknown field |
| 403 | The key lacks memory:write |
Example
curl -X POST "https://api.cohort.bot/api/v1/memories/forget" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["kh7abc123def456"]}'