> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shinzo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Message

> Send a message to an agent.

## Authentication

Requires JWT token or Platform API key via `Authorization: Bearer <token>` header.

<ParamField path="id" type="string" required>Agent UUID</ParamField>
<ParamField body="content" type="string" required>Message content</ParamField>
<ParamField body="metadata" type="object">Arbitrary metadata to attach to the message</ParamField>
<ParamField body="channel" type="string" default="api">Channel to send through: `api` or `discord`</ParamField>
<ParamField body="queue_mode" type="string" default="collect">Queue behavior: `collect` or `interrupt`</ParamField>

### Queue Modes

| Mode        | Description                                                                                                |
| ----------- | ---------------------------------------------------------------------------------------------------------- |
| `collect`   | Batches the message for processing when the agent finishes its current task. This is the default behavior. |
| `interrupt` | Cancels the agent's current task and processes your message immediately.                                   |

## Example Request

```bash theme={null}
curl -X POST https://api.app.shinzo.ai/v1/agent/a1b2c3d4-e5f6-7890-abcd-ef1234567890/messages \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Review the code in /workspace/src and provide feedback",
    "metadata": {
      "project": "frontend-app"
    },
    "queue_mode": "collect"
  }'
```

## Example Response

```json theme={null}
{
  "id": "msg_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "role": "user",
  "content": "Review the code in /workspace/src and provide feedback",
  "status": "pending",
  "channel": "api",
  "queue_mode": "collect",
  "created_at": "2025-01-20T10:00:00Z"
}
```

## Status Codes

| Code  | Description                                      |
| ----- | ------------------------------------------------ |
| `201` | Message sent successfully                        |
| `400` | Invalid request (validation error)               |
| `401` | Unauthorized - invalid or missing authentication |
| `404` | Agent not found                                  |
| `503` | Agent unavailable (stopped or error state)       |
