> ## 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.

# Ingest

> POST /v1/ingest — Zero-effort ingestion: dump a conversation or raw text, get extracted facts, dedup, and auto-relations.

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

**Price:** \$0.01 USDC

Ingest is the easiest way to add memories. Dump a conversation or raw text and MemoClaw will extract facts, deduplicate against existing memories, and optionally create relations between them — all in one call.

## Request Body

<ParamField body="messages" type="array">
  Array of conversation messages (`{role, content}`). Provide either `messages` or `text`.
</ParamField>

<ParamField body="text" type="string">
  Raw text to extract facts from. Provide either `messages` or `text`.
</ParamField>

<ParamField body="namespace" type="string">
  Namespace for extracted memories. Default: `"default"`.
</ParamField>

<ParamField body="session_id" type="string">
  Session identifier for multi-agent scoping.
</ParamField>

<ParamField body="agent_id" type="string">
  Agent identifier for multi-agent scoping.
</ParamField>

<ParamField body="auto_relate" type="boolean">
  Automatically create relations between extracted facts. Default: `false`.
</ParamField>

## Response (201 Created)

<ResponseField name="memory_ids" type="array">
  Array of UUIDs for the stored memories.
</ResponseField>

<ResponseField name="facts_extracted" type="number">
  Total facts extracted from the input.
</ResponseField>

<ResponseField name="facts_stored" type="number">
  Facts that were stored (after deduplication).
</ResponseField>

<ResponseField name="facts_deduplicated" type="number">
  Facts that were skipped because they already existed.
</ResponseField>

<ResponseField name="relations_created" type="number">
  Number of relations created between facts (when `auto_relate` is true).
</ResponseField>

<ResponseField name="tokens_used" type="number">
  Tokens consumed by the LLM extraction.
</ResponseField>

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.memoclaw.com/v1/ingest \
    -H "Content-Type: application/json" \
    -d '{
      "messages": [
        {"role": "user", "content": "I prefer dark mode and use vim. My timezone is PST."},
        {"role": "assistant", "content": "Got it! Dark mode, vim, and PST timezone noted."}
      ],
      "namespace": "default",
      "auto_relate": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.memoclaw.com/v1/ingest", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      messages: [
        { role: "user", content: "I prefer dark mode and use vim. My timezone is PST." },
        { role: "assistant", content: "Got it! Dark mode, vim, and PST timezone noted." },
      ],
      namespace: "default",
      auto_relate: true,
    }),
  });
  ```

  ```bash CLI theme={null}
  memoclaw ingest "I prefer dark mode and use vim. My timezone is PST."
  ```

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

  client = MemoClaw()
  result = client.ingest(
      messages=[
          {"role": "user", "content": "I prefer dark mode and use vim. My timezone is PST."},
          {"role": "assistant", "content": "Got it! Dark mode, vim, and PST timezone noted."},
      ],
      auto_relate=True,
  )
  ```
</CodeGroup>

```json Response theme={null}
{
  "memory_ids": [
    "550e8400-e29b-41d4-a716-446655440020",
    "550e8400-e29b-41d4-a716-446655440021",
    "550e8400-e29b-41d4-a716-446655440022"
  ],
  "facts_extracted": 3,
  "facts_stored": 3,
  "facts_deduplicated": 0,
  "relations_created": 2,
  "tokens_used": 185
}
```

<Note>
  Ingest combines extract, dedup, and relate into a single call. If you only need extraction without dedup/relations, use the [Extract](/api-reference/extract) endpoint instead.
</Note>
