Managing shipping problems with tickets

Overview

Tickets represent support cases or issues associated with a shipment. Each tracker can have multiple tickets that help you track customer inquiries, delivery problems, or other issues that need attention.

This guide shows you how to:

  • Retrieve tickets associated with a tracker

  • Get a count of tickets

  • Navigate through paginated ticket results

Understanding Tickets

Tickets are support objects linked to trackers that contain:

  • Title: A brief description of the issue

  • Status: The current state of the ticket (OPEN, WAITING, CLOSED, etc.)

  • Priority: The urgency level of the ticket

  • Content: Detailed information about the issue

Each ticket is uniquely identified by a global ID in the format gid://kublau/Ticket/{uuid}.

Retrieve Tickets from a Tracker

You can retrieve tickets associated with a specific tracker using the tickets field. This field supports cursor-based pagination to efficiently handle trackers with many tickets.

Basic Example

Here's how to get the first 2 tickets from a tracker:

query {
  trackerByTrackingCode(trackingCode: "test", carrier: ESTAFETA) {
    trackingCode
    tickets(first: 2) {
      edges {
        node {
          id
          title
          status
          priority
          createdAt
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}

Response:

{
  "data": {
    "trackerByTrackingCode": {
      "trackingCode": "test",
      "tickets": {
        "edges": [
          {
            "node": {
              "id": "gid://kublau/Ticket/2664837a-7438-4d2a-8812-ecd598451f72",
              "title": "Package delayed at customs",
              "status": "OPEN",
              "priority": "HIGH",
              "createdAt": "2025-10-15T10:30:00Z"
            }
          },
          {
            "node": {
              "id": "gid://kublau/Ticket/baad1a01-feeb-4f97-a430-daf149e6239e",
              "title": "Customer requesting delivery update",
              "status": "OPEN",
              "priority": "NORMAL",
              "createdAt": "2025-10-14T15:20:00Z"
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "MQ",
          "endCursor": "Mg"
        }
      }
    }
  }
}

The pageInfo object tells you:

  • hasNextPage: Whether there are more tickets after the current page

  • hasPreviousPage: Whether there are tickets before the current page

  • startCursor: Cursor pointing to the first ticket in the result

  • endCursor: Cursor pointing to the last ticket in the result

Paginating Through Tickets

To retrieve the next page of tickets, use the after parameter with the endCursor from the previous response:

query {
  trackerByTrackingCode(trackingCode: "test", carrier: ESTAFETA) {
    tickets(first: 2, after: "Mg") {
      edges {
        node {
          id
          title
          status
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}

To navigate backwards, use the last and before parameters:

query {
  trackerByTrackingCode(trackingCode: "test", carrier: ESTAFETA) {
    tickets(last: 2, before: "Mw") {
      edges {
        node {
          id
          title
          status
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}

Getting Ticket Counts

To get the total number of tickets without fetching all the ticket data, use the ticketsCount field:

query {
  trackerByTrackingCode(trackingCode: "test", carrier: ESTAFETA) {
    trackingCode
    ticketsCount {
      count
      precision
    }
  }
}

Response:

{
  "data": {
    "trackerByTrackingCode": {
      "trackingCode": "test",
      "ticketsCount": {
        "count": 101,
        "precision": "EXACT"
      }
    }
  }
}

The ticketsCount object contains:

  • count: The number of tickets associated with the tracker

  • precision: Indicates whether the count is exact or approximate

Count Precision Values

Precision
Description

EXACT

The count is the exact number of tickets

APPROXIMATE

The count is an estimate (typically when exceeding 10,000 tickets)

Combining Count and Tickets

You can retrieve both the count and a page of tickets in a single query:

query {
  trackerByTrackingCode(trackingCode: "test", carrier: ESTAFETA) {
    trackingCode
    ticketsCount {
      count
      precision
    }
    tickets(first: 2) {
      edges {
        node {
          id
          title
          status
        }
      }
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}

Response:

{
  "data": {
    "trackerByTrackingCode": {
      "trackingCode": "test",
      "ticketsCount": {
        "count": 101,
        "precision": "EXACT"
      },
      "tickets": {
        "edges": [
          {
            "node": {
              "id": "gid://kublau/Ticket/2664837a-7438-4d2a-8812-ecd598451f72",
              "title": "Package delayed at customs",
              "status": "OPEN"
            }
          },
          {
            "node": {
              "id": "gid://kublau/Ticket/baad1a01-feeb-4f97-a430-daf149e6239e",
              "title": "Customer requesting delivery update",
              "status": "OPEN"
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "hasPreviousPage": false,
          "startCursor": "MQ",
          "endCursor": "Mg"
        }
      }
    }
  }
}

This approach is efficient because you get the total count for display purposes (e.g., "Showing 2 of 101 tickets") while fetching only the page of tickets you need.

Available Ticket Statuses

Status
Description

OPEN

Ticket is newly created and awaiting attention

CLOSED

Ticket is closed

DELETED

Ticket is closed and marked as non-applicable

WAITING

Ticket is waiting for further actions

Available Priority Levels

Priority
Description

UNKNOWN

A priority has not been assigned

LOW

Low priority, non-urgent issue

MEDIUM

Standard priority

HIGH

High priority, needs attention soon

Last updated

Was this helpful?