Skip to main content
GET
/
conversations
curl -X GET "https://api.ansa.so/conversations?agentId=agent_xxx&limit=10" \
  -H "Authorization: Bearer your-api-key"
{
  "data": [
    {
      "id": "conv_xxx",
      "agentId": "agent_xxx",
      "title": "Question about pricing",
      "messageCount": 5,
      "createdAt": "2024-01-22T14:30:00Z",
      "updatedAt": "2024-01-22T14:35:00Z"
    }
  ],
  "pagination": {
    "total": 150,
    "limit": 10,
    "offset": 0
  }
}

List Conversations

Get conversations for an agent.
agentId
string
required
Filter by agent ID
limit
number
Number of results (default: 20, max: 100)
offset
number
Pagination offset
curl -X GET "https://api.ansa.so/conversations?agentId=agent_xxx&limit=10" \
  -H "Authorization: Bearer your-api-key"
{
  "data": [
    {
      "id": "conv_xxx",
      "agentId": "agent_xxx",
      "title": "Question about pricing",
      "messageCount": 5,
      "createdAt": "2024-01-22T14:30:00Z",
      "updatedAt": "2024-01-22T14:35:00Z"
    }
  ],
  "pagination": {
    "total": 150,
    "limit": 10,
    "offset": 0
  }
}

Get Conversation

Get a single conversation with all messages.
GET /conversations/:id
id
string
required
Conversation ID
curl -X GET https://api.ansa.so/conversations/conv_xxx \
  -H "Authorization: Bearer your-api-key"
{
  "data": {
    "id": "conv_xxx",
    "agentId": "agent_xxx",
    "title": "Question about pricing",
    "messages": [
      {
        "id": "msg_1",
        "role": "user",
        "content": "What's your pricing?",
        "createdAt": "2024-01-22T14:30:00Z"
      },
      {
        "id": "msg_2",
        "role": "assistant",
        "content": "We offer three plans: Starter at $29/mo, Growth at $99/mo, and Pro at $299/mo.",
        "createdAt": "2024-01-22T14:30:05Z"
      }
    ],
    "createdAt": "2024-01-22T14:30:00Z"
  }
}

Delete Conversation

DELETE /conversations/:id
curl -X DELETE https://api.ansa.so/conversations/conv_xxx \
  -H "Authorization: Bearer your-api-key"

Add Feedback

Submit thumbs up/down feedback for a message.
POST /conversations/:id/feedback
messageId
string
required
The message to rate
rating
string
required
"up" or "down"
curl -X POST https://api.ansa.so/conversations/conv_xxx/feedback \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "messageId": "msg_2",
    "rating": "up"
  }'