## IP pools (`ip-pools`)

IP pools and the IPs inside them, maintained by admins. A pool belongs to a region and its name is unique platform-wide.

Authentication: Admin only · Docs: https://www-demo.kuxitong.com/en/docs/api/ip-pools

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

List IP pools · 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` |
| `region_id` | integer |  | Filter by region. |

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

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

Create IP pool · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `des` | string |  | Description |
| `name` | string | Yes | Name |
| `region_id` | integer | Yes | Region ID |

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

### GET `/api/v2/ip-pools/candidates`

IP pool candidate node IPs · Authentication: Admin only

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `region_id` | integer | Yes | Region ID. |

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

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

Get IP pool · Authentication: Admin only

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

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

Update IP pool · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `des` | string |  | Description |
| `name` | string | Yes | Name |
| `region_id` | integer | Yes | Region ID |

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

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

Delete IP pool · Authentication: Admin only

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

### GET `/api/v2/ip-pools/{id}/refs`

IP pool referencing sites · Authentication: Admin only

Query parameters:

| Field | Type | Required | Description |
|---|---|---|---|
| `ip_id` | integer |  | Show only this pool IP. |
| `limit` | integer |  | Maximum number of sites listed per IP. Default: 20 |

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

### GET `/api/v2/ip-pools/{pool_id}/ips`

List IPs in pool · 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/ip-pools/{pool_id}/ips" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/ip-pools/{pool_id}/ips`

Add IP to pool · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `bind_addr` | string |  | The local address the node actually listens on (NAT setups); null means use ip. |
| `node_id` | integer | Yes | Node ID |

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

### PUT `/api/v2/ip-pools/{pool_id}/ips/{id}`

Update pool IP · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `bind_addr` | string |  | The local address the node actually listens on (NAT setups); null means use ip. |
| `enabled` | boolean |  | Whether enabled |

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

### DELETE `/api/v2/ip-pools/{pool_id}/ips/{id}`

Remove IP from pool · Authentication: Admin only

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

### POST `/api/v2/ip-pools/{pool_id}/ips/{id}/issue-cert`

Issue platform certificate for pool IP · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | boolean |  | Confirm re-issuing when a valid certificate already exists. |

```sh
curl -X POST "https://panel.example.com/api/v2/ip-pools/{pool_id}/ips/{id}/issue-cert" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

IP pools object:

| Field | Type | Required | Description |
|---|---|---|---|
| `bind_addr` | string |  | The local address the node actually listens on (NAT setups); null means use ip. |
| `cert` | IpCertState |  | Platform IP certificate status. |
| `confirm` | boolean |  | Confirm re-issuing when a valid certificate already exists. |
| `created_at` | string |  | Created at (read-only) |
| `des` | string |  | Description |
| `enabled` | boolean |  | Whether enabled |
| `hints` | string[] |  | Hints (e.g. the node reported no NIC addresses, so the pool entry was not verified). (read-only) |
| `id` | integer |  | Record ID (read-only) |
| `ip` | string |  | IP address. (read-only) |
| `ip_count` | integer |  | Number of IPs in the pool. (read-only) |
| `ips` | object[] |  | Pool IPs that have references, with their referencing sites. |
| `items` | IpCandidate[] |  | Items on this page |
| `name` | string |  | Name |
| `node_id` | integer |  | Node ID |
| `node_name` | string |  | Name of the node that owns the IP. (read-only) |
| `node_state` | IpNodeState |  | State of the owning primary node: disabled if the node is disabled; otherwise online if a heartbeat arrived in the last 2 minutes, else offline. Values: ["online","offline","disabled"] |
| `pool_id` | integer |  | ID of the IP pool it belongs to. (read-only) |
| `region_id` | integer |  | Region ID |
| `region_name` | string |  | Region name. (read-only) |
| `site_count` | integer |  | Number of IP sites referencing IPs in the pool (deduplicated by site). (read-only) |
| `updated_at` | string |  | Updated at (read-only) |
