## Lines (`lines`)

A resolution record in a node group, showing which DNS line and weight a node appears with; a line must be disabled before it can be deleted.

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

### GET `/api/v2/lines`

List lines · 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/lines" \
  -H "X-API-Key: $GOCDN_API_KEY"
```

### POST `/api/v2/lines`

Create line · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `dns_line` | string |  | DNS resolution line code (default = default line; carrier/region line codes are mapped by the DNS domain). |
| `enabled` | boolean |  | Whether enabled |
| `force` | boolean |  | Force the write and skip two safeguards (requires a second confirmation): when the line becomes an enabled primary line, its node must have applied its configuration and be at most one release behind (otherwise 422 node_config_behind); disabling the last enabled primary line of the node group or making it a backup (otherwise 422 last_primary_line). |
| `is_backup` | boolean |  | Backup IP; kept out of DNS normally and brought in or taken out automatically according to the node group's backup IP switch mode. |
| `is_backup_default` | boolean |  | Backup default line; when the node group has no default line in use, this line is automatically resolved on the default line instead, and switched back once one is in use again. |
| `node_group_id` | integer | Yes | ID of the node group this line belongs to. |
| `node_id` | integer | Yes | Node ID |
| `weight` | integer |  | Weight, 1 to 100; a larger weight receives a larger share of resolutions. |

```sh
curl -X POST "https://panel.example.com/api/v2/lines" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dns_line":"default","node_group_id":1,"node_id":1,"weight":1}'
```

### GET `/api/v2/lines/{id}`

Get line · Authentication: Admin only

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

### PUT `/api/v2/lines/{id}`

Update line · Authentication: Admin only

Request body:

| Field | Type | Required | Description |
|---|---|---|---|
| `dns_line` | string |  | DNS resolution line code (default = default line; carrier/region line codes are mapped by the DNS domain). |
| `enabled` | boolean |  | Whether enabled |
| `force` | boolean |  | Force the write and skip two safeguards (requires a second confirmation): when the line becomes an enabled primary line, its node must have applied its configuration and be at most one release behind (otherwise 422 node_config_behind); disabling the last enabled primary line of the node group or making it a backup (otherwise 422 last_primary_line). |
| `is_backup` | boolean |  | Backup IP; kept out of DNS normally and brought in or taken out automatically according to the node group's backup IP switch mode. |
| `is_backup_default` | boolean |  | Backup default line; when the node group has no default line in use, this line is automatically resolved on the default line instead, and switched back once one is in use again. |
| `node_group_id` | integer |  | ID of the node group this line belongs to. |
| `node_id` | integer |  | Node ID |
| `weight` | integer |  | Weight, 1 to 100; a larger weight receives a larger share of resolutions. |

```sh
curl -X PUT "https://panel.example.com/api/v2/lines/{id}" \
  -H "X-API-Key: $GOCDN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":false}'
```

### DELETE `/api/v2/lines/{id}`

Delete line · Authentication: Admin only

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

Lines object:

| Field | Type | Required | Description |
|---|---|---|---|
| `backup_default_on` | boolean |  | Whether this backup default line is currently in effect and resolved on the default line (read-only, maintained by the scheduled job). (read-only) |
| `backup_on` | boolean |  | Whether this backup IP is currently in DNS (read-only, maintained by the scheduled job). (read-only) |
| `created_at` | string |  | Created at (read-only) |
| `disable_by` | string |  | Disable source (manual by admin, monitor by node monitoring, bandwidth for bandwidth limit, etc.); empty when enabled. |
| `dns_line` | string |  | DNS resolution line code (default = default line; carrier/region line codes are mapped by the DNS domain). |
| `enabled` | boolean |  | Whether enabled |
| `force` | boolean |  | Force the write and skip two safeguards (requires a second confirmation): when the line becomes an enabled primary line, its node must have applied its configuration and be at most one release behind (otherwise 422 node_config_behind); disabling the last enabled primary line of the node group or making it a backup (otherwise 422 last_primary_line). |
| `id` | integer |  | Record ID (read-only) |
| `is_backup` | boolean |  | Backup IP; kept out of DNS normally and brought in or taken out automatically according to the node group's backup IP switch mode. |
| `is_backup_default` | boolean |  | Backup default line; when the node group has no default line in use, this line is automatically resolved on the default line instead, and switched back once one is in use again. |
| `node_group_id` | integer |  | ID of the node group this line belongs to. |
| `node_id` | integer |  | Node ID |
| `updated_at` | string |  | Updated at (read-only) |
| `weight` | integer |  | Weight, 1 to 100; a larger weight receives a larger share of resolutions. |
