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

# Extract Memories

> Extract typed memories from a conversation and store them.

## Overview

Reads a conversation and extracts the durable facts, preferences, decisions and so on as typed memories, using an LLM. With `dry_run: true` it returns the candidates without storing them. Stored memories get the tag `conversation-extract`.

## Authentication

**x-api-key** `string` *required*

Your Memanto Cloud API key (`mk_...`). See [Authentication](https://docs.memanto.ai/cloud/api/introduction.md#authentication).

## Path Parameters

**agent\_id** `string` *required*

The agent's ID.

## Body

**messages** `array` *required*

The conversation: objects with `role` and `content`.

**dry\_run** `boolean` (default: false)

Return candidates without storing them.

**max\_memories** `integer` (default: 20)

Most memories to extract.

**ai\_model** `string`

Model to extract with. See [List Models](https://docs.memanto.ai/cloud/api/ai/list-models.md).

With `dry_run: true` the response has `candidates` and `count` only. Extracted memories get `source: "conversation"`.

```bash cURL theme={null}
curl -X POST "https://api.memanto.ai/agents/my-agent/remember/extract" \
  -H "x-api-key: $MEMANTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "role": "user",
        "content": "I'm vegetarian and I live in Toronto."
      },
      {
        "role": "assistant",
        "content": "Noted!"
      }
    ]
  }'
```

```json 200 - OK theme={null}
{
  "agent_id": "my-agent",
  "dry_run": false,
  "candidates": [
    {
      "type": "preference",
      "title": "Dietary Preference",
      "content": "The user is vegetarian.",
      "confidence": 1,
      "source": "conversation",
      "provenance": "explicit_statement"
    },
    {
      "type": "fact",
      "title": "User Location",
      "content": "The user lives in Toronto.",
      "confidence": 1,
      "source": "conversation",
      "provenance": "explicit_statement"
    }
  ],
  "total_submitted": 2,
  "successful": 2,
  "failed": 0,
  "results": [
    {
      "id": "fe52eef5-…",
      "status": "stored"
    },
    {
      "id": "f27b1427-…",
      "status": "stored"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.