## IP sites (`ip-sites`)

Sites served on IPs with custom ports; the IPs must first be selected in the user package.

Authentication: User (some parameters admin only) · Docs: https://www-demo.kuxitong.com/en/docs/api/ip-sites

### GET `/api/v2/ip-sites`

List IP sites · Authentication: User (some parameters 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` |
| `tenant_id` | integer |  | Admin only: filter by tenant. Ignored for tenant credentials, which only see their own tenant's data |
| `upid` | integer |  | Filter by user package. |

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

### POST `/api/v2/ip-sites`

Create IP site · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `tenant_id` | integer |  | Admin only: filter by tenant. Ignored for tenant credentials, which only see their own tenant's data |

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `config` | object |  | Node configuration fields (same as the site config; kind is always ip, and listen_addrs is derived from the bindings at publish time). |
| `enabled` | boolean |  | Whether enabled |
| `ip_ids` | integer[] |  | IDs of the bound pool IPs, in order. |
| `name` | string |  | Name |
| `origins` | IpSiteOrigin[] |  | Origin servers. |
| `stop_code` | integer |  | 0 = normal; non-zero = every request returns this status code (set by admins or billing). |
| `upid` | integer |  | User package ID. |

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

### GET `/api/v2/ip-sites/available-ips`

IP site available IPs · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `upid` | integer | Yes | User package ID. |
| `scope` | string |  | pool = the whole pool; mine = only the IPs already selected. Values: ["pool","mine"] Default: "pool" |
| `tenant_id` | integer |  | Admin only: filter by tenant. Ignored for tenant credentials, which only see their own tenant's data |

```sh
curl "https://panel.example.com/api/v2/ip-sites/available-ips" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/ip-sites/port-check`

IP site port pre-check · Authentication: User (some parameters admin only)

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `tenant_id` | integer |  | Admin only: filter by tenant. Ignored for tenant credentials, which only see their own tenant's data |

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `http_ports` | integer[] |  | HTTP ports to check; ports outside 1-65535 are not rejected but reported as range. |
| `https_ports` | integer[] |  | HTTPS ports to check; ports outside 1-65535 are not rejected but reported as range. |
| `ip_ids` | integer[] | Yes | IDs of the bound pool IPs, in order. |
| `site_id` | integer |  | Pass when editing a site: ports held by this site itself are not counted as occupied. |
| `upid` | integer | Yes | User package ID. |

```sh
curl -X POST "https://panel.example.com/api/v2/ip-sites/port-check" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### GET `/api/v2/ip-sites/{id}`

Get IP site · Authentication: User (some parameters admin only)

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

### PUT `/api/v2/ip-sites/{id}`

Update IP site · Authentication: User (some parameters admin only)

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `config` | object |  | Node configuration fields (same as the site config; kind is always ip, and listen_addrs is derived from the bindings at publish time). |
| `enabled` | boolean |  | Whether enabled |
| `ip_ids` | integer[] |  | IDs of the bound pool IPs, in order. |
| `name` | string |  | Name |
| `origins` | IpSiteOrigin[] |  | Origin servers. |
| `stop_code` | integer |  | 0 = normal; non-zero = every request returns this status code (set by admins or billing). |
| `upid` | integer |  | User package ID. |

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

### DELETE `/api/v2/ip-sites/{id}`

Delete IP site · Authentication: User (some parameters admin only)

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

IP sites object:

| Field | Type | Required | Description |
|---|---|---|---|
| `access_addrs` | string[] |  | Access address in ip:port form. (read-only) |
| `config` | object |  | Node configuration fields (same as the site config; kind is always ip, and listen_addrs is derived from the bindings at publish time). |
| `created_at` | string |  | Created at (read-only) |
| `enabled` | boolean |  | Whether enabled |
| `hints` | string[] |  | Hints (e.g. the node reported no listening ports, so that check was skipped). (read-only) |
| `http_ports` | integer[] |  | HTTP ports to check; ports outside 1-65535 are not rejected but reported as range. |
| `https_ports` | integer[] |  | HTTPS ports to check; ports outside 1-65535 are not rejected but reported as range. |
| `id` | integer |  | Record ID (read-only) |
| `ip_ids` | integer[] |  | IDs of the bound pool IPs, in order. |
| `ips` | IpSiteIp[] |  | Details of the bound pool IPs. (read-only) |
| `items` | AvailableIp[] |  | Items on this page |
| `name` | string |  | Name |
| `origins` | IpSiteOrigin[] |  | Origin servers. |
| `ports` | object[] |  | Per-port check results. |
| `site_id` | integer |  | Pass when editing a site: ports held by this site itself are not counted as occupied. |
| `stop_code` | integer |  | 0 = normal; non-zero = every request returns this status code (set by admins or billing). |
| `tenant_id` | integer |  | Owner tenant (user) ID (read-only) |
| `updated_at` | string |  | Updated at (read-only) |
| `upid` | integer |  | User package ID. |
