# Get Ticket

> Get the detail of a support ticket by its ID.

## Endpoint

| Environment | URL |
| --- | --- |
| Production | `https://online-gateway.ghn.vn/shiip/public-api/ticket/detail` |
| Staging | `https://dev-online-gateway.ghn.vn/shiip/public-api/ticket/detail` |

**Method**: `GET`

## Headers

| Header | Required | Description |
| --- | --- | --- |
| `Token` | Yes | Shop token (issued by GHN). Your account must also hold the ticket permission — [get a token](https://developer.ghn.vn/en/docs/token/get-token.md) |
| `ShopId` | No | Shop ID (int). Defaults to your account's main shop. The ticket is only viewable when it belongs to the resolved shop's account — to view a ticket of a non-default shop, send its `ShopId` |

## Parameters

- **ticket_id** (Int): Ticket ID returned by [Create Ticket](https://developer.ghn.vn/en/docs/ticket/create.md). Passed as a query parameter. Must reference an existing ticket that belongs to the acting shop's account, otherwise HTTP 404

## Request Example

```bash
curl -X GET "https://dev-online-gateway.ghn.vn/shiip/public-api/ticket/detail?ticket_id=1234567" \
  -H "Token: 5c1d8a9e-2f4b-11ed-..." \
  -H "ShopId: 92837"
```

## Response

`data` is the ticket object. `conversations` contains only the **public** entries — internal notes are filtered out.

### Success (HTTP 200)

```json
{
  "code": 200,
  "message": "Success",
  "data": {
    "id": 1234567,
    "type": "Tư vấn",
    "reason": "Need advice on the delivery time",
    "order_code": "LADH94",
    "description": "Need advice on the delivery time",
    "status": "Chờ KH phản hồi",
    "status_id": 2,
    "client_id": "2509893",
    "shop_id": "196560",
    "created_at": "2026-07-15T04:49:47Z",
    "created_by": 45678,
    "updated_at": "2026-07-15T05:10:00Z",
    "conversations": [
      {
        "body": "We deliver between 8am and 12pm. Is that suitable?",
        "from_email": "cskh@ghn.vn",
        "user_id": 45678,
        "created_at": "2026-07-15T05:10:00Z",
        "updated_at": "2026-07-15T05:10:00Z"
      }
    ],
    "attachments": []
  }
}
```

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | Int | HTTP code (`200` on success) |
| `message` | String | Result message (`Success`) |
| `data.id` | Int | Ticket ID |
| `data.type` | String | Ticket category:<br>`Tư vấn`: advice<br>`Khiếu nại`: complaint<br>`Hối Giao/Lấy/Trả hàng`: urge delivery/pickup/return<br>`Thay đổi thông tin`: change information |
| `data.reason` | String | Ticket reason (omitted when empty) |
| `data.order_code` | String | Order code the ticket is about |
| `data.description` | String | Ticket description |
| `data.status` | String | Vietnamese status label matching `status_id` |
| `data.status_id` | Int | Ticket state:<br>`1`: `Đang xử lý` (in progress)<br>`2`: `Chờ KH phản hồi` (waiting for customer reply)<br>`3`: `Hoàn thành` (done) |
| `data.client_id` | String | Client ID owning the ticket (omitted when empty) |
| `data.shop_id` | String | Shop the ticket belongs to (omitted when empty) |
| `data.created_at` | String | Creation timestamp (RFC 3339) |
| `data.created_by` | Int | Internal user ID recorded as the requester |
| `data.updated_at` | String | Last-update timestamp (RFC 3339) |
| `data.conversations` | Object[] | Public conversation entries |
| `data.conversations[].body` | String | Entry content |
| `data.conversations[].from_email` | String | Sender email label (omitted when empty) |
| `data.conversations[].user_id` | Int | Internal user ID of the author (omitted when `0`) |
| `data.conversations[].attachments` | Array | Attachment descriptors (omitted when empty) |
| `data.conversations[].cc_emails` | String[] | CC list (omitted when empty) |
| `data.conversations[].bcc_emails` | String[] | BCC list (omitted when empty) |
| `data.conversations[].created_at` | String | Entry creation timestamp |
| `data.conversations[].updated_at` | String | Entry last-update timestamp |
| `data.attachments` | Array | Ticket-level attachment descriptors |

> **NOTE**
> Poll `status_id` for follow-ups: reply when it is `2` (waiting for customer reply).

### Error — ticket not found (HTTP 404)

_Captured from a real Staging-environment call (unknown ticket id)._

```json
{
  "code": 404,
  "message": "Không tìm thấy thông tin ticket này",
  "data": null
}
```

> **NOTE**
> This same 404 is also returned when GHN's support system fails to answer the lookup — treat it as "not found **or** temporarily unavailable" and retry once before concluding the ticket is gone.

## Error Codes

| Condition | HTTP | Meaning |
| --- | --- | --- |
| Missing `ticket_id` | 400 | The required `ticket_id` parameter is missing |
| Ticket not found (`Không tìm thấy thông tin ticket này`) | 404 | The ticket does not exist, or the backend lookup temporarily failed |
| Not authorized (`Bạn không có quyền xem ticket này`) | 403 | The ticket does not belong to the acting shop's account |
| No ticket permission (`Bạn không có quyền thực hiện thao tác...`) | 403 | Your account lacks the ticket permission — contact GHN |
