> For the complete documentation index, see [llms.txt](https://docs.ibexa.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ibexa.ai/developers/rest-api/messages/send-message.md).

# Send Message

Send a message to a conversation and run the agent.

Works for the first message and every subsequent one. `file_ids` reference files previously uploaded to this conversation (via `POST /conversations/{id}/files/`) and are attached to this message.

Requires the organisation to have credits left: a non-positive balance is refused with 402 and the message is not persisted.

```json
{"openapi":"3.1.0","info":{"title":"Ibexa Agentic Marketing Platform","version":"0.1.0"},"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/api/v1/login/access-token"}}}},"schemas":{"SendMessagePayloadSchema":{"properties":{"content":{"type":"string","title":"Content","description":"Message content to add to conversation","default":""},"file_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"File Ids","description":"IDs of files previously uploaded to this conversation to attach to the message"}},"type":"object","title":"SendMessagePayloadSchema","description":"Pydantic schema for sending a message to a conversation."},"SendMessageResponseSchema":{"properties":{"id":{"type":"integer","title":"Id"},"agent_id":{"type":"integer","title":"Agent Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","agent_id","created_by"],"title":"SendMessageResponseSchema","description":"Pydantic schema returned after sending a message — the conversation\nsummary (the agent-generated messages are fetched via the messages list\nendpoint; token/cost counters are not exposed here)."}}},"paths":{"/api/v1/conversations/{conversation_id}/messages/":{"post":{"tags":["messages","public"],"summary":"Send Message","description":"Send a message to a conversation and run the agent.\n\nWorks for the first message and every subsequent one. ``file_ids`` reference\nfiles previously uploaded to this conversation (via\n``POST /conversations/{id}/files/``) and are attached to this message.\n\nRequires the organisation to have credits left: a non-positive balance is\nrefused with 402 and the message is not persisted.","operationId":"messages-send_message","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","title":"Conversation Id"}},{"name":"x-tenant-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Tenant-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagePayloadSchema"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageResponseSchema"}}}},"400":{"description":"Invalid request payload or parameters","content":{"application/json":{}}},"401":{"description":"User not authenticated","content":{"application/json":{}}},"402":{"description":"The organisation has no credits left; top up before running the agent","content":{"application/json":{}}},"403":{"description":"User lacks permission","content":{"application/json":{}}},"404":{"description":"Resource not found or user has no permission to access it","content":{"application/json":{}}},"409":{"description":"Resource is already being processed","content":{"application/json":{}}}}}}}}
```
