Conversation search

Find Askocto conversations by what was said, then narrow the results by status, channel and date with the conversation search endpoint.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Conversation search finds conversations by the words in their messages. Listing a conversation set tells you which conversations exist. Search tells you which of them mention a topic, such as a product, a promo code or a complaint.

Search or list

You want Use
Every conversation of an agent, newest first List conversations
Conversations that mention a phrase Search conversations
One conversation you already know Get a conversation

Send a POST request with a query and, if you like, filters:

curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/conversations/search \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "refund",
    "filters": {
      "status": ["handoff"],
      "channel": ["widget"],
      "from": "2026-03-01T00:00:00Z"
    },
    "limit": 20
  }'
const response = await fetch(
  "https://api.askocto.co/v2/agents/agt_8f3k2m/conversations/search",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      query: "refund",
      filters: { status: ["handoff"], channel: ["widget"], from: "2026-03-01T00:00:00Z" },
      limit: 20,
    }),
  },
)

const { data, nextCursor } = await response.json()
for (const item of data) {
  console.log(item.id, item.matches[0].snippet)
}

Read the results

Each item is a conversation object with a matches array. A match names the message and shows the text around the hit:

{
  "data": [
    {
      "id": "conv_5n2p8w",
      "agentId": "agt_8f3k2m",
      "userId": "usr_3b6t0z",
      "channel": "widget",
      "status": "handoff",
      "messageCount": 6,
      "createdAt": "2026-03-20T13:58:00Z",
      "updatedAt": "2026-03-20T14:05:00Z",
      "matches": [
        {
          "messageId": "msg_4w7e1b",
          "snippet": "I would like a refund for the jacket, it arrived damaged."
        }
      ]
    }
  ],
  "nextCursor": null
}

Results use the cursor pagination of every v2 list. Pass nextCursor as cursor to get the next page, see Pagination.

Filters

  • status: one or more of open, resolved and handoff.
  • channel: one or more channels, for example widget or whatsapp.
  • from and to: an ISO 8601 UTC time range for when the conversation was created.

Filters narrow the search. Leave them out to search every conversation of the agent.

Tips

  • Search for one clear word or phrase. A short, specific query works better than a whole sentence.
  • Use search to find gaps. A search for "not working" with status handoff shows where customers needed a person, which tells you what to add to your sources or procedures.
  • To read a full conversation after a hit, call List conversation messages with the id.

Something unclear or missing? Tell us and we will fix the page.