POST /api/v1/conversations/{cuuid}/messages
Requires the messages:write permission.
Authentication
Use an agent API key and secret.
Parameters
| Name | Location | Type | Required | Description |
|---|---|---|---|---|
| cuuid | path | string | Yes |
Request body
Message details
Required: Yes.
application/json
| Field | Type | Required | Description |
|---|---|---|---|
| message | string | No | Message content |
| attachments | array of integer | No | Attachment IDs |
| attachments[] | integer | ||
| private | boolean | No | Whether message is private (internal note) |
| to | array of string | No | Email recipients |
| to[] | string | ||
| cc | array of string | No | CC recipients |
| cc[] | string | ||
| bcc | array of string | No | BCC recipients |
| bcc[] | string | ||
| sender_type | string (enum) | Yes | Specifies whether the message is sent by an agent or a contact. enum: ["agent", "contact"] |
| mentions | array of object | No | Agents or teams mentioned in a private note. |
| mentions[].type | string (enum) | No | Whether the mention targets an agent or a team enum: ["agent", "team"] |
| mentions[].id | integer | No | ID of the mentioned agent or team |
| echo_id | string | No | Client-generated identifier echoed back to deduplicate the message on the sender's side |
Responses
200
Message sent successfully
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "success" |
| data | object | No | |
| data.id | integer | No | |
| data.created_at | string (date-time) | No | |
| data.updated_at | string (date-time) | No | |
| data.uuid | string | No | |
| data.type | string (enum) | No | enum: ["incoming", "outgoing", "activity"] |
| data.status | string (enum) | No | enum: ["pending", "sent", "received", "failed"] |
| data.conversation_id | integer | No | |
| data.conversation_uuid | string | No | |
| data.content | string | No | |
| data.text_content | string | No | |
| data.content_type | string (enum) | No | enum: ["html", "text"] |
| data.private | boolean | No | |
| data.sender_id | integer | No | |
| data.sender_type | string (enum) | No | enum: ["agent", "contact"] |
| data.meta | object | No | nullable: true |
| data.meta.to | array of string | No | |
| data.meta.to[] | string | ||
| data.meta.cc | array of string | No | |
| data.meta.cc[] | string | ||
| data.meta.bcc | array of string | No | |
| data.meta.bcc[] | string | ||
| data.meta.from | array of string | No | |
| data.meta.from[] | string | ||
| data.meta.subject | string | No | |
| data.attachments | array of object | No | |
| data.attachments[].name | string | No | |
| data.attachments[].size | integer | No | |
| data.attachments[].content | string (byte) | No | nullable: true |
| data.attachments[].content_id | string | No | |
| data.attachments[].content_type | string | No | |
| data.attachments[].disposition | string (enum) | No | enum: ["inline", "attachment"] |
| data.attachments[].uuid | string | No | |
| data.attachments[].url | string | No | |
| data.attachments[].thumbnail_url | string | No | |
| data.author | object | No | |
| data.author.id | integer | No | |
| data.author.first_name | string | No | |
| data.author.last_name | string | No | |
| data.author.email | string (email) | No | nullable: true |
| data.author.avatar_url | string | No | nullable: true |
| data.author.availability_status | string | No | |
| data.author.type | string (enum) | No | enum: ["agent", "contact", "visitor", "ai_assistant"] |
| data.author.last_active_at | string (date-time) | No | nullable: true |
400
Invalid request
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "error" |
| message | string | No | Error message example: "Invalid request" |
| data | unspecified | No | Additional error data nullable: true |
| error_type | string (enum) | No | enum: ["GeneralException", "PermissionException", "InputException", "DataException", "NetworkException", "NotFoundException", "ConflictException", "UnauthorizedException", "RateLimitException"] |
401
Unauthorized
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "error" |
| message | string | No | Error message example: "Invalid request" |
| data | unspecified | No | Additional error data nullable: true |
| error_type | string (enum) | No | enum: ["GeneralException", "PermissionException", "InputException", "DataException", "NetworkException", "NotFoundException", "ConflictException", "UnauthorizedException", "RateLimitException"] |
403
Forbidden
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "error" |
| message | string | No | Error message example: "Invalid request" |
| data | unspecified | No | Additional error data nullable: true |
| error_type | string (enum) | No | enum: ["GeneralException", "PermissionException", "InputException", "DataException", "NetworkException", "NotFoundException", "ConflictException", "UnauthorizedException", "RateLimitException"] |
404
Not found
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "error" |
| message | string | No | Error message example: "Invalid request" |
| data | unspecified | No | Additional error data nullable: true |
| error_type | string (enum) | No | enum: ["GeneralException", "PermissionException", "InputException", "DataException", "NetworkException", "NotFoundException", "ConflictException", "UnauthorizedException", "RateLimitException"] |
500
Internal server error
Content type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
| status | string | No | example: "error" |
| message | string | No | Error message example: "Invalid request" |
| data | unspecified | No | Additional error data nullable: true |
| error_type | string (enum) | No | enum: ["GeneralException", "PermissionException", "InputException", "DataException", "NetworkException", "NotFoundException", "ConflictException", "UnauthorizedException", "RateLimitException"] |
Specification
Download the complete OpenAPI specification.
OpenAPI definition for this endpoint
openapi: 3.0.0
info:
title: Libredesk API
description: >-
REST API documentation for Libredesk helpdesk system.
## Authentication
The Libredesk API supports two authentication methods:
### 1. Basic Authentication
Use your API key and secret with Basic authentication:
```
Authorization: Basic <base64_encoded_api_key:api_secret>
```
### 2. Token Authentication
Use your API key and secret with token authentication:
```
Authorization: token api_key:api_secret
```
To obtain API credentials, generate them from your agent profile in the
Libredesk dashboard.
version: 1.0.0
servers:
- url: http://localhost:8080
description: Local development server
security:
- basicAuth: []
- tokenAuth: []
paths:
/api/v1/conversations/{cuuid}/messages:
post:
tags:
- Conversations
summary: Send Message
description: Requires the `messages:write` permission.
operationId: handleSendMessage
parameters:
- name: cuuid
in: path
required: true
schema:
type: string
requestBody:
description: Message details
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MessageRequest'
responses:
'200':
description: Message sent successfully
content:
application/json:
schema:
$ref: '#/components/schemas/MessageResponse'
'400':
description: Invalid request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- basicAuth: []
- tokenAuth: []
components:
schemas:
MessageRequest:
type: object
required:
- sender_type
properties:
message:
type: string
description: Message content
attachments:
type: array
items:
type: integer
description: Attachment IDs
private:
type: boolean
description: Whether message is private (internal note)
to:
type: array
items:
type: string
description: Email recipients
cc:
type: array
items:
type: string
description: CC recipients
bcc:
type: array
items:
type: string
description: BCC recipients
sender_type:
type: string
enum:
- agent
- contact
description: Specifies whether the message is sent by an agent or a contact.
mentions:
type: array
description: Agents or teams mentioned in a private note.
items:
type: object
properties:
type:
type: string
enum:
- agent
- team
description: Whether the mention targets an agent or a team
id:
type: integer
description: ID of the mentioned agent or team
echo_id:
type: string
description: >-
Client-generated identifier echoed back to deduplicate the message
on the sender's side
MessageResponse:
type: object
properties:
status:
type: string
example: success
data:
$ref: '#/components/schemas/Message'
ErrorResponse:
type: object
description: Error response format
properties:
status:
type: string
example: error
message:
type: string
description: Error message
example: Invalid request
data:
nullable: true
description: Additional error data
error_type:
type: string
enum:
- GeneralException
- PermissionException
- InputException
- DataException
- NetworkException
- NotFoundException
- ConflictException
- UnauthorizedException
- RateLimitException
Message:
type: object
properties:
id:
type: integer
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
uuid:
type: string
type:
type: string
enum:
- incoming
- outgoing
- activity
status:
type: string
enum:
- pending
- sent
- received
- failed
conversation_id:
type: integer
conversation_uuid:
type: string
content:
type: string
text_content:
type: string
content_type:
type: string
enum:
- html
- text
private:
type: boolean
sender_id:
type: integer
sender_type:
type: string
enum:
- agent
- contact
meta:
type: object
properties:
to:
type: array
items:
type: string
cc:
type: array
items:
type: string
bcc:
type: array
items:
type: string
from:
type: array
items:
type: string
subject:
type: string
nullable: true
attachments:
type: array
items:
$ref: '#/components/schemas/Attachment'
author:
$ref: '#/components/schemas/MessageAuthor'
Attachment:
type: object
properties:
name:
type: string
size:
type: integer
content:
type: string
format: byte
nullable: true
content_id:
type: string
content_type:
type: string
disposition:
type: string
enum:
- inline
- attachment
uuid:
type: string
url:
type: string
thumbnail_url:
type: string
MessageAuthor:
type: object
properties:
id:
type: integer
first_name:
type: string
last_name:
type: string
email:
type: string
format: email
nullable: true
avatar_url:
type: string
nullable: true
availability_status:
type: string
type:
type: string
enum:
- agent
- contact
- visitor
- ai_assistant
last_active_at:
type: string
format: date-time
nullable: true
securitySchemes:
basicAuth:
type: http
scheme: basic
description: >-
Basic authentication using base64 encoded API key and secret. Format:
`Authorization: Basic <base64(api_key:api_secret)>`
tokenAuth:
type: apiKey
name: Authorization
in: header
description: >-
Token authentication using API key and secret. Format: `Authorization:
token api_key:api_secret`
