---
title: "Add memory context data"
method: POST
path: "/api/v1/context/memory/add"
tags: ["context"]
---

# Add memory context data

`POST /api/v1/context/memory/add`

This endpoint adds memory (chat history) as context.

## Request body

- object
  - `sessionId` string, required — The ID of the session
  - `contents` object[], required — Array of content objects. Each object must contain at least the 'content' field. Additional properties are allowed.
    - `content` string, required — The content of the memory message
    - `metadata` object — Additional metadata for the message (optional)
      - `messageId` string — Unique message ID
  - `metadata` object — Optional metadata for the memory context. Defaults to ["default"] if not provided.
    - `groupName` string[] — Optional group names for the memory context. Defaults to ["default"] if not provided.

## Response `201`

Memory context added successfully

- ContextAddSuccess
  - `success` boolean, required
  - `context_id` string, required
  - `processed_documents` number

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `402` — Payment Required
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation.md) · [All operations](https://skmtc.net/alchemyst-ai/apis/alchemyst-ai-api-v1-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/alchemyst-ai/alchemyst-ai-api-v1-documentation/versions/af43a0360c78/schema)
