---
title: "Extract durable facts from a conversation (Mem0-parity)"
method: POST
path: "/api/memory"
tags: ["Memory"]
---

# Extract durable facts from a conversation (Mem0-parity)

`POST /api/memory`

## Request

- Base URL: `http://localhost:38200`
- URL: `http://localhost:38200/api/memory`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `token`

Accepts a raw multi-turn conversation and runs LLM fact extraction + kNN-dedup + create/update/archive against the contexts store. Conversations longer than MEMORY_ASYNC_THRESHOLD messages (default 8) run asynchronously — the response is `{ jobId, statusUrl }`, and the caller polls `GET /api/ingest-jobs/{jobId}`. Shorter conversations return the full result inline.

## Request body

- object
  - `messages` object[], required
    - `role` string, required
    - `content` string, required
    - `name` string
  - `subjectId` string
  - `agentSlug` string
  - `workspace` string
  - `project` string
  - `sessionId` string
  - `dryRun` boolean: Preview extraction without writing to the store.
  - `maxClaims` integer
  - `async` boolean: Force the async (true) or sync (false) path. Omit to let the server auto-pick.

## Response `200`

Extraction ran synchronously; full result returned inline.

- object

## Other responses

- `202`: Extraction enqueued asynchronously.
- `400`: Request body/query failed Zod validation.
- `401`: Missing or invalid credentials.
- `422`: LLM extraction failed.

---

[API](https://skmtc.dev/contextq/apis/contextq-api.md) · [All operations](https://skmtc.dev/contextq/apis/contextq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/contextq/apis/contextq-api/revisions/7afc44056a22?raw)
