# เอกสารอ้างอิง API: ฝ่ายสนับสนุน

ฝ่ายสนับสนุน: ทุกการดำเนินการของ API v1 พร้อมสโคปที่ต้องใช้ พารามิเตอร์ ตัวอย่างใน curl, JavaScript และ Python และผลลัพธ์ที่ได้ การยืนยันตัวตน ข้อผิดพลาด การแบ่งหน้า ขีดจำกัด และ idempotency อยู่ใน[ภาพรวมเอกสารอ้างอิง API](/docs/api-reference) ดูเพิ่มเติมที่ [SDK](/docs/sdks) และ[บรรทัดคำสั่ง](/docs/cli)

> ลองใช้กับคีย์ของคุณ: สร้างคีย์ API ในคอนโซล รัน `export APIDLY_API_KEY=...` ในเทอร์มินัล แล้ววางตัวอย่าง curl ด้านล่าง ค่าในตัวอย่างเป็นเพียงภาพประกอบ หน้านี้ไม่มีช่องให้กรอกคีย์

คำอธิบายของการดำเนินการและฟิลด์มาจากนิยามของ API และเป็นภาษาอังกฤษ

| การดำเนินการ | สโคปที่ต้องใช้ | สรุป |
| --- | --- | --- |
| `GET /support/tickets` | `read` | ตั๋วสนับสนุนขององค์กร กิจกรรมล่าสุดก่อน |
| `POST /support/tickets` | `servers` | เปิดตั๋วสนับสนุน |
| `GET /support/tickets/{id}` | `read` | ตั๋วหนึ่งใบพร้อมข้อความ เก่าสุดก่อน |
| `POST /support/tickets/{id}/messages` | `servers` | ตอบตั๋ว |
| `POST /support/tickets/{id}/close` | `servers` | ปิดตั๋ว |

### GET /support/tickets

ตั๋วสนับสนุนขององค์กร กิจกรรมล่าสุดก่อน

**สโคปที่ต้องใช้:** `read`

**พารามิเตอร์**

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | ไม่ |  |
| `cursor` | query | string | ไม่ |  |
| `status` | query | `open` \| `pending` \| `closed` | ไม่ |  |

**ตัวอย่างคำขอ (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()
```

**เครื่องมือบรรทัดคำสั่ง:** `apidly support` ([เอกสารอ้างอิง CLI](/docs/cli))

**ตัวอย่างผลลัพธ์** (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"
}
```

สถานะข้อผิดพลาด: `400`, `401`, `403`, `429`.

### POST /support/tickets

เปิดตั๋วสนับสนุน

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.

**สโคปที่ต้องใช้:** `servers`

**เนื้อหาคำขอ**

| ชื่อ | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- |
| `subject` | string | ใช่ |  |
| `category` | string | ไม่ |  |
| `priority` | `low` \| `normal` \| `high` | ไม่ |  |
| `message` | string | ใช่ |  |
| `serverId` | string | ไม่ |  |

**ตัวอย่างคำขอ (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")
```

**เครื่องมือบรรทัดคำสั่ง:** `apidly support` ([เอกสารอ้างอิง CLI](/docs/cli))

**ตัวอย่างผลลัพธ์** (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"
  }
}
```

สถานะข้อผิดพลาด: `400`, `401`, `403`, `429`.

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

ตั๋วหนึ่งใบพร้อมข้อความ เก่าสุดก่อน

**สโคปที่ต้องใช้:** `read`

**พารามิเตอร์**

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `id` | path | string | ใช่ |  |

**ตัวอย่างคำขอ (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")
```

**เครื่องมือบรรทัดคำสั่ง:** `apidly support` ([เอกสารอ้างอิง CLI](/docs/cli))

**ตัวอย่างผลลัพธ์** (200)

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

สถานะข้อผิดพลาด: `401`, `403`, `404`, `429`.

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

ตอบตั๋ว

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

**สโคปที่ต้องใช้:** `servers`

**พารามิเตอร์**

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `id` | path | string | ใช่ |  |

**เนื้อหาคำขอ**

| ชื่อ | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- |
| `message` | string | ใช่ |  |

**ตัวอย่างคำขอ (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")
```

**เครื่องมือบรรทัดคำสั่ง:** `apidly support` ([เอกสารอ้างอิง CLI](/docs/cli))

**ตัวอย่างผลลัพธ์** (201)

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

สถานะข้อผิดพลาด: `400`, `401`, `403`, `404`, `409`, `429`.

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

ปิดตั๋ว

**สโคปที่ต้องใช้:** `servers`

**พารามิเตอร์**

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `id` | path | string | ใช่ |  |

**ตัวอย่างคำขอ (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")
```

**เครื่องมือบรรทัดคำสั่ง:** `apidly support` ([เอกสารอ้างอิง CLI](/docs/cli))

**ตัวอย่างผลลัพธ์** (200)

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

สถานะข้อผิดพลาด: `401`, `403`, `404`, `429`.
