> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memoclaw.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Store Batch

> POST /v1/store/batch — Store up to 100 memories in a single request.

<Snippet file="snippets/x402-callout.mdx" />

**Price:** \$0.04 USDC

## Request Body

<ParamField body="memories" type="array" required>
  Array of memory objects. Min 1, max 100. Each object accepts the same fields as [Store Memory](/api-reference/store).

  <Expandable title="Memory object fields">
    <ParamField body="memories[].content" type="string" required>
      The memory text. Max 8,192 characters.
    </ParamField>

    <ParamField body="memories[].metadata" type="object">
      Arbitrary key-value metadata. Max 4 KB, 20 keys, 3 levels deep.
    </ParamField>

    <ParamField body="memories[].importance" type="number">
      Float between 0 and 1. Default: `0.5`.
    </ParamField>

    <ParamField body="memories[].namespace" type="string">
      Namespace to isolate memories. Default: `"default"`. Max 255 characters.
    </ParamField>

    <ParamField body="memories[].memory_type" type="string">
      One of: `correction`, `preference`, `decision`, `project`, `observation`, `general`. Default: `"general"`.
    </ParamField>

    <ParamField body="memories[].session_id" type="string">
      Session identifier. Max 255 characters.
    </ParamField>

    <ParamField body="memories[].agent_id" type="string">
      Agent identifier. Max 255 characters.
    </ParamField>

    <ParamField body="memories[].expires_at" type="string">
      ISO 8601 date string. Must be in the future.
    </ParamField>

    <ParamField body="memories[].pinned" type="boolean">
      Pin this memory to exempt it from decay. Default: `false`.
    </ParamField>

    <ParamField body="memories[].immutable" type="boolean">
      Lock the memory from future updates and deletes. Default: `false`.
    </ParamField>
  </Expandable>
</ParamField>

## Response (201 Created)

<ResponseField name="ids" type="string[]">
  Array of UUIDs for the stored memories.
</ResponseField>

<ResponseField name="stored" type="boolean">
  Always `true`.
</ResponseField>

<ResponseField name="count" type="number">
  Number of memories stored.
</ResponseField>

<ResponseField name="deduplicated_count" type="number">
  Number of memories that were deduplicated (merged with existing similar memories).
</ResponseField>

<ResponseField name="tokens_used" type="number">
  Total embedding tokens consumed.
</ResponseField>

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.memoclaw.com/v1/store/batch \
    -H "Content-Type: application/json" \
    -d '{
      "memories": [
        {
          "content": "User prefers dark mode and vim keybindings",
          "metadata": { "tags": ["preferences"] },
          "importance": 0.8
        },
        {
          "content": "Project uses PostgreSQL with pgvector extension",
          "metadata": { "tags": ["stack", "database"] },
          "importance": 0.6
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.memoclaw.com/v1/store/batch", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      memories: [
        {
          content: "User prefers dark mode and vim keybindings",
          metadata: { tags: ["preferences"] },
          importance: 0.8,
        },
        {
          content: "Project uses PostgreSQL with pgvector extension",
          metadata: { tags: ["stack", "database"] },
          importance: 0.6,
        },
      ],
    }),
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  from memoclaw import MemoClaw

  client = MemoClaw()
  result = client.store_batch([
      {"content": "User prefers dark mode and vim keybindings", "metadata": {"tags": ["preferences"]}, "importance": 0.8},
      {"content": "Project uses PostgreSQL with pgvector extension", "metadata": {"tags": ["stack", "database"]}, "importance": 0.6},
  ])
  ```
</CodeGroup>

```json Response theme={null}
{
  "ids": [
    "550e8400-e29b-41d4-a716-446655440000",
    "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
  ],
  "stored": true,
  "count": 2,
  "deduplicated_count": 0,
  "tokens_used": 28
}
```
