## 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-sa2.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 |  | Default line fallback; when the node group's default line has no usable IP, this line's IP is automatically resolved on the default line instead (its own line stops using it meanwhile), and switched back once the default line recovers. |
| `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 |
| `expected_updated_at` | string |  | Optimistic lock (used on update) - the updated_at of the resource as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. The scheduled jobs bringing backup IPs or the default line fallback in or out, and monitoring enabling or disabling the line, also change updated_at. |
| `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 |  | Default line fallback; when the node group's default line has no usable IP, this line's IP is automatically resolved on the default line instead (its own line stops using it meanwhile), and switched back once the default line recovers. |
| `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 the default line fallback is currently in use and this IP is 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, license for provider revocation, trial for trial ended, drain for node self-removal before a restart, 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 |
| `expected_updated_at` | string |  | Optimistic lock (used on update) - the updated_at of the resource as the caller read it. If it differs from the stored one, 409 stale_version is returned and nothing is saved; omit to skip the check. The scheduled jobs bringing backup IPs or the default line fallback in or out, and monitoring enabling or disabling the line, also change updated_at. |
| `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 |  | Default line fallback; when the node group's default line has no usable IP, this line's IP is automatically resolved on the default line instead (its own line stops using it meanwhile), and switched back once the default line recovers. |
| `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. |
