# Write a memory (/docs/api/memory-write)
<EndpointLayout>
<EndpointHeader method="POST" path="/v1/dum/write" />

Writes a single memory and returns once it's stored. Use it when you need the new memory's ID straight away. For everything else, [ingest](/docs/api/ingest) batches writes and is what `Dock` uses.

<EndpointExamples>
<CodeTabs items={['cURL']}>
  <Tab value="cURL">
    ```bash
    curl https://api.docklee.com/v1/dum/write \
      -H "Authorization: Bearer $DOCKLEE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "memory_space_id": "your-memory-space-id",
        "content": "Maya prefers email over phone calls.",
        "memory_type": "entity",
        "metadata_json": {"channel": "support-chat"},
        "end_user": "user_8f2c"
      }'
    ```
  </Tab>
</CodeTabs>

<Tabs items={['200', '403']}>
  <Tab value="200">
    ```json
    {
      "id": "9b1e7c42-5d3a-4f08-b6e2-1a7c0d93e5f4",
      "memory_space_id": "2d7f0a91-4c3b-4e58-9a16-8b0e3f5c7d21",
      "memory_scope": "user",
      "memory_type": "entity",
      "created_at": "2026-11-10T09:24:13.481Z"
    }
    ```
  </Tab>
  <Tab value="403">
    ```json
    {
      "detail": "API key does not allow write access."
    }
    ```
  </Tab>
</Tabs>
</EndpointExamples>

## Body [#body]

<ApiFields>
  <ApiField name="memory_space_id" type="string<uuid>" required>
    The memory space to write to.
  </ApiField>
  <ApiField name="content" type="string" required>
    The text to remember.
  </ApiField>
  <ApiField name="memory_type" type="string" required>
    The storage class: `entity`, `episodic`, `document`, `system`, or `derived`. Use `entity` for facts about people and things your app tracks. See [Memory types](/docs/memory/memory-types).
  </ApiField>
  <ApiField name="metadata_json" type="object" defaultValue="{}">
    Your own key and value pairs.
  </ApiField>
  <ApiField name="end_user" type="string | null">
    The person this memory belongs to, up to 255 characters. See [End users](/docs/docklee/end-users).
  </ApiField>
</ApiFields>

## Response [#response]

<ApiFields>
  <ApiField name="id" type="string<uuid>" required>
    The new memory's ID.
  </ApiField>
  <ApiField name="memory_space_id" type="string<uuid>" required>
    The memory space it was written to.
  </ApiField>
  <ApiField name="memory_scope" type="string" required>
    Who the memory belongs to. `user` for memories written with an API key.
  </ApiField>
  <ApiField name="memory_type" type="string" required>
    The storage class you sent.
  </ApiField>
  <ApiField name="created_at" type="string<date-time>" required>
    When the memory was stored.
  </ApiField>
</ApiFields>

## Status codes [#status-codes]

| Status | Meaning |
| --- | --- |
| `200` | The memory was stored. |
| `401` | The key is missing, malformed, or revoked. |
| `403` | The key's capability or scope doesn't allow writing to this memory space. |
| `404` | The memory space doesn't exist in the key's workspace. |
| `422` | A field is missing or invalid, such as an unknown `memory_type`. |
| `429` | A memory write limit was hit. |
</EndpointLayout>
