Search tickets

POST/v2/helpdesk/tickets/search

Find Helpdesk tickets by the words in their subject and messages, then narrow the results by status, priority, team, tag, channel and date.

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

Finds tickets by the words in their subject and messages, and returns each hit with a snippet. Call it to see which tickets mention an order number, a product or a complaint. To list tickets without a text query, use List tickets.

Request

POST /v2/helpdesk/tickets/search

Body fields:

Name Type Required Description
query string Yes The word or phrase to look for.
filters object No Narrows the search.
filters.status array of strings No One or more of open, pending, on_hold, solved and closed.
filters.priority array of strings No One or more of low, normal, high and urgent.
filters.teamId string No Only tickets of this team, starting with team_.
filters.assigneeId string No Only tickets owned by this member, starting with usr_.
filters.tags array of strings No Only tickets that carry all of these tags.
filters.channel array of strings No One or more channels, for example widget or email.
filters.from string No Only tickets created at or after this ISO 8601 UTC time.
filters.to string No Only tickets created before this ISO 8601 UTC time.
limit integer No Items per page, from 1 to 100. Defaults to 20.
cursor string No The nextCursor value from the previous page.

A short, specific query works best. Keep the same query, filters and limit when you pass a cursor.

Example request

curl -X POST https://api.askocto.co/v2/helpdesk/tickets/search \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "A-1042",
    "filters": { "status": ["open", "pending"], "tags": ["refund"] },
    "limit": 20
  }'
const response = await fetch("https://api.askocto.co/v2/helpdesk/tickets/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "A-1042",
    filters: { status: ["open", "pending"], tags: ["refund"] },
    limit: 20,
  }),
})

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

Example response

A successful call returns 200 OK.

{
  "data": [
    {
      "id": "tkt_4m8x2q",
      "subject": "Damaged jacket in order A-1042",
      "status": "open",
      "priority": "high",
      "assigneeId": "usr_6k9d2r",
      "teamId": "team_2c7h5v",
      "contactId": "con_9a3f1k",
      "tags": ["refund", "damaged"],
      "channel": "widget",
      "createdAt": "2026-03-20T14:05:00Z",
      "updatedAt": "2026-03-20T14:12:00Z",
      "matches": [
        {
          "messageId": null,
          "snippet": "Damaged jacket in order A-1042"
        },
        {
          "messageId": "msg_2h6j9d",
          "snippet": "Thanks for the photos of order A-1042. We are sending a replacement."
        }
      ]
    }
  ],
  "nextCursor": null
}

Response fields

Each item is a ticket object, with the fields described in the Helpdesk overview, plus one more field.

Name Type Description
data[].matches array Where the query was found. Each entry has a snippet with the text around the hit and a messageId. The messageId is null when the hit is in the subject.
nextCursor string or null Pass it as cursor for the next page. null on the last page.

Open a hit with Get a ticket or read its thread with List ticket messages.

Errors

Status Code When
400 invalid_request query is missing or empty, limit is outside 1 to 100, or a filter has an unknown value.
401 unauthorized The API key is missing, malformed or deleted.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

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