RaabtaHQ
Write a memory

Write a memory

POST/api/v1/memories

scope assistants:writeIdempotent

Creates or overwrites a memory. The identity of a memory is (scope, its target, key) — not a row id — so writing the same key twice at the same scope updates it rather than adding a second. That is also why there is no PATCH: a second way to write the same cell is a second answer to what it holds.

Body

application/json
NameTypeDescription
scoperequired
string (enum)Who the memory is aboutaccountassistantcontact
assistant_idoptional
string (uuid) | nullRequired when scope is assistant, ignored otherwise
contact_idoptional
string (uuid) | nullRequired when scope is contact, ignored otherwise
keyrequired
stringMemory key
valuerequired
map<string, any>Structured JSON value
Request
curl -X POST "https://your-crm.example.com/api/v1/memories" \
  -H "Authorization: Bearer $RAABTA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a9e-3b4d-4c5e-8f7a-9b0c1d2e3f4a" \
  -d '{
    "scope": "contact",
    "contact_id": "9d7e4c11-5a2b-4f7c-8e3d-2a1b0c9d8e7f",
    "key": "preferences",
    "value": {
      "preferred_language": "ur",
      "prefers_morning_appointments": true
    }
  }'
Response · 200 OK
{
  "data": {
    "id": "7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b",
    "scope": "contact",
    "assistant_id": null,
    "contact_id": "9d7e4c11-5a2b-4f7c-8e3d-2a1b0c9d8e7f",
    "key": "preferences",
    "value": {
      "preferred_language": "ur",
      "prefers_morning_appointments": true
    },
    "source_run_id": "3f9a1c2e-5b7d-4e8f-9a0b-1c2d3e4f5a6b",
    "created_at": "2026-08-20T14:00:00.000Z",
    "updated_at": "2026-09-01T09:15:00.000Z"
  }
}

Response

Wrapped in { data: … }
NameTypeDescription
idrequired
string (uuid)Memory id
scoperequired
string (enum)Who the memory is aboutaccountassistantcontact
assistant_idrequired
string (uuid) | nullSet only when the scope is assistant
contact_idrequired
string (uuid) | nullSet only when the scope is contact
keyrequired
stringMemory key, unique per scope and target
valuerequired
map<string, any>Structured JSON value; the shape is yours
source_run_idrequired
string (uuid) | nullThe run that wrote it, when an assistant did
created_atrequired
string (date-time)When it was first written
updated_atrequired
string (date-time)When it was last written

Errors

StatusCodeWhen
400bad_requestThe request could not be parsed: malformed JSON, an invalid cursor, or a query parameter of the wrong shape.
400validation_errorThe body or query failed validation. `details` lists each failing field with a `path` and a `message`.
401unauthorizedNo usable API key: the Authorization header is missing or malformed, or the key is unknown, revoked or expired. The three are deliberately indistinguishable.
403forbiddenThe key is valid but lacks the scope this endpoint requires, or the request came from an address outside the key’s IP allowlist. The message says which.
403account_suspendedThe account this key belongs to is suspended. Rotating the key will not help; contact support.
409conflictThe request conflicts with current state: a duplicate phone number on create, an invalid state transition, or an idempotent request that is still in flight.
422unprocessableThe request was well-formed but cannot be carried out. `reason` is a stable string saying why (for example `outside_window` or `stage_not_in_pipeline`).
429rate_limitedThe per-key budget, or the per-IP budget for failed authentication, is exhausted. Honour `Retry-After` before retrying.
500internalSomething failed on our side. Safe to retry with the same Idempotency-Key; quote `request_id` if it persists.