Skip to content

Retain

Store one or more memories in a bank.

POST /v1/me/banks/{bank}/memories
bash
curl https://api.cognimemo.com/v1/me/banks/jane%40acme.com/memories \
  -H "Authorization: Bearer cmk_live_…" -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "content": "Jane joined the Gemini team at DeepMind.",
        "fact_type": "world",
        "entities": [{"text": "Jane", "type": "PERSON"}, {"text": "Gemini", "type": "PROJECT"}],
        "tags": ["team"] }
    ]
  }'

Body

FieldTypeDescription
itemsarrayOne or more memory items (below). Batch to amortize cost.
document_idstringOptional: group all items under a document.
asyncboolProcess in the background; returns operation ids.

Item fields

FieldTypeDescription
contentstringRequired. The memory text.
fact_typestringStore as a typed block: world · experience · observation · procedure · reasoning · preference · correction · profile. Default: auto-classified. See Typed blocks.
contextstringExtra context for the memory.
timestampISO 8601When the event occurred (drives temporal recall).
entitiesarray[{ "text": "...", "type": "PERSON" }] — guaranteed-recognized entities, merged with extracted ones. See Entities.
resolve_entitiesboolResolve supplied entities against existing ones (default true).
tagsstring[]Visibility/filtering tags.
metadataobjectUser-defined key/value metadata.
update_modestringWith a repeated document_id: replace (default) or append.

Query scoping

Add ?space={space} (or space in the SDK) to attach the bank to an organization on first use. Retaining to __org__:{space} writes to the org bank.

Response

json
{ "success": true, "memories_created": 1, "document_id": "…" }

SDK

python
cm.retain(bank_id="jane@acme.com", content="…", fact_type="preference",
          entities=[{"text": "Jane", "type": "PERSON"}], tags=["team"])
typescript
await cm.retain("jane@acme.com", "…", { factType: "preference",
  entities: [{ text: "Jane", type: "PERSON" }], tags: ["team"] });