## Add-ons (`package-upgrades`)

Quotas or features bought per unit on top of a base package.

Authentication: Admin only · Docs: https://www-sa2.kuxitong.com/en/docs/api/package-upgrades

### GET `/api/v2/package-upgrades`

List add-ons · Authentication: Admin only

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `page` | integer |  | Page number, starting from 1 Default: 1 |
| `page_size` | integer |  | Items per page Default: 20 |
| `sort` | string |  | Sort fields, comma-separated; prefix `-` for descending, e.g. `-created_at,id` |

```sh
curl "https://panel.example.com/api/v2/package-upgrades" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/package-upgrades`

Create add-on · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `amount` | integer |  | Amount added per unit; always 1 for feature items (custom_cc_rule/websocket). |
| `bind_packages` | integer[] |  | Only these base packages may buy it; empty = no restriction. |
| `des` | string |  | Description |
| `enabled` | boolean |  | Whether enabled |
| `name` | string | Yes | Name |
| `price_cents` | integer | Yes | Price per unit per month, in cents. |
| `prices` | UpgradePrice[] |  | Per-currency prices; must include the base-currency row (mode=base, its price = price_cents). mode=manual uses the fixed price, mode=auto is derived from the base price at the current rate. Omit prices on write to leave non-base rows untouched. The package catalog (/package-catalog) uses the purchase view: missing currencies are filled in as auto rows priced at the current rate, and currencies whose rate is not ready are left out; the admin endpoints return only the stored rows. |
| `type` | string | Yes | Add-on item: traffic GB, domains, non-standard ports, TCP/UDP forwarding ports, custom CC, bandwidth Mbps, connections, WebSocket, dedicated IPs. Values: ["traffic","domain","http_port","stream_port","custom_cc_rule","bandwidth","connection","websocket","ip_num"] |

```sh
curl -X POST "https://panel.example.com/api/v2/package-upgrades" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":10,"name":"域名 +10","price_cents":1000,"type":"domain"}'
```

### GET `/api/v2/package-upgrades/{id}`

Get add-on · Authentication: Admin only

```sh
curl "https://panel.example.com/api/v2/package-upgrades/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### PUT `/api/v2/package-upgrades/{id}`

Update add-on · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `amount` | integer |  | Amount added per unit; always 1 for feature items (custom_cc_rule/websocket). |
| `bind_packages` | integer[] |  | Only these base packages may buy it; empty = no restriction. |
| `des` | string |  | Description |
| `enabled` | boolean |  | Whether enabled |
| `name` | string | Yes | Name |
| `price_cents` | integer | Yes | Price per unit per month, in cents. |
| `prices` | UpgradePrice[] |  | Per-currency prices; must include the base-currency row (mode=base, its price = price_cents). mode=manual uses the fixed price, mode=auto is derived from the base price at the current rate. Omit prices on write to leave non-base rows untouched. The package catalog (/package-catalog) uses the purchase view: missing currencies are filled in as auto rows priced at the current rate, and currencies whose rate is not ready are left out; the admin endpoints return only the stored rows. |
| `type` | string | Yes | Add-on item: traffic GB, domains, non-standard ports, TCP/UDP forwarding ports, custom CC, bandwidth Mbps, connections, WebSocket, dedicated IPs. Values: ["traffic","domain","http_port","stream_port","custom_cc_rule","bandwidth","connection","websocket","ip_num"] |

```sh
curl -X PUT "https://panel.example.com/api/v2/package-upgrades/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":10,"name":"域名 +10","price_cents":1000,"type":"domain"}'
```

### DELETE `/api/v2/package-upgrades/{id}`

Delete add-on · Authentication: Admin only

```sh
curl -X DELETE "https://panel.example.com/api/v2/package-upgrades/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

Add-ons object:

| Field | Type | Required | Description |
|---|---|---|---|
| `active_count` | integer |  | Units in use, summed over unexpired user packages. Returned by the admin list only. (read-only) |
| `amount` | integer |  | Amount added per unit; always 1 for feature items (custom_cc_rule/websocket). |
| `bind_packages` | integer[] |  | Only these base packages may buy it; empty = no restriction. |
| `created_at` | string |  | Created at (read-only) |
| `des` | string |  | Description |
| `enabled` | boolean |  | Whether enabled |
| `id` | integer |  | Record ID (read-only) |
| `name` | string |  | Name |
| `price_cents` | integer |  | Price per unit per month, in cents. |
| `prices` | UpgradePrice[] |  | Per-currency prices; must include the base-currency row (mode=base, its price = price_cents). mode=manual uses the fixed price, mode=auto is derived from the base price at the current rate. Omit prices on write to leave non-base rows untouched. The package catalog (/package-catalog) uses the purchase view: missing currencies are filled in as auto rows priced at the current rate, and currencies whose rate is not ready are left out; the admin endpoints return only the stored rows. |
| `recent_30d` | integer |  | Units bought in the last 30 days, summed over add-on orders (free add-ons not counted). Returned by the admin list only. (read-only) |
| `type` | string |  | Add-on item: traffic GB, domains, non-standard ports, TCP/UDP forwarding ports, custom CC, bandwidth Mbps, connections, WebSocket, dedicated IPs. Values: ["traffic","domain","http_port","stream_port","custom_cc_rule","bandwidth","connection","websocket","ip_num"] |
| `updated_at` | string |  | Updated at (read-only) |
| `user_package_count` | integer |  | Number of user packages that have bought this add-on, expired ones included; above 0 it cannot be deleted, only disabled. Returned by the admin list only. (read-only) |
