# List conversations > An agent's conversations from every channel in a date range, newest first, 20 per page `query_conversations` lists the conversations an agent had in a date range, from the Chat bubble, the API, WhatsApp, email and every other channel. Each row carries the conversation's channel, state, message counts, sentiment and AI summary, but not its messages. Filters narrow the list by channel, state, sentiment, topic, feedback, contact and escalation. ```http POST https://api.qwryai.com/public/v1/tools/query_conversations ``` ## Authentication Send your API key as `Authorization: Bearer `, or in an `x-api-key` header. The key needs **Manage conversations and helpdesk**. See [Authentication](/docs/api-reference/v2/authentication). ## Body parameters | Name | Type | Required | Description | | - | - | - | - | | `chatbotId` | `string` | Yes | The agent's id, from [List agents](/docs/api-reference/v2/agents/list-agents). | | `startDate` | `string` | Yes | Conversations created from this day, `YYYY-MM-DD` in UTC. | | `endDate` | `string` | Yes | Conversations created up to this day, included. At most 184 days after `startDate`. | | `page` | `integer` | Yes | The page, from `1`. | | `sources` | `string[]` | No | Channels, such as `web`, `api`, `whatsapp` or `email`. `get_conversation_facets` lists the values in use. | | `activity_states` | `string[]` | No | `ongoing`, `ended`, `taken_over` or `paused`. | | `sentiment` | `string[]` | No | Sentiment values, such as `positive`, `neutral` or `negative`. | | `topic`, `topics` | `string`, `string[]` | No | **Analytics** topic names. A topic includes its subtopics. | | `feedback` | `string` | No | `good` or `bad`. | | `contact` | `string` | No | Part of the contact's name or email, matched as written. | | `escalated` | `boolean` | No | `true` for conversations handed to a person, as in the **Inbox** **Escalated** view. | Different filters must all match; several values in one list match any of them. ## Request example > [tab] cURL > > ```bash > curl -X POST 'https://api.qwryai.com/public/v1/tools/query_conversations' \ > -H 'Authorization: Bearer YOUR_API_KEY' \ > -H 'Content-Type: application/json' \ > -d '{ > "chatbotId": "YOUR_AGENT_ID", > "startDate": "2026-11-01", > "endDate": "2026-11-30", > "page": 1, > "activity_states": ["ongoing"] > }' > ``` > [tab] JavaScript > > ```javascript > const response = await fetch("https://api.qwryai.com/public/v1/tools/query_conversations", { > method: "POST", > headers: { > Authorization: "Bearer YOUR_API_KEY", > "Content-Type": "application/json", > }, > body: JSON.stringify({ > chatbotId: "YOUR_AGENT_ID", > startDate: "2026-11-01", > endDate: "2026-11-30", > page: 1, > activity_states: ["ongoing"], > }), > }); > const { data } = await response.json(); > console.log(data.total, data.items.map((c) => c.metadata?.aiSummary)); > ``` > [tab] Python > > ```python > import requests > > response = requests.post( > "https://api.qwryai.com/public/v1/tools/query_conversations", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={ > "chatbotId": "YOUR_AGENT_ID", > "startDate": "2026-11-01", > "endDate": "2026-11-30", > "page": 1, > "activity_states": ["ongoing"], > }, > ) > data = response.json()["data"] > print(data["total"], data["hasMore"]) > ``` ## Response ```json { "success": true, "data": { "items": [ { "_id": "CONVERSATION_RECORD_ID", "conversationId": "fd5ae9e1-9b30-4503-b346-ccd4d7ef16a3", "channel": "api", "source": "api", "lifecycle": "open", "routingState": "none", "metadata": { "aiSummary": "Customer asked to change the delivery address on order 1042.", "aiSummaryUpdatedAt": "2026-11-30T19:26:02.118Z" }, "timestamps": { "created": "2026-11-30T19:23:43.046Z", "lastActivity": "2026-11-30T19:24:45.362Z" }, "metrics": { "messageCount": 4, "aiMessageCount": 2, "agentMessageCount": 0 }, "insights": { "sentiment": "neutral" } } ], "total": 1, "page": 1, "hasMore": false, "range": { "startDate": "2026-11-01", "endDate": "2026-11-30", "page": 1, "activityStates": ["ongoing"] }, "timezone": "UTC" } } ``` | Field | Description | | - | - | | `items[]._id` | The id the conversation tools take as `conversationId`, such as [Get a conversation](/docs/api-reference/v2/conversations/get-a-conversation). | | `items[].conversationId` | The id the Chat API uses. | | `items[].channel` | Where the conversation happened, such as `web`, `api` or `whatsapp`. | | `items[].lifecycle` | `open` while it's going on, `resolved` once it ends. | | `items[].routingState` | Whether it's waiting for, or with, a person. `none` while the AI handles it. | | `items[].metadata.aiSummary` | QwryAI's one-line summary, once it has one. | | `items[].timestamps` | When it started and when it was last active. | | `items[].metrics` | Message counts in total, from the AI, and from your team. | | `items[].rating` | The customer's `good` or `bad` rating, when there is one. | | `items[].insights` | `sentiment` and `topicIds`, once analysed. | | `total` | Conversations that match, across all pages. | | `hasMore` | `true` when there's another page. | Rows come newest first. Raise `page` until `hasMore` is `false`; see [Pagination](/docs/api-reference/v2/pagination). ## Errors | HTTP status | Code | When | | - | - | - | | 400 | `INVALID_ARGUMENTS` | A required argument is missing, a date isn't `YYYY-MM-DD`, or a filter value isn't allowed. `issues` lists each one. | | 400 | `CHATBOT_ID_REQUIRED` | The body has no valid `chatbotId`. | | 401 | `API_KEY_REQUIRED` / `INVALID_API_KEY` | No credential, or an unknown, deleted or expired one. | | 403 | `INSUFFICIENT_PERMISSION` | The key doesn't hold **Manage conversations and helpdesk**. | | 404 | `CHATBOT_NOT_FOUND` | No agent with that `chatbotId` in your workspace. | | 409 | `VALIDATION_INVALID_BODY` | `endDate` is before `startDate`, or the range is longer than 184 days. | | 413 | `RESULT_TOO_LARGE` | The page is over 40,000 bytes. Narrow the filters or the dates. | | 429 | `INTEGRATION_RATE_LIMIT_EXCEEDED` | More than 2,000 requests in 15 minutes. | See [Error Handling](/docs/api-reference/v2/error-handling) for every code.