API ReferenceConversations API

Conversations API

Create and manage conversations with AI employees.

List Conversations

GET /conversations
curl -X GET "https://your-instance.elestio.app/api/v1/conversations" \
  -H "Authorization: Bearer YOUR_API_KEY"

Query parameters:

  • employee_id - Filter by employee
  • status - Filter by status (active, closed)
  • page - Page number for pagination

Create Conversation

POST /conversations
curl -X POST "https://your-instance.elestio.app/api/v1/conversations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "employee_id": "emp_abc123",
    "channel": "api",
    "metadata": {
      "customer_id": "cust_xyz",
      "source": "website"
    }
  }'

Send Message

POST /conversations/:id/messages
curl -X POST "https://your-instance.elestio.app/api/v1/conversations/conv_123/messages" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Hello, I need help with my order",
    "role": "user"
  }'

Response includes the AI employee's reply:

JSON Response
{
  "success": true,
  "data": {
    "user_message": {
      "id": "msg_001",
      "content": "Hello, I need help with my order",
      "role": "user",
      "created_at": "2024-01-15T10:30:00Z"
    },
    "assistant_message": {
      "id": "msg_002",
      "content": "Hi! I'd be happy to help you with your order. Could you please provide your order number?",
      "role": "assistant",
      "created_at": "2024-01-15T10:30:01Z"
    }
  }
}

Get Messages

GET /conversations/:id/messages
curl -X GET "https://your-instance.elestio.app/api/v1/conversations/conv_123/messages" \
  -H "Authorization: Bearer YOUR_API_KEY"

Close Conversation

POST /conversations/:id/close
curl -X POST "https://your-instance.elestio.app/api/v1/conversations/conv_123/close" \
  -H "Authorization: Bearer YOUR_API_KEY"

Conversation Object

FieldTypeDescription
idstringUnique identifier
employee_idstringAssigned employee
channelstringchat, email, voice, api, widget
statusstringactive or closed
metadataobjectCustom metadata
message_countintegerTotal messages
created_atdatetimeCreation timestamp