---
title: "Store message to session"
method: POST
path: "/session/{session_id}/messages"
tags: ["session"]
---

# Store message to session

`POST /session/{session_id}/messages`

Supports JSON and multipart/form-data. In multipart mode: the payload is a JSON string placed in a form field. The format parameter indicates the format of the input message (default: openai, same as GET). The blob field should be a complete message object: for openai, use OpenAI ChatCompletionMessageParam format (with role and content); for anthropic, use Anthropic MessageParam format (with role and content); for acontext (internal), use {role, parts} format. The optional meta field allows attaching user-provided metadata to the message, which can be retrieved via get_messages().metas or updated via patch_message_meta().

## Path parameters

- `session_id` string, uuid, required

## Request body

- HandlerStoreMessageReq
  - `blob` unknown, required
  - `format` 'acontext' | 'openai' | 'anthropic' | 'gemini'
  - `meta` object — Optional user-provided metadata for the message

## Response `201`

Created

- object
  - `code` integer
  - `error` string
  - `msg` string
  - `data` ModelMessage
    - `created_at` string
    - `id` string
    - `meta` object
    - `parent_id` string
    - `parts` object[]
    - `role` string
    - `session_id` string
    - `session_task_process_status` string
    - `task_id` string
    - `updated_at` string

---

[API](https://skmtc.dev/memodb-io/apis/acontext-api.md) · [All operations](https://skmtc.dev/memodb-io/apis/acontext-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/memodb-io/acontext-api/revisions/c8775333b1ed/schema)
