Retrieve Tickets

These endpoints read tickets and their comment threads. All require a Bearer token (see Tickets Overview).

List tickets

GET /company/tickets

Returns a paginated, enriched list of the company's tickets, plus total_rows and per-tab counts. The counts always reflect the full filtered set (ignoring the status filter) so tab labels stay accurate when switching between Active and Resolved.

Query parameters

ParamTypeRequiredDescription
pageinteger (≥ 1)optionalPage number.
limitinteger (≥ 1)optionalItems per page.
status_groupstring — active | resolvedoptionalFilter by tab. Ignored if status/ticket_status_id is present.
statusintegeroptionalFilter by a specific status ID (takes precedence over status_group).
ticket_status_idintegeroptionalAlias filter by status ID (takes precedence over status_group).
typeintegeroptionalFilter by ticket type ID.
ticket_type_idintegeroptionalAlias filter by ticket type ID.
carrier_idintegeroptionalFilter by carrier.
filterstringoptionalSearch by exact ticket ID.
tracking_numberstringoptionalFilter by shipment tracking number.
date_fromdate YYYY-MM-DDoptionalCreated-at lower bound (inclusive).
date_todate YYYY-MM-DDoptionalCreated-at upper bound (inclusive).
activeinteger (0/1)optionalFilter by whether the ticket type is active.
getCommentsbooleanoptionalWhen true, includes the full allComments thread per ticket.
curl --request GET \
  --url 'https://queries.envia.com/company/tickets?status_group=active&limit=50&getComments=true' \
  --header 'Authorization: Bearer YOUR_API_TOKEN'

Response 200

{
  "data": [
    {
      "id": 987654,
      "company_id": 4321,
      "ticket_type_id": 4,
      "ticket_type_name": "lost",
      "reference": "guide",
      "ticket_status_id": 1,
      "ticket_status_name": "pending",
      "ticket_status_color": "#F5A623",
      "ticket_class_name": "warning",
      "shipment_id": 123456,
      "tracking_number": "1Z999AA10123456784",
      "carrier": "DHL",
      "service": "Express",
      "comments": "The package never arrived.",
      "data": "{\"tracking_number\":\"1Z999AA10123456784\"}",
      "file_quantity": 0,
      "last_comment": {},
      "allComments": [],
      "created_at": "2026-07-08 10:15:00",
      "utc_created_at": "2026-07-08 16:15:00",
      "updated_at": "2026-07-08 10:15:00"
    }
  ],
  "total_rows": 1,
  "counts": { "active": 1, "resolved": 0 }
}

Selected response fields

FieldTypeDescription
idintegerTicket ID.
ticket_type_id / ticket_type_nameinteger / stringType of the ticket.
referencestringReference kind required by the type (guide, credit, legal-credit, or empty).
ticket_status_id / ticket_status_nameinteger / stringCurrent status.
ticket_status_color / ticket_class_namestringSuggested badge color / CSS variant.
shipment_id / tracking_numberinteger / stringLinked shipment, if any.
carrier / servicestringCarrier and service description.
datastring (JSON)Ticket variables serialized as JSON.
file_quantityintegerNumber of attached evidence files.
last_commentobjectMost recent comment (or {}).
allCommentsarrayFull thread — only when getComments=true.
countsobject{ active, resolved } totals for tab labels.

Get a single ticket

GET /company/tickets/{ticket_id}

Returns one ticket by ID, scoped to the company, using the same enriched shape as the list. Supports getComments to include the thread.

Path parameters

ParamTypeRequiredDescription
ticket_idinteger (≥ 1)yesThe ticket ID.

Query parameters

ParamTypeRequiredDescription
getCommentsbooleanoptionalInclude the full comment thread.
date_fromdate YYYY-MMoptionalOptional created-at lower bound.
date_todate YYYY-MMoptionalOptional created-at upper bound.
status_groupstring — active | resolvedoptionalOptional tab scoping.
curl --request GET \
  --url 'https://queries.envia.com/company/tickets/987654?getComments=true' \
  --header 'Authorization: Bearer YOUR_API_TOKEN'

Response 200 — same object shape as one item of List tickets.

Get ticket comments

GET /company/tickets/comments/{ticket_id}

Returns the paginated comment thread for a ticket. Admin author names are anonymized to first name + last initial (e.g. Maria G.).

Path parameters

ParamTypeRequiredDescription
ticket_idinteger (≥ 1)yesThe ticket ID.

Query parameters

ParamTypeRequiredDescription
pageinteger (≥ 1)optionalPage number.
limitinteger (≥ 1)optionalItems per page.
curl --request GET \
  --url 'https://queries.envia.com/company/tickets/comments/987654?limit=20' \
  --header 'Authorization: Bearer YOUR_API_TOKEN'

Response 200

{
  "data": [
    {
      "id": 55,
      "type": "admin",
      "description": "We are reviewing your case.",
      "status_id": 6,
      "status_name": "in_review",
      "created_by_name": "Maria G.",
      "created_at": "2026-07-08 11:00:00",
      "utc_created_at": "2026-07-08 17:00:00"
    }
  ],
  "total_rows": 1
}