# Tài liệu tham chiếu API: Hỗ trợ

Hỗ trợ: mọi thao tác của API v1 kèm scope cần có, tham số, ví dụ bằng curl, JavaScript và Python, cùng phản hồi. Xác thực, lỗi, phân trang, giới hạn tốc độ và tính idempotent nằm trong [tổng quan tài liệu API](/docs/api-reference); xem thêm [SDK](/docs/sdks) và [dòng lệnh](/docs/cli).

> Thử với khóa của bạn: tạo khóa API trong bảng điều khiển, chạy `export APIDLY_API_KEY=...` trong terminal rồi dán một ví dụ curl bên dưới. Giá trị trong ví dụ chỉ mang tính minh họa. Trang này không có ô nhập khóa.

Mô tả của các thao tác và trường lấy từ định nghĩa API và giữ nguyên tiếng Anh.

| Thao tác | Scope cần có | Tóm tắt |
| --- | --- | --- |
| `GET /support/tickets` | `read` | Phiếu hỗ trợ của tổ chức, hoạt động mới nhất trước |
| `POST /support/tickets` | `servers` | Mở một phiếu hỗ trợ |
| `GET /support/tickets/{id}` | `read` | Một phiếu cùng các tin nhắn của nó, cũ nhất trước |
| `POST /support/tickets/{id}/messages` | `servers` | Trả lời một phiếu |
| `POST /support/tickets/{id}/close` | `servers` | Đóng một phiếu |

### GET /support/tickets

Phiếu hỗ trợ của tổ chức, hoạt động mới nhất trước

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | không |  |
| `cursor` | query | string | không |  |
| `status` | query | `open` \| `pending` \| `closed` | không |  |

**Ví dụ yêu cầu (curl)**

```bash
curl "https://apidly.com/api/v1/support/tickets?limit=20" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.support.listTickets({ limit: 20 });
```

**Python (SDK)**

```python
client.support.list_tickets()
```

**Công cụ dòng lệnh:** `apidly support` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "tickets": [
    {
      "id": "example",
      "subject": "example",
      "category": "example",
      "status": "open",
      "priority": "example",
      "openedBy": "example",
      "createdAt": "2026-11-21T10:00:00.000Z",
      "updatedAt": "2026-11-21T10:00:00.000Z"
    }
  ],
  "nextCursor": "example"
}
```

Trạng thái lỗi: `400`, `401`, `403`, `429`.

### POST /support/tickets

Mở một phiếu hỗ trợ

Staff answer by e-mail and in the console. `priority` is `low`, `normal` or `high`. `serverId` is added to the text as the related server.

**Scope cần có:** `servers`

**Nội dung yêu cầu**

| Tên | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- |
| `subject` | string | có |  |
| `category` | string | không |  |
| `priority` | `low` \| `normal` \| `high` | không |  |
| `message` | string | có |  |
| `serverId` | string | không |  |

**Ví dụ yêu cầu (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/support/tickets" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"example","message":"example"}'
```

**JavaScript (SDK)**

```js
await apidly.support.createTicket({
  subject: "example",
  message: "example"
});
```

**Python (SDK)**

```python
client.support.create_ticket(subject="example", message="example")
```

**Công cụ dòng lệnh:** `apidly support` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (201)

```json
{
  "ticket": {
    "id": "example",
    "subject": "example",
    "category": "example",
    "status": "open",
    "priority": "example",
    "openedBy": "example",
    "createdAt": "2026-11-21T10:00:00.000Z",
    "updatedAt": "2026-11-21T10:00:00.000Z"
  }
}
```

Trạng thái lỗi: `400`, `401`, `403`, `429`.

### GET /support/tickets/{id}

Một phiếu cùng các tin nhắn của nó, cũ nhất trước

**Scope cần có:** `read`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `id` | path | string | có |  |

**Ví dụ yêu cầu (curl)**

```bash
curl "https://apidly.com/api/v1/support/tickets/support_example" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.support.getTicket("support_example");
```

**Python (SDK)**

```python
client.support.get_ticket("support_example")
```

**Công cụ dòng lệnh:** `apidly support` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "ticket": {
    "key": null
  }
}
```

Trạng thái lỗi: `401`, `403`, `404`, `429`.

### POST /support/tickets/{id}/messages

Trả lời một phiếu

Reopens the ticket. 409 `ticket_closed` on a closed ticket.

**Scope cần có:** `servers`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `id` | path | string | có |  |

**Nội dung yêu cầu**

| Tên | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- |
| `message` | string | có |  |

**Ví dụ yêu cầu (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/support/tickets/support_example/messages" \
  -H "Authorization: Bearer $APIDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message":"example"}'
```

**JavaScript (SDK)**

```js
await apidly.support.reply("support_example", "example");
```

**Python (SDK)**

```python
client.support.reply("support_example", message="example")
```

**Công cụ dòng lệnh:** `apidly support` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (201)

```json
{
  "message": {
    "key": null
  }
}
```

Trạng thái lỗi: `400`, `401`, `403`, `404`, `409`, `429`.

### POST /support/tickets/{id}/close

Đóng một phiếu

**Scope cần có:** `servers`

**Tham số**

| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
| --- | --- | --- | --- | --- |
| `id` | path | string | có |  |

**Ví dụ yêu cầu (curl)**

```bash
curl -X POST "https://apidly.com/api/v1/support/tickets/support_example/close" \
  -H "Authorization: Bearer $APIDLY_API_KEY"
```

**JavaScript (SDK)**

```js
await apidly.support.close("support_example");
```

**Python (SDK)**

```python
client.support.close("support_example")
```

**Công cụ dòng lệnh:** `apidly support` ([Tài liệu CLI](/docs/cli))

**Ví dụ phản hồi** (200)

```json
{
  "ok": false
}
```

Trạng thái lỗi: `401`, `403`, `404`, `429`.
