CLICD remains compatible with legacy `/api` endpoints, so existing integrations do not need to change. New integrations should use `/api/v1`; the list below is all v1, and the recommended container list endpoint is `GET /api/v1/containers`.
## Authentication
API keys can be created and managed from the API Integration page. Requests support either of these headers:
Most JSON endpoints return `success` and optional `message` and `data` fields. Check the HTTP status first. Backup downloads return an archive body rather than JSON.
Integrations should read only the business fields they need. New capabilities are added as optional fields where possible, without requiring existing plugins to rename current fields.
Container creation and batch creation can configure NAT and public IPv4/IPv6 together. Reinstall and batch reinstall change the installed image and accept Linux SSH login options. Public IPv4/IPv6 pools can be viewed with `GET /api/v1/routing` and updated with `PUT /api/v1/routing`.
`privileged` and `nesting` are LXC-only options and both default to `false` when omitted. `nesting=true` enables the capabilities needed by Docker, LXC-in-LXC, and some systemd workloads. `privileged=true` creates a privileged container with weaker isolation; it is restricted to administrators and should be used only for trusted workloads. Existing instances cannot switch either mode in place. Setting either option to `true` for a KVM request returns `400`; requesting a privileged LXC as a non-administrator returns `403`.
For batch creation, put the same options in the corresponding `containers[]` item. Container list and detail responses expose the effective state as `lxc_privileged` and `lxc_nesting`. These fields use `omitempty`, so a disabled state may be absent from JSON.
Generic KVM creation limits are `vcpu >= 1`, `ram_mb >= 1024`, and `disk_gb >= 10`; an image-specific minimum disk requirement can be higher.
After creation, use `GET /api/v1/containers` or `GET /api/v1/containers/{id|uuid|name}` to read the effective state. For LXC, read `lxc_privileged` and `lxc_nesting`; because empty values are omitted, clients should treat an absent field as `false`.
`keep` is only for reinstall and keeps the current SSH password. Windows KVM images ignore Linux SSH public key fields. When creating a VM with a manual ISO, select the image ID as `template_id` and complete installation through the console.
`PUT /api/v1/containers/{id}/resource-limit` supports partial updates. Fields omitted from the request remain unchanged.
```json
{
"vcpu":2,
"ram_mb":1024,
"network_down_mbps":100,
"network_up_mbps":50,
"io_read_mbps":120,
"io_write_mbps":80
}
```
Legacy `network_bw_mbps` and `io_speed_mbps` are still accepted. They mean symmetric downlink/uplink bandwidth and symmetric read/write I/O limits. New integrations should use the split fields to control download/upload and read/write independently.
Read container firewall settings with `GET /api/v1/containers/{id}/firewall` and update them with `PUT /api/v1/containers/{id}/firewall`. Updates are applied immediately when the container is running. Fields can be updated independently. A supplied `rules` array replaces the existing list. Set `rules[].enabled` to `true` for rules that should take effect.
`POST /api/v1/api-keys` and `PATCH /api/v1/api-keys/{id}` use the same field shape. `name` is required on creation. On update, send the existing `ip_whitelist`, `expires_at`, `disabled` and `container_uuids` values if you want to keep them. Omitted restrictions are cleared and an omitted `disabled` becomes `false`. An empty or omitted `name` or `scopes` preserves its current value.
The plaintext `data.key` is returned only on creation. API key management scopes are global. A key with `apikey:create` or `apikey:update` can set any scopes, including `*`, and any container restrictions. Reserve these scopes for trusted administrators.
Use `GET /api/v1/access-policy` to read the panel source allowlist and `PUT /api/v1/access-policy` to update it. Both endpoints require `admin:access`. The policy covers panel pages, login endpoints and API requests, including public endpoints and ticket downloads.
Both lists accept IPv4, IPv6, and CIDR values. The backend only uses `X-Forwarded-For`, `X-Real-IP`, or `CF-Connecting-IP` when the direct peer matches `trusted_proxies`, so untrusted clients cannot bypass the policy by spoofing those headers. An enabled policy requires at least one allowed source, and the API rejects changes that exclude the current administrator source. Direct loopback access remains available as a CLI/SSH recovery path.
Disk, backup, restore, clone and instance-template operations return HTTP `202` with `data.task_id`. Poll `GET /api/v1/tasks/{task_id}`. Batch creation and batch actions return an array of task IDs in `data`. Poll each ID separately. Single-instance creation with `POST /api/v1/containers` returns `201` when creation completes.
`data.status` is `pending`, `running`, `done` or `failed`. Read `error` and `logs` on failure and the operation-specific `result` after success. The detail endpoint returns `404` for missing, pruned or inaccessible tasks. Deleting a pending task cancels it. Deleting a completed task clears its history. Deleting a running task returns `409`. See [tasks and metric history](./tasks).
Host and instance history endpoints return sample arrays. `ts` is in Unix milliseconds, `cpu` and `memory` are percentages, and `network_rx`, `network_tx`, `disk_read` and `disk_write` are in bytes per second. Samples are retained for up to seven days and can have gaps during downtime.
## Disk and Backup Workflows
Read `data.system`, `data.data_disks` and `data.can_edit` from the instance disk inventory. Stop the instance before changing disks. `size_gb` is the requested final size in GiB.
| Operation | Request body |
| --- | --- |
| Add an LXC data disk | `{"name":"data","size_gb":8,"mount_path":"/data","storage_pool_id":"disk-root"}` |
| Add a KVM data disk | `{"name":"data","size_gb":8,"storage_pool_id":"disk-root"}` |
| Grow a system or data disk | `{"size_gb":20}` |
| Detach or reattach | `{"attached":false}` or `{"attached":true}` |
| Permanently delete a data disk | `{"delete_data":true}` |
Choose a pool from `data.pools` on `GET /api/v1/storage`. Omit the optional `storage_pool_id` to let CLICD select a suitable pool. `PUT /api/v1/storage` accepts a complete `{"pools":[...]}` inventory. Use the current GET result as the basis for changes.
Create a full backup or save an instance template with `{"name":"nightly","storage_pool_id":"disk-root"}`. Read `result.artifact_id` from the completed task, or find the artifact in its respective list. Cold copies temporarily stop a running source and attempt to restore its power state after copying.
Downloads return `application/gzip` and support `HEAD` for metadata and `Range` for partial downloads. Browser clients may call `POST /api/v1/backups/{artifact_id}/download-ticket` and then request `data.url` on the same panel origin. For v1, this relative URL is `/api/v1/backup-download/{ticket}`. It supports GET, HEAD and byte ranges without another API key header. The ticket is valid for two minutes and remains subject to the panel access source policy. The issuer also returns `data.expires_at` as an RFC 3339 timestamp.
A successful import returns HTTP `201` with backup metadata including `id`. To restore, clone or instantiate a template, send `{"name":"restored-01","storage_pool_id":"disk-root","assign_nat":true,"port_mapping_count":2}`. The new instance starts in a stopped state. NAT defaults to enabled with a quota of two mappings (range 1–64). Each template instantiation request creates one instance. For multiple copies, submit a request per unique name. See [disk, backup and clone requirements](./storage-backups).
## Local Image Upload and KVM Installation Media
Upload with `multipart/form-data`. The `file` and `name` fields are required and each file is limited to 32 GiB. Optional fields are `description`, `arch`, `sha256`, `provisioner`, `distro` and `release`. Pass `storage_pool_id` as a query parameter.
After validation and activation the API returns HTTP `201` with `id`, `name`, `format`, `size_bytes` and `sha256` in `data`. Use `id` as the `template_id` for a new KVM instance. For an existing KVM instance, check `data.available` from `GET /api/v1/containers/{id}/installation-media`. Stop the VM and PUT `{"image_id":"<iso_id>","boot":"cdrom"}`. To eject the ISO and boot from disk, PUT `{"image_id":"","boot":"disk"}`. See [image formats and install modes](./images).
## IPv4 and IPv6 NAT
For an existing instance, `PUT .../public-ipv4` and `PUT .../ipv6-addresses` accept `{"mode":"auto","count":1}`, `{"mode":"custom","addresses":["<address>"]}`, or `{"mode":"clear"}`. Read the host address pools from `GET /api/v1/routing` first.
Port mappings accept `tcp` or `udp`. Fetch the current mappings before editing or deleting by zero-based index. Without a dedicated public IPv4 address, the host port must be inside the NAT range in the routing settings.
`GET /api/v1/containers/{id}/ipv6-port-mappings` returns `enabled`, `sync_ipv4`, `host_ipv6`, `guest_ipv6`, `limit` and `mappings`. When synchronization is enabled, the mappings mirror the IPv4 list. Send `{"enabled":false}` to `PUT /api/v1/containers/{id}/ipv6-nat-sync` before editing independent IPv6 mappings. POST and PUT accept the same mapping fields as IPv4. Omit `host_ip` to use the instance's IPv6 NAT endpoint. LXC requires host IPv6 NAT enabled through `/api/v1/ipv6/nat`. See [networking and routing](./networking) for setup.
Scopes in the last column apply to API keys. An API key bound to container UUIDs also has resource-level restrictions. Updating the global panel language requires an unbound key. A missing or invalid credential normally returns `401`, a missing scope `403`, and a resource or state conflict `409`. `/api/v1/containers/list` is a compatibility alias; use `GET /api/v1/containers` in new clients.
Disk mutations, full backups, restores, clones and template operations accept administrator sessions or API keys with the listed scopes and no container restriction. Sub-users can read their assigned instances’ disk inventory. See [disk, backup and clone requirements](./storage-backups).
| PUT | `/api/v1/images/toggle` | Enable or disable image | `admin:access` + `image:toggle` |
| POST | `/api/v1/images/upload` | Local ISO/QCOW2 upload, `multipart/form-data`, at most 32 GiB | `admin:access` + `image:download` + `image:toggle` |
| GET | `/api/v1/storage` | List host storage pools and disks | `admin:access` |
| PUT | `/api/v1/storage` | Replace managed storage pool configuration | `admin:access` |
| GET | `/api/v1/host-history` | Persisted host metrics, up to 7 days | `host:read` |
| GET | `/api/v1/swap` | Swap information | `swap:read` |
| POST | `/api/v1/swap` | Adjust Swap | `swap:manage` |
| GET | `/api/v1/language` | Current panel language | Public |
| POST | `/api/v1/batch-action` | Batch power action, delete, or reinstall | `container:power`, `container:delete` or `container:reinstall` according to the action |
Language writes accept `{"language":"en"}` or `{"language":"zh"}` and require administrator authentication on both `/api/v1/language` and `/api/language`. Set task concurrency with `{"concurrency":2}` (allowed range 1–16).
The samples below are grouped by endpoint path. Resource numbers, task IDs, container IDs, timestamps, IP addresses, and keys will differ in real environments. Passwords, tickets, and API keys are masked.
{"id":"a1b2c3d4","direction":"in","protocol":"tcp","action":"ACCEPT","network":"ipv4","source_ip":"203.0.113.0/24","port":"22,80,443","description":"allow admin and web"}