---
title: "Send a message to a session"
method: POST
path: "/api/messaging/sessions/{sessionId}/messages"
tags: ["messaging"]
---

# Send a message to a session

`POST /api/messaging/sessions/{sessionId}/messages`

## Request

- Base URL: `http://localhost:3000`
- URL: `http://localhost:3000/api/messaging/sessions/{sessionId}/messages`
- Auth: none declared

Send a message within an active session. The agent will process and respond to the message.

## Path parameters

- `sessionId` string, required

## Request body

- object
  - `content` string, required: The message content
  - `attachments` object[]
    - `type` string: Type of attachment
    - `url` string: URL of the attachment
    - `name` string: Name of the attachment
  - `metadata` object: Additional message metadata

## Response `201`

Message sent and processed successfully

- object
  - `id` string: Message ID
  - `content` string: The message content
  - `authorId` string, uuid
  - `createdAt` string, date-time
  - `metadata` object
  - `sessionStatus` object: Current session status after sending the message
    - `expiresAt` string, date-time: Updated expiration timestamp
    - `renewalCount` integer: Total number of times the session has been renewed
    - `wasRenewed` boolean: Whether the session was renewed by this message
    - `isNearExpiration` boolean: Whether the session is within the warning threshold

## Other responses

- `400`: Invalid request parameters
- `404`: Session not found
- `410`: Session has expired
- `500`: Internal server error

---

[API](https://skmtc.dev/elizaos/apis/eliza-os-api.md) - [All operations](https://skmtc.dev/elizaos/apis/eliza-os-api/llms.txt) - [OpenAPI document](https://skmtc.dev/elizaos/apis/eliza-os-api/revisions/d606a12682bb?raw)
