---
title: "Append Messages"
method: POST
path: "/v1/finetune-agent/sessions/{session_id}/messages"
tags: ["Finetune Agent", "agent-chat-sessions"]
---

# Append Messages

`POST /v1/finetune-agent/sessions/{session_id}/messages`

## Request

- Base URL: `https://api.pioneer.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.pioneer.ai/v1/finetune-agent/sessions/{session_id}/messages`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/pioneer/apis/brain-api/docs/v1/finetune-agent/sessions/:session_id/messages/post.ts> (a function with typed inputs; its response is checked against the schema)

Append messages to an existing session.

Args:
    request: FastAPI request used by the rate-limiter.
    session_id: Chat session primary key.
    body: Messages to append.
    auth: Authenticated caller.
    service: Chat-session service.

Returns:
    ChatSessionMessagesAppendResponse with messages_added count.

Raises:
    HTTPException: 404 when the session is missing or not owned.

## Path parameters

- `session_id` string, uuid, required

## Request body

- ChatSessionMessagesAppend: Request model for appending messages to a session.
  - `messages` ChatMessageCreate[], required: Messages to append
    - `role` string, required: Message role: 'user', 'assistant', or 'tool'
    - `content` string, required: Message content
    - `tool_call_id` string, nullable: Tool call ID for tool messages
    - `tool_calls` object[], nullable: Tool calls made by assistant

## Response `200`

Successful Response

- ChatSessionMessagesAppendResponse: Response model for appending messages.
  - `success` boolean
  - `session_id` string, required
  - `messages_added` integer, required

## Other responses

- `422`: Validation Error

## Changes

- **2026-09-24** `0e5e86e2bae5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/pioneer/apis/brain-api/changes/v1/finetune-agent/sessions/:session_id/messages/post.md)

---

[API](https://skmtc.dev/pioneer/apis/brain-api.md) - [All operations](https://skmtc.dev/pioneer/apis/brain-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pioneer/apis/brain-api/revisions/0e5e86e2bae5?raw)
