Skip to main content
POST
https://api.memoclaw.com
/
v1
/
memories
/
extract
Extract Facts
curl --request POST \
  --url https://api.memoclaw.com/v1/memories/extract \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {}
  ],
  "namespace": "<string>",
  "session_id": "<string>",
  "agent_id": "<string>"
}
'
{
  "memory_ids": [
    "<string>"
  ],
  "facts_extracted": 123,
  "facts_stored": 123,
  "facts_deduplicated": 123,
  "tokens_used": 123
}
Price: $0.01 USDC (includes LLM processing) Extract automatically identifies and stores important facts from a conversation. The LLM parses the messages and creates individual memories for each distinct fact, with automatic deduplication.

Request Body

messages
array
required
Array of conversation messages. Each message must have role (string) and content (string). Max 100 messages, 8,192 characters per message.
namespace
string
Namespace for extracted memories. Default: "default".
session_id
string
Associate extracted memories with a session.
agent_id
string
Associate extracted memories with an agent.

Response (201 Created)

memory_ids
string[]
UUIDs of the stored memories (includes both new and deduplicated).
facts_extracted
number
Total facts identified by the LLM.
facts_stored
number
New facts stored (not duplicates).
facts_deduplicated
number
Facts that matched existing memories (skipped).
tokens_used
number
Total tokens consumed (LLM + embeddings).

Example

curl -X POST https://api.memoclaw.com/v1/memories/extract \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "I prefer dark mode in all my apps. Also, my timezone is PST."},
      {"role": "assistant", "content": "Got it! I will remember your preferences."}
    ]
  }'
Response
{
  "memory_ids": [
    "550e8400-e29b-41d4-a716-446655440010",
    "550e8400-e29b-41d4-a716-446655440011"
  ],
  "facts_extracted": 2,
  "facts_stored": 2,
  "facts_deduplicated": 0,
  "tokens_used": 185
}
The LLM automatically assigns importance and memory type based on the content. Corrections and preferences get higher importance; observations get lower. Each fact is deduplicated against existing memories.