# ONIE API v1

REST API for ONIE cloud services

## Getting started

The ONIE API lets you create and manage your cloud resources from scripts, CI jobs and tools. It is a JSON REST API over HTTPS. Base URL: `https://api.onie.net`. Every path in this document starts with `/v1`.

### Authentication

Send an API key in the `Authorization` header:

```
Authorization: Bearer vk_xxxxxxxxxxxxxxxx
```

Create keys on the **API Keys** page of the dashboard. A key is shown once, at creation; only a one-way hash is stored, so a lost key must be revoked and replaced. Each key carries its own **scopes**, an optional expiry and an optional IP allow-list.

A key can never create or revoke other keys, top up or withdraw money, change payment methods, change the password, e-mail address or two-factor settings, or delete the account. Those actions are only available when signed in to the dashboard.

The API does not enable CORS. Call it from servers, CI jobs or the command line, never from a web page, so the key is not exposed to visitors.

### Scopes

Each operation requires exactly one scope (shown on the operation as `x-scope` and in the security requirement). A key that lacks it receives `403 scope_required`. Create keys with the smallest set of scopes the integration needs. Scopes that cost money or destroy data are separate from read scopes.

### Rate limits

Defaults: 120 requests per minute per key and 300 requests per minute per account (all keys together), counted in fixed 60-second windows. Operators can change these limits. Every response that passes the scope check carries `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix time when the window resets) for the stricter of the two limits. When exceeded the API answers `429 rate_limited` with a `Retry-After` header (seconds).

### Idempotency

Operations that charge your wallet or cannot be repeated safely (creating or deleting servers, changing plans, buying add-ons) require an `Idempotency-Key` header: any unique string up to 200 characters, for example a UUID. Repeating a request with the same key returns the original response with the header `Idempotency-Replayed: 1` instead of running again, so it is always safe to retry after a timeout or a dropped connection. Only successful (2xx) results are remembered, for 24 hours; a failed attempt can be retried with the same key. A concurrent duplicate gets `409 idempotency_in_progress` with `Retry-After: 1`. Use a new key for each distinct operation: reusing a key for another method or path fails with `422 idempotency_key_reused`.

### Errors

Errors use standard HTTP status codes and one JSON shape:

```
{ "error": { "code": "scope_required", "message": "..." } }
```

Branch on `error.code`, which is stable; `message` is for humans and may change. Some errors add extra fields beside `code` and `message` (for example the balance needed for a purchase). Every response, success or error, carries an `X-Request-Id` header; quote it when contacting support. You may send your own `X-Request-Id` (letters, digits, `-`, `_`, `.`, up to 80 characters) and it will be echoed back.

| Status | Meaning |
|---|---|
| 400 | Malformed request or missing `Idempotency-Key` |
| 401 | Missing, invalid, expired or revoked key, or IP not allowed |
| 402 | Not enough wallet balance |
| 403 | Key lacks the required scope, feature disabled, or action not allowed |
| 404 | Not found, or not yours |
| 409 | Conflict with the current state of the resource |
| 422 | Valid JSON but a field is missing or out of range |
| 429 | Rate limit exceeded |
| 5xx | Server error. Retry with the same `Idempotency-Key` where one is required |

Resources that belong to another account always answer `404`, never `403`, so identifiers cannot be probed.

### Pagination

List operations that can return many rows take `page` (1-based) and `per_page` and return `{ "items": [...], "total": N, "page": P, "per_page": S }`. `per_page` above the maximum of the operation is clamped; the value used is echoed in the response.

### Conventions

Request and response bodies are UTF-8 JSON (`Content-Type: application/json`). Timestamps are Unix seconds (UTC) unless a field says otherwise. Monetary amounts are integers in the smallest unit named by the field (for example `*_cents`). Unknown request fields are ignored; new response fields may be added at any time, so ignore fields you do not know.

## Contents


**Catalog**

- Plans, regions and OS images `GET /v1/vm/catalog`
- Public price list of the site `GET /v1/public/plans`
- Unit prices per component (vCPU, RAM, disk) `GET /v1/vm/prices`
- Quote a custom configuration `GET /v1/vm/custom-quote`
- Quote a custom configuration in a region (CPU type, cores, RAM, disk) `GET /v1/vm/px-quote`
- Regions open for sale and starting prices `GET /v1/public/vm-regions`
- One region in detail: CPU types, plans, custom sizes, traffic, cycles `GET /v1/public/vm-regions/{slug}`
- Quote a custom size in a region (public) `GET /v1/public/vm-quote`
- Sale zones and per-service availability `GET /v1/zones`
- Consolidated site pricing (VMs, storage, enabled features) `GET /v1/public/pricing`
- Block Storage, Backup, Snapshot and Images pricing `GET /v1/public/storage`
- Public S3 price list `GET /v1/public/s3`
- Public VPN IPv4 price list `GET /v1/public/vpn`
- Quote a VPN IPv4 order (nothing is purchased) `POST /v1/public/vpn/quote`
- Public worldwide proxy price list (Datacenter, Static/Rotating Residential) `GET /v1/public/proxy`
- Public Proxy IPv6 price list `GET /v1/public/proxy6`
- Public GPU price list `GET /v1/public/gpu`
- Public Kubernetes price list `GET /v1/public/k8s`
- Public Private Cloud price list `GET /v1/public/vpc`
- Public Dedicated Server (Bare Metal) plans: specifications; prices only while on sale `GET /v1/public/dedicated`
- GPU catalog: configurations, templates and sale prices `GET /v1/gpu/catalog`
- S3 catalog: price policy and zones `GET /v1/s3/catalog`
- VPN IPv4 catalog: plans, cycles, zones and free IPs `GET /v1/vpn/catalog`
- Quote a VPN IPv4 order at your site's price (nothing is purchased) `POST /v1/vpn/quote`
- Proxy IPv6 catalog: plans, cycles and zones `GET /v1/proxy6/catalog`
- Quote a Proxy IPv6 order at your site's price (nothing is purchased) `POST /v1/proxy6/quote`

**Virtual Machines**

- List VMs `GET /v1/vm`
- Get one VM `GET /v1/vm/{id}`
- CPU/RAM/disk/network over time `GET /v1/vm/{id}/metrics`
- Bandwidth usage `GET /v1/vm/{id}/bandwidth`
- Volumes of the VM `GET /v1/vm/{id}/volumes`
- Network interfaces and IPs `GET /v1/vm/{id}/nics`
- VM event log `GET /v1/vm/{id}/events`
- Running jobs of the VM `GET /v1/vm/{id}/jobs`
- Billing of this VM `GET /v1/vm/{id}/billing`
- Quote before changing plan `GET /v1/vm/{id}/plan-quote`
- Available templates for this VM `GET /v1/vm/{id}/template-options`
- Plans this VM can switch to (same zone) `GET /v1/vm/{id}/plan-options`
- Preview before delete `GET /v1/vm/{id}/delete-preview`
- The pre-attached ops SSH key (name + fingerprint, not a secret) `GET /v1/vm/ops-key`
- Start the VM `POST /v1/vm/{id}/start`
- Stop the VM (graceful) `POST /v1/vm/{id}/stop`
- Force stop the VM `POST /v1/vm/{id}/force-stop`
- Reboot the VM `POST /v1/vm/{id}/reboot`
- Reset the admin password `POST /v1/vm/{id}/reset-password`
- Attach an SSH key to the VM `POST /v1/vm/{id}/ssh-key`
- Rename / notes `PATCH /v1/vm/{id}`
- Create a VM (charges the wallet) `POST /v1/vm`
- Regions this VM can be cloned to `GET /v1/vm/{id}/clone-options`
- Clone a VM (new server, charges the wallet) `POST /v1/vm/{id}/clone`
- Change plan (prorated) `POST /v1/vm/{id}/change-plan`
- Custom resize `POST /v1/vm/{id}/change-custom`
- Delete the VM (data is lost) `DELETE /v1/vm/{id}`
- Current price of the VM (hourly, cycle, renewal) `GET /v1/vm/{id}/price`
- Quote a plan change or custom resize `GET /v1/vm/{id}/change-quote`
- Quote a billing-cycle change `GET /v1/vm/{id}/cycle-quote`
- Screenshot of the running VM `GET /v1/vm/{id}/screenshot`
- Disk used/total measured inside the VM `GET /v1/vm/{id}/fsinfo`
- Renew a prepaid VM (charges the wallet) `POST /v1/vm/{id}/renew`
- Change the billing cycle (prorated) `POST /v1/vm/{id}/change-cycle`
- Reinstall the OS (WIPES the disk) `POST /v1/vm/{id}/reinstall`
- Change the public IP (cooldown between changes) `POST /v1/vm/{id}/change-ip`
- Enable/disable IPv6 (dual-stack or IPv4 only) `POST /v1/vm/{id}/toggle-ipv6`

**VM Networking**

- Firewall rules `GET /v1/vm/{id}/firewall`
- Port forwarding rules `GET /v1/vm/{id}/port-forwarding`
- Add a firewall rule `POST /v1/vm/{id}/firewall`
- Delete a firewall rule `DELETE /v1/vm/{id}/firewall/{rule_id}`
- Add a port-forwarding rule `POST /v1/vm/{id}/port-forwarding`
- Delete a port-forwarding rule `DELETE /v1/vm/{id}/port-forwarding/{rule_id}`

**Snapshots**

- List snapshots `GET /v1/vm/{id}/snapshots`
- Create a snapshot `POST /v1/vm/{id}/snapshots`
- Delete a snapshot `DELETE /v1/vm/{id}/snapshots/{sid}`
- Snapshots of all VMs in the account (paged, sortable) `GET /v1/snapshots`
- Automatic snapshot schedules of all VMs (paged) `GET /v1/snapshot-policies`
- Automatic snapshot schedules of one VM `GET /v1/vm/{id}/snapshot-policies`
- Add an automatic snapshot schedule (daily/weekly) `POST /v1/vm/{id}/snapshot-policies`
- Delete an automatic snapshot schedule `DELETE /v1/vm/{id}/snapshot-policies/{pid}`
- Restore the VM to a snapshot (stops, overwrites the disk, restarts) `POST /v1/vm/{id}/snapshots/{sid}/restore`

**Console and AI Agent**

- Get a one-time VNC console ticket `GET /v1/vm/{id}/console`
- Get a one-time SSH WebSocket token `POST /v1/vm/{id}/ssh-token`
- AI SSH Agent status and history `GET /v1/vm/{id}/ai-agent/status`
- Start a new AI SSH Agent session `POST /v1/vm/{id}/ai-agent/clear`
- Run AI SSH Agent (SSE stream) `POST /v1/vm/{id}/ai-agent`
- VMs usable by the AI SSH Agent + daily quota `GET /v1/chat/agent/vms`
- Check the agent SSH login (fixed command) `POST /v1/chat/agent/vms/{id}/connect`
- List AI SSH Agent conversations `GET /v1/chat/agent/sessions`
- Start an AI SSH Agent conversation for a VM `POST /v1/chat/agent/sessions`
- Get an AI SSH Agent conversation with messages `GET /v1/chat/agent/sessions/{sid}`
- Rename an AI SSH Agent conversation `PATCH /v1/chat/agent/sessions/{sid}`
- Delete an AI SSH Agent conversation (with its command history) `DELETE /v1/chat/agent/sessions/{sid}`
- Send to the AI SSH Agent / confirm a command (SSE stream) `POST /v1/chat/agent/sessions/{sid}/messages`
- List active SSH session share links `GET /v1/vm/{id}/console-shares`
- Create an SSH session share link `POST /v1/vm/{id}/console-shares`
- Revoke an SSH session share link `DELETE /v1/vm/{id}/console-shares/{sid}`

**SSH Keys**

- List SSH keys `GET /v1/vm/sshkeys`
- Add an SSH key `POST /v1/vm/sshkeys`
- Delete an SSH key `DELETE /v1/vm/sshkeys/{id}`

**Billing**

- Wallet balance `GET /v1/billing/wallet`
- Billing overview `GET /v1/billing/summary`
- Trial credit of your account `GET /v1/billing/trial`
- Trial program (public) `GET /v1/public/trial`
- List invoices `GET /v1/billing/invoices`
- Get one invoice `GET /v1/billing/invoices/{id}`
- Payment history `GET /v1/billing/payments`
- Order history `GET /v1/billing/orders`
- Orders across all services `GET /v1/orders`
- Current usage `GET /v1/client/usage`

**DDoS Shield**

- DDoS Shield overview `GET /v1/tenants/{tid}/summary`
- DDoS Shield center: all IPs, traffic, 24-hour attacks `GET /v1/tenants/{tid}/overview`
- Protected IPs `GET /v1/tenants/{tid}/targets`
- Rules of one IP `GET /v1/tenants/{tid}/targets/{id}/rules`
- Attack events of one IP `GET /v1/tenants/{tid}/targets/{id}/events`
- Edge traffic `GET /v1/tenants/{tid}/traffic`
- Add a blocking rule `POST /v1/tenants/{tid}/targets/{id}/rules`
- Delete a blocking rule `DELETE /v1/tenants/{tid}/targets/{id}/rules/{rid}`
- Tenant overview: quota, usage and protected IPs `GET /v1/tenants/{tid}`
- All blocking rules of the tenant, flat and paged `GET /v1/tenants/{tid}/blocks`
- Download the tenant's blocking rules as CSV `GET /v1/tenants/{tid}/blocks/export`
- Country code table used by country rules `GET /v1/tenants/{tid}/countries`
- Attack events against the tenant's IPs `GET /v1/tenants/{tid}/events`
- One attack event with packet sample `GET /v1/tenants/{tid}/events/{eid}`
- Plain-text incident report of an attack event `GET /v1/tenants/{tid}/events/{eid}/report`
- Upstream blackhole (RTBH) entries of the tenant's IPs `GET /v1/tenants/{tid}/rtbh`
- Traffic shaping state of all the tenant's IPs (read-only) `GET /v1/tenants/{tid}/shape`
- Live packet and bit rate of each protected IP `GET /v1/tenants/{tid}/traffic/live`
- Top attacking source IPs seen in the tenant's events `GET /v1/tenants/{tid}/traffic/top-sources`
- Everything about one protected IP: status, history, rules, events, RTBH `GET /v1/tenants/{tid}/targets/{id}/detail`
- Download one IP's blocking rules as CSV `GET /v1/tenants/{tid}/targets/{id}/rules/export`
- Live connections of one protected IP `GET /v1/tenants/{tid}/targets/{id}/flows`
- Top traffic sources of one protected IP over a range `GET /v1/tenants/{tid}/targets/{id}/top`
- Action log of one protected IP (last 24 hours) `GET /v1/tenants/{tid}/targets/{id}/logs`
- Intrusion-prevention (IPS) alerts aimed at one protected IP `GET /v1/tenants/{tid}/targets/{id}/ips`
- Web protection policy of one protected IP `GET /v1/tenants/{tid}/targets/{id}/web`
- Blackhole (RTBH) entries of one protected IP `GET /v1/tenants/{tid}/targets/{id}/rtbh`
- Traffic shaping state and history of one protected IP (read-only) `GET /v1/tenants/{tid}/targets/{id}/shape`
- AI analysis tasks of one protected IP and today's quota `GET /v1/tenants/{tid}/targets/{id}/ai/tasks`
- One AI analysis task `GET /v1/tenants/{tid}/targets/{id}/ai/tasks/{task}`
- Monitoring agent installed on the VM that holds this IP `GET /v1/tenants/{tid}/targets/{id}/agent`
- Delete up to 100 of your own blocking rules at once `POST /v1/tenants/{tid}/targets/{id}/rules/bulk-delete`
- Change web protection (per-source SYN / packet rate limits) of one IPv4 `PUT /v1/tenants/{tid}/targets/{id}/web`
- Blackhole one of your IPs upstream (RTBH) — the IP goes offline for the chosen scope `POST /v1/tenants/{tid}/targets/{id}/rtbh`
- Withdraw a blackhole entry you created `DELETE /v1/tenants/{tid}/rtbh/{bid}`
- Reset the lifetime of a blackhole entry you created `POST /v1/tenants/{tid}/rtbh/{bid}/extend`
- Ask the AI to analyze one protected IP (uses a daily quota) `POST /v1/tenants/{tid}/targets/{id}/ai/analyze`
- Change agent note, auto-block switch and thresholds `PATCH /v1/tenants/{tid}/targets/{id}/agent`
- Send a block, unblock or acct command to the agent `POST /v1/tenants/{tid}/targets/{id}/agent/cmd`

**Kubernetes**

- Cluster Bandwidth (per-worker quota, Add-ons, usage) `GET /v1/k8s/clusters/{id}/bandwidth`
- Kubernetes catalog: zones, versions, worker plans, cycles `GET /v1/k8s/catalog`
- Kubernetes images (sellable versions) `GET /v1/k8s/versions`
- Quote a cluster + required balance (no charge) `GET /v1/k8s/quote`
- List clusters `GET /v1/k8s/clusters`
- Get one cluster `GET /v1/k8s/clusters/{id}`
- Rename / notes / auto-renew `PATCH /v1/k8s/clusters/{id}`
- Cluster nodes (free control + workers) `GET /v1/k8s/clusters/{id}/nodes`
- Start the cluster `POST /v1/k8s/clusters/{id}/start`
- Stop the cluster `POST /v1/k8s/clusters/{id}/stop`
- Download kubeconfig (cluster-admin) `GET /v1/k8s/clusters/{id}/kubeconfig`
- Cluster operations `GET /v1/k8s/clusters/{id}/ops`
- Cluster event log `GET /v1/k8s/clusters/{id}/events`
- Cluster billing `GET /v1/k8s/clusters/{id}/billing`
- Endpoint, IP, open ports `GET /v1/k8s/clusters/{id}/networking`
- Preview before deleting the cluster `GET /v1/k8s/clusters/{id}/delete-preview`
- Create a cluster (prepaid cycles charge the wallet) `POST /v1/k8s/clusters`
- Change worker count (costs money) `POST /v1/k8s/clusters/{id}/scale`
- Delete the cluster (data is lost) `DELETE /v1/k8s/clusters/{id}`

**Private Cloud**

- Private Cloud catalog: bandwidth plans, cycles, limits `GET /v1/vpc/catalog`
- Quote a Private Cloud + required balance (no charge) `GET /v1/vpc/quote`
- List Private Clouds `GET /v1/vpc`
- Get one Private Cloud `GET /v1/vpc/{id}`
- Rename / notes / auto-renew `PATCH /v1/vpc/{id}`
- Quote a bandwidth plan change `GET /v1/vpc/{id}/plan-quote`
- List tiers (subnets) `GET /v1/vpc/{id}/tiers`
- Add a tier `POST /v1/vpc/{id}/tiers`
- Delete a tier (no VMs left) `DELETE /v1/vpc/{id}/tiers/{tier}`
- Network ACL rules `GET /v1/vpc/{id}/acl`
- Add a Network ACL rule `POST /v1/vpc/{id}/acl`
- Delete a Network ACL rule `DELETE /v1/vpc/{id}/acl/{rule}`
- VMs in the Private Cloud `GET /v1/vpc/{id}/vms`
- Public IPs of the Private Cloud `GET /v1/vpc/{id}/ips`
- Bandwidth chart (Mbps, plan limit) `GET /v1/vpc/{id}/bandwidth`
- Private Cloud operations `GET /v1/vpc/{id}/ops`
- Private Cloud event log `GET /v1/vpc/{id}/events`
- Private Cloud billing `GET /v1/vpc/{id}/billing`
- Preview before deleting `GET /v1/vpc/{id}/delete-preview`
- Create a Private Cloud (prepaid cycles charge the wallet) `POST /v1/vpc`
- Change bandwidth plan (costs money) `POST /v1/vpc/{id}/plan`
- Delete the Private Cloud (no VMs left) `DELETE /v1/vpc/{id}`

**Bandwidth**

- Bandwidth totals across services `GET /v1/bandwidth/summary`
- Bandwidth per service (paged, sortable) `GET /v1/bandwidth/objects`
- Bandwidth of one service `GET /v1/bandwidth/objects/{kind}/{ref}`
- Hourly/daily traffic of one service `GET /v1/bandwidth/objects/{kind}/{ref}/series`
- Quote a Bandwidth Add-on `GET /v1/bandwidth/objects/{kind}/{ref}/quote`
- Buy a Bandwidth Add-on (charges the wallet) `POST /v1/bandwidth/objects/{kind}/{ref}/addons`
- Bandwidth Add-on purchase history `GET /v1/bandwidth/addons`

**Images**

- Public OS images on sale `GET /v1/images/public`
- OS types `GET /v1/images/os-types`
- Image storage price per GB `GET /v1/images/quote`
- List your images and ISOs (paged, sortable) `GET /v1/images`
- Get one image `GET /v1/images/{iid}`
- ISO attached to the VM + attachable ISOs `GET /v1/vm/{id}/iso`
- Import an image/ISO from URL (storage billed hourly) `POST /v1/images`
- Create an image from a stopped instance `POST /v1/images/from-vm`
- Rename / describe an image `PATCH /v1/images/{iid}`
- Delete an image (not in use) `DELETE /v1/images/{iid}`
- Attach an ISO to an instance `POST /v1/images/{iid}/attach`
- Detach an ISO from an instance `POST /v1/images/{iid}/detach`

**VPN and Proxy**

- List VPN IPv4 plans `GET /v1/vpn/subscriptions`
- Get one VPN IPv4 plan + endpoints (with passwords) `GET /v1/vpn/subscriptions/{id}`
- All endpoints of active plans (IP, ports, user/pass) `GET /v1/vpn/endpoints`
- List Proxy IPv6 plans `GET /v1/proxy6/subscriptions`
- Get one Proxy IPv6 plan (with password) `GET /v1/proxy6/subscriptions/{id}`
- IPv6 addresses of the plan (paged) `GET /v1/proxy6/subscriptions/{id}/ips`
- The key revokes itself (app log out) `DELETE /v1/ext/session`
- Account token (appAccountToken) + Apple In-App Purchase top-up products `GET /v1/ext/iap/apple/token`
- Submit a signed Apple In-App Purchase transaction to credit the wallet (idempotent per transactionId) `POST /v1/ext/iap/apple/transactions`
- Download the connection list (SOCKS5/HTTP, plain, Clash, sing-box, v2rayN) `GET /v1/vpn/subscriptions/{id}/config`
- Real traffic chart and usage of a VPN IPv4 plan `GET /v1/vpn/subscriptions/{id}/traffic`
- Bandwidth tiers you can upgrade to, with prices `GET /v1/vpn/subscriptions/{id}/bandwidth`
- Active add-ons and add-ons you can still buy, with mid-term prices `GET /v1/vpn/subscriptions/{id}/addons`
- IPs authorized to use the plan without user and password `GET /v1/vpn/subscriptions/{id}/auth-ips`
- Blacklist reports you filed for the plan's IPs `GET /v1/vpn/subscriptions/{id}/ip-reports`
- Preview of canceling a VPN IPv4 plan `GET /v1/vpn/subscriptions/{id}/cancel-preview`
- Invoices that belong to a VPN IPv4 plan `GET /v1/vpn/subscriptions/{id}/billing`
- Replace the list of authorized IPs of a plan `PUT /v1/vpn/subscriptions/{id}/auth-ips`
- Turn auto-renew on or off (turning it on can renew from the wallet at once) `PUT /v1/vpn/subscriptions/{id}/auto-renew`
- Schedule removal of add-ons at the next renewal (no refund) `POST /v1/vpn/subscriptions/{id}/addons/remove`
- Report blacklisted IPs of a plan for replacement `POST /v1/vpn/subscriptions/{id}/ip-reports`
- Issue a new subscription-feed link (the old link dies) `POST /v1/vpn/subscriptions/{id}/feed/rotate`
- Buy a VPN IPv4 plan (charges the wallet) `POST /v1/vpn/subscriptions`
- Renew a VPN IPv4 plan (charges the wallet) `POST /v1/vpn/subscriptions/{id}/renew`
- Upgrade the bandwidth tier mid-term (charges the wallet) `POST /v1/vpn/subscriptions/{id}/bandwidth`
- Add features to a plan mid-term (charges the wallet) `POST /v1/vpn/subscriptions/{id}/addons`
- Cancel a VPN IPv4 plan now (no refund; IPs are released) `POST /v1/vpn/subscriptions/{id}/cancel`
- Remove a canceled or expired VPN IPv4 plan from your list `DELETE /v1/vpn/subscriptions/{id}`
- Download the proxy list of a Proxy IPv6 plan (with password) `GET /v1/proxy6/subscriptions/{id}/export`
- Connection log of a Proxy IPv6 plan (paged, searchable) `GET /v1/proxy6/subscriptions/{id}/logs`
- Real traffic chart and usage of a Proxy IPv6 plan `GET /v1/proxy6/subscriptions/{id}/traffic`
- Preview of canceling a Proxy IPv6 plan `GET /v1/proxy6/subscriptions/{id}/cancel-preview`
- Invoices that belong to a Proxy IPv6 plan `GET /v1/proxy6/subscriptions/{id}/billing`
- Turn auto-renew on or off (turning it on can renew from the wallet at once) `PUT /v1/proxy6/subscriptions/{id}/auto-renew`
- Set the automatic IP rotation interval (0 = off) `PUT /v1/proxy6/subscriptions/{id}/rotation`
- Issue a new public rotation link (anyone holding it can burn rotations) `POST /v1/proxy6/subscriptions/{id}/rotation/token`
- Release the devices locked to the plan `POST /v1/proxy6/subscriptions/{id}/release-device`
- Generate a new proxy password (returned once) `POST /v1/proxy6/subscriptions/{id}/reset-password`
- Rotate the IPv6 address now (uses one rotation of the plan) `POST /v1/proxy6/subscriptions/{id}/rotate`
- Buy a Proxy IPv6 plan (charges the wallet) `POST /v1/proxy6/subscriptions`
- Renew a Proxy IPv6 plan (charges the wallet) `POST /v1/proxy6/subscriptions/{id}/renew`
- Cancel a Proxy IPv6 plan now (no refund; addresses are released) `POST /v1/proxy6/subscriptions/{id}/cancel`
- Remove a canceled or expired Proxy IPv6 plan from your list `DELETE /v1/proxy6/subscriptions/{id}`

**Scaling**

- Scaling status: limits, capabilities, blockers `GET /v1/vm/{id}/scale`
- Resize CPU/RAM/disk now or scheduled (charges or refunds) `POST /v1/vm/{id}/scale`
- Reboot (now or scheduled) to unlock CPU/RAM hot-plug `POST /v1/vm/{id}/scale/reboot`
- Return the VM to its base size after Auto Scaling (reboots) `POST /v1/vm/{id}/scale/revert`
- Auto Scaling rule and state of the VM `GET /v1/vm/{id}/autoscale`
- Enable/disable and set the Auto Scaling rule (grows the VM with load) `PUT /v1/vm/{id}/autoscale`
- Auto Scaling of all VMs in the account (paged) `GET /v1/autoscale`
- Scaling history of the account (paged, filterable) `GET /v1/vm/scale-events`

**Block Storage**

- Data volumes attached to the VM `GET /v1/vm/{id}/data-volumes`
- List data volumes (paged, sortable) `GET /v1/volumes`
- Quote a data volume by size `GET /v1/volumes/quote`
- Get one data volume `GET /v1/volumes/{vid}`
- Create a data volume (billed per GB-hour) `POST /v1/volumes`
- Enlarge a data volume (grow only, costs money) `POST /v1/volumes/{vid}/resize`
- Attach a volume to a VM `POST /v1/volumes/{vid}/attach`
- Detach a volume from its VM (data kept, still billed) `POST /v1/volumes/{vid}/detach`
- Delete a data volume (data is lost permanently) `DELETE /v1/volumes/{vid}`

**Backups**

- Backups of all VMs in the account (paged) `GET /v1/backups`
- VMs with backup enabled and their schedule (paged) `GET /v1/backup-schedules`
- Backup status of one VM: schedule, kept backups, price `GET /v1/vm/{id}/backup`
- Backups of one VM (paged, sortable) `GET /v1/vm/{id}/backups`
- Enable backup for the VM (storage is billed) `POST /v1/vm/{id}/backup/enable`
- Disable backup (only when no backups remain) `POST /v1/vm/{id}/backup/disable`
- Set the automatic backup schedule `PUT /v1/vm/{id}/backup/schedule`
- Remove the backup schedule (existing backups are kept) `DELETE /v1/vm/{id}/backup/schedule`
- Create a backup now (storage is billed) `POST /v1/vm/{id}/backups`
- Delete one backup `DELETE /v1/vm/{id}/backups/{bid}`
- Pin a backup (never rotated away, billed) `POST /v1/vm/{id}/backups/{bid}/pin`
- Unpin a backup (back into the nightly rotation) `POST /v1/vm/{id}/backups/{bid}/unpin`
- Set how many nightly backups are kept (extra copies are billed) `PUT /v1/vm/{id}/backup/auto`
- Restore the VM from a backup (stops, overwrites the disk, restarts) `POST /v1/vm/{id}/backups/{bid}/restore`

**Account**

- Printable HTML invoice (?cur=usd|vnd) `GET /v1/billing/invoices/{id}/print`
- Resource quota of the account `GET /v1/client/quota`
- Account profile (read-only) `GET /v1/portal/me`
- Overview: balance, burn rate, VMs, checklist `GET /v1/portal/overview`
- One call for profile, catalog, notifications, service counts and overview (each part follows the key's own scopes) `GET /v1/portal/bootstrap`
- Account activity timeline (paged) `GET /v1/portal/activity`
- How many services of each kind the account has (VMs, GPU, volumes, snapshots, backups, VPN…) — for menu badges `GET /v1/portal/nav-counts`
- Bandwidth used by the account `GET /v1/portal/bandwidth`
- AI analyses of attacks on your IPs `GET /v1/portal/ai-analyses`
- One AI analysis in full (conclusion, evidence, recommended actions) `GET /v1/portal/ai-analyses/{id}`
- Ask the AI to analyse this IP again (10 min per IP, daily quota) `POST /v1/portal/ai-analyses/{id}/reanalyze`
- Latest 50 notifications and the unread count `GET /v1/billing/notifications`
- Mark notifications as read (empty = all) `POST /v1/billing/notifications/read`
- List the account's API keys (never the raw key) `GET /v1/apikeys`
- API key usage log of the account (paged) `GET /v1/apikeys/log`
- The calling key itself: scopes, expiry, allowed IPs, rate limits `GET /v1/apikeys/self`

**Object Storage**

- List S3 accounts `GET /v1/s3`
- Create an S3 account (usage-billed) `POST /v1/s3`
- Get one S3 account: endpoint, quota, stats `GET /v1/s3/{id}`
- Rename / set the cost alert threshold `PATCH /v1/s3/{id}`
- Delete the S3 account (all buckets must be removed first) `DELETE /v1/s3/{id}`
- Hourly storage, traffic and cost `GET /v1/s3/{id}/usage`
- Daily usage summary for a month `GET /v1/s3/{id}/usage-summary`
- List buckets `GET /v1/s3/{id}/buckets`
- Create a bucket `POST /v1/s3/{id}/buckets`
- List objects in a bucket (paged) `GET /v1/s3/{id}/buckets/{bucket}`
- Delete a bucket (must be empty) `DELETE /v1/s3/{id}/buckets/{bucket}`
- Bucket and object operations selected by the op field (delete ops also need s3:destroy) `POST /v1/s3/{id}/buckets/{bucket}/action`
- List access keys (no secrets) `GET /v1/s3/{id}/keys`
- Create an access key (the secret is shown once) `POST /v1/s3/{id}/keys`
- Delete an access key (at least one key must remain) `DELETE /v1/s3/{id}/keys/{key}`
- Rotate an access key (the new secret is shown once) `POST /v1/s3/{id}/keys/{key}/rotate`
- List object share links (includes the link token) `GET /v1/s3/{id}/share-links`
- Create an object share link `POST /v1/s3/{id}/share-links`
- Edit expiry / password / limits of a share link `PATCH /v1/s3/{id}/share-links/{link}`
- Revoke a share link `DELETE /v1/s3/{id}/share-links/{link}`

**GPU Cloud**

- List GPU instances `GET /v1/gpu`
- Quote a GPU rental (no charge; use the quote_id to rent) `POST /v1/gpu/quote`
- Rent a GPU instance from a quote (charges the wallet) `POST /v1/gpu`
- Get one GPU instance `GET /v1/gpu/{id}`
- Delete the GPU instance (data is lost) `DELETE /v1/gpu/{id}`
- Start the GPU instance (can charge a new billing period) `POST /v1/gpu/{id}/start`
- Stop the GPU instance `POST /v1/gpu/{id}/stop`
- Reboot the GPU instance `POST /v1/gpu/{id}/reboot`
- Recycle the GPU instance from its template (data is lost) `POST /v1/gpu/{id}/recycle`
- Get a one-time SSH WebSocket ticket for the GPU instance `POST /v1/gpu/{id}/ssh-token`
- Metrics and events of the GPU instance `GET /v1/gpu/{id}/diagnostics`
- Read the requested startup log `GET /v1/gpu/{id}/logs`
- Request a fresh startup log `POST /v1/gpu/{id}/logs`

**Support Tickets**

- List support tickets (filter, paged) `GET /v1/portal/tickets`
- Get one ticket with its messages `GET /v1/portal/tickets/{id}`
- Open a support ticket `POST /v1/portal/tickets`
- Reply to a ticket `POST /v1/portal/tickets/{id}/messages`
- Close a ticket `POST /v1/portal/tickets/{id}/close`

**Affiliate**

- Affiliate status, referral code and stats `GET /v1/aff`
- Referred users (anonymised, paged) `GET /v1/aff/referrals`
- Commissions (paged) `GET /v1/aff/commissions`
- Affiliate ledger events (paged) `GET /v1/aff/events`
- Payout history (paged) `GET /v1/aff/payouts`

**Service Transfers**

- List service transfer requests (outgoing or incoming) `GET /v1/transfers`
- Check whether a service can be transferred `GET /v1/transfers/precheck`
- Get one transfer request `GET /v1/transfers/{id}`

**Dedicated Servers**

- List my Dedicated Servers `GET /v1/dedicated`
- Dedicated Server order catalog: locations, plans, cycles with VND prices, stock and auto-install operating systems `GET /v1/dedicated/catalog`
- Quote a Dedicated Server order (server-side price, wallet check, stock) `POST /v1/dedicated/quote`
- Order a Dedicated Server: charges the wallet, assigns a machine and IP, installs the chosen operating system (automatic refund if the install fails) `POST /v1/dedicated/order`
- List my Dedicated Server orders `GET /v1/dedicated/orders`
- Get one Dedicated Server order `GET /v1/dedicated/orders/{oid}`
- Cancel your own Dedicated Server order while it waits for a server (full refund to the wallet) `POST /v1/dedicated/orders/{oid}/cancel`
- List the operating systems that can be installed on a Dedicated Server (enabled templates) `GET /v1/dedicated/os-templates`
- Get one Dedicated Server: hardware, network, status and which actions are available `GET /v1/dedicated/{id}`
- Rename a Dedicated Server `PATCH /v1/dedicated/{id}`
- Turn auto-renew of a Dedicated Server subscription on or off `PATCH /v1/dedicated/{id}/auto-renew`
- Pay the open renewal invoice or renew several cycles early (periods; charged from the wallet at the subscription's locked price) `POST /v1/dedicated/{id}/renew`
- Other plans you can ask for: price at the current cycle, difference and the estimated charge of an upgrade `GET /v1/dedicated/{id}/plans`
- Invoices of a Dedicated Server (order, renewals, plan upgrades) `GET /v1/dedicated/{id}/invoices`
- Change the billing cycle from the next renewal (nothing charged or refunded now) `PATCH /v1/dedicated/{id}/cycle`
- Request a Dedicated Server plan change (nothing charged; approved by the operator once the hardware is ready) `POST /v1/dedicated/{id}/plan-change`
- Cancel the pending plan change request `DELETE /v1/dedicated/{id}/plan-change`
- Reinstall the OS of a Dedicated Server (erases the disks, asynchronous, returns an op) `POST /v1/dedicated/{id}/reinstall`
- Change the OS root/Administrator password through the platform agent inside the server (asynchronous: poll GET os-password/:cid; offline agent ⇒ 409) `POST /v1/dedicated/{id}/os-password`
- State of one OS password change (pending/applied/failed/unconfirmed/cancelled) `GET /v1/dedicated/{id}/os-password/{cid}`
- Get the one-line install/uninstall command of the platform agent for a server whose OS was installed earlier (opens a 60-minute enrolment window, one-time token) `POST /v1/dedicated/{id}/agent/install`
- Remove the platform agent from the platform (revokes its key, cancels a pending password change) `DELETE /v1/dedicated/{id}/agent`
- Power on/off/reboot a Dedicated Server (asynchronous, returns an op) `POST /v1/dedicated/{id}/power`
- Operation history of a Dedicated Server `GET /v1/dedicated/{id}/ops`
- Get one operation (poll its progress) `GET /v1/dedicated/{id}/ops/{op}`
- Power, temperatures, fans, PSUs, CPU/memory/I-O usage, current network rate (+ 24h/7d series) `GET /v1/dedicated/{id}/sensors`
- Hardware log (SEL) of a Dedicated Server `GET /v1/dedicated/{id}/events`
- Inbound/outbound bandwidth of a Dedicated Server (series + monthly total) `GET /v1/dedicated/{id}/bandwidth`
- Activity log of a Dedicated Server `GET /v1/dedicated/{id}/activity`
- The server's custom ISO: state, progress, expiry and which actions are available `GET /v1/dedicated/{id}/iso`
- Download an ISO from an http(s) URL into the server's temporary storage (asynchronous) `POST /v1/dedicated/{id}/iso`
- Delete the ISO early (detached first when attached) `DELETE /v1/dedicated/{id}/iso`
- Attach the ISO to the server as virtual media and set a one-time CD boot (asynchronous, returns an op) `POST /v1/dedicated/{id}/iso/attach`
- Detach the ISO from the server (asynchronous, returns an op) `POST /v1/dedicated/{id}/iso/detach`
- Open a console session (a one-time URL is returned when ready) `POST /v1/dedicated/{id}/console`
- Console session status; when ready, issues a fresh URL (valid 60 seconds) `GET /v1/dedicated/{id}/console/{sid}`
- Close a console session `DELETE /v1/dedicated/{id}/console/{sid}`
- Get a one-time SSH WebSocket ticket for a Dedicated Server (logs in with the installation's login) `POST /v1/dedicated/{id}/ssh-token`
- Forget the SSH password you typed and kept for a Dedicated Server `DELETE /v1/dedicated/{id}/ssh-credentials`
- AI SSH Agent status and history for a Dedicated Server `GET /v1/dedicated/{id}/ai-agent/status`
- Start a new AI SSH Agent session for a Dedicated Server `POST /v1/dedicated/{id}/ai-agent/clear`
- Run the AI SSH Agent on a Dedicated Server (SSE stream) `POST /v1/dedicated/{id}/ai-agent`
- Proxy App status: readiness, agent, subnets and proxy totals `GET /v1/dedicated/{id}/proxy-app`
- List proxies (sorted, filtered, paged; no passwords) `GET /v1/dedicated/{id}/proxy-app/proxies`
- Create a SOCKS5 proxy for every host address of the subnet (free of charge) `POST /v1/dedicated/{id}/proxy-app/proxies`
- Turn on, off, delete, change password or port of many proxies `POST /v1/dedicated/{id}/proxy-app/proxies/bulk`
- Remove all proxies and the Proxy App settings of the server `POST /v1/dedicated/{id}/proxy-app/clear`
- Set the source addresses allowed to use the proxies `PUT /v1/dedicated/{id}/proxy-app/settings`
- Export proxies with passwords (ip:port:user:pass, socks5://, CSV) `POST /v1/dedicated/{id}/proxy-app/export`

**Bring Your Own IP**

- BYOIP catalog: types, prefix sizes, prices and limits `GET /v1/byoip/catalog`
- BYOIP quote by type and ASN `GET /v1/byoip/quote`
- Quick check of a prefix before registering (no external lookups) `POST /v1/byoip/check`
- List your own IP prefixes `GET /v1/byoip`
- Merged IP range list: your own prefixes and rented subnets (one row per range) `GET /v1/byoip/ranges`
- Register an own IP prefix (waits for verification, not charged yet) `POST /v1/byoip`
- Prefix details: verification results, instructions, VM setup `GET /v1/byoip/{id}`
- Verify again now (RPKI, IRR, token) `POST /v1/byoip/{id}/verify`
- Request a manual review (when the token cannot be published) `POST /v1/byoip/{id}/review-request`
- Cancel a prefix (remove the setup, withdraw BGP) `POST /v1/byoip/{id}/cancel`
- Prefix activity log `GET /v1/byoip/{id}/events`
- Own-IP attachment of a VM and sample configuration `GET /v1/vm/{id}/byoip`
- Attach your own-IP network to a VM (adds a NIC) `POST /v1/vm/{id}/byoip/attach`
- Detach your own-IP network from a VM `POST /v1/vm/{id}/byoip/detach`
- VMs eligible for own IP prefix (Ho Chi Minh City zone) `GET /v1/byoip/vms/eligible`
- Attached VM + IP configuration commands `GET /v1/byoip/{id}/vms`
- Attach prefix to an additional VM `POST /v1/byoip/{id}/vms`
- Detach prefix from VM (last VM ⇒ prefix pending attachment, BGP retained) `DELETE /v1/byoip/{id}/vms/{vm}`
- Own-IP prefixes attached to this Bare Metal server + OS-specific IP commands + free prefixes `GET /v1/dedicated/{id}/byoip`
- Attach a free IPv4 prefix to this Bare Metal server (free of charge) `POST /v1/dedicated/{id}/byoip/attach`
- Detach a prefix from this Bare Metal server (prefix waits for attachment, BGP kept) `POST /v1/dedicated/{id}/byoip/detach`
- Move prefix from one VM to another in one step `POST /v1/byoip/{id}/move`
- Request prefix attachment to Private Cloud (manually set up by network team) `POST /v1/byoip/{id}/vpc-requests`
- Cancel pending Private Cloud attachment request `DELETE /v1/byoip/{id}/vpc-requests/{rid}`
- IPv4 subnets for sale (public, monthly price plus a one-time setup fee) `GET /v1/public/ip-subnets`
- IPv4 subnets for sale priced for your account `GET /v1/byoip/subnets/market`
- Your IPv4 subnet orders `GET /v1/byoip/subnets`
- Order an IPv4 subnet (charges the first month and the setup fee) `POST /v1/byoip/subnets`
- Subnet order details `GET /v1/byoip/subnets/{id}`
- Check the RPKI status of a subnet now (RIPEstat) `POST /v1/byoip/subnets/{id}/rpki-check`
- Assign or change the ASN of a subnet (one-time RPKI fee per assignment, we issue the LOA) `POST /v1/byoip/subnets/{id}/asn`
- Cancel a subnet (before leasing: full refund; in use: stop renewal) `POST /v1/byoip/subnets/{id}/cancel`

## API reference

### Catalog

Plans, regions, operating systems and prices you can order from. These calls are read-only and cost nothing. Prices are the retail prices of the site you call, in USD.

#### Plans, regions and OS images

`GET /v1/vm/catalog`

Returns everything needed to order a server: the plans on sale with their prices for each billing cycle, the operating system images, the regions, and the account-independent rules (minimum balance, snapshot limits). Call this before [Create a VM](#tag/Virtual-Machines).

Only plans and images that can actually be provisioned in a region you can use are listed.

The response carries an `ETag`: send it back in `If-None-Match` and an unchanged catalog answers `304 Not Modified` with no body. With `view=shell` you get only `cycles`, `settings` and `account` (a few KB) — enough for the rules, feature flags and maintenance notice, without the plans, images and regions.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog vm`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `view` | string: `shell` | no | `shell` returns only `cycles`, `settings` and `account`; `plans`, `templates`, `zones` and `default_zone_id` are left out. Omit it for the full catalog. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plans` | array of Plan | yes |  |
| `plans[].id` | integer | yes | Plan identifier. Pass it as `plan_id` when creating a server. |
| `plans[].slug` | string | yes | Stable short name, e.g. `s-2c-4g`. |
| `plans[].name` | string | yes | Display name. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_mb` | integer | yes | Memory in MiB. |
| `plans[].disk_gb` | integer | yes | System disk in GiB. |
| `plans[].hourly_mills` | integer | yes | Price per hour in mills (1 mill = US$0.001), rounded. Use `hourly` for the exact decimal price. |
| `plans[].hourly` | string | yes | Exact price per hour as a decimal string, e.g. `$0.004704`. |
| `plans[].hourly_uusd` | integer | no | Exact price per hour in micro-dollars (1 = US$0.000001), e.g. `5500` = US$0.0055. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `plans[].description` | string or null | no | Marketing description of the plan. |
| `plans[].cycles` | array of CycleQuote | no |  |
| `plans[].cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `plans[].cycles[].name` | string | yes | Display name of the cycle. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `plans[].cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `plans[].cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `plans[].zone_id` | integer | no | Region the plan is sold in. See `zones`. |
| `plans[].cpu_type` | string or null: `A`, `B`, `D` | no | CPU type of the plan in regions that offer several: `A` Availability (shared cores, best value), `B` General Purpose (consistent performance), `D` Dedicated (dedicated cores). `null` in the platform's standard regions. |
| `templates` | array of CatalogOs | yes |  |
| `templates[].id` | integer | yes | OS image identifier. Pass it as `template_id` when creating a server. |
| `templates[].display_name` | string | yes | Human readable name, e.g. `Ubuntu 24.04 LTS`. |
| `templates[].os_family` | string | yes | `linux`, `windows`, `bsd` ... |
| `templates[].os_version` | string or null | yes | Version label, when known. |
| `templates[].username` | string | yes | Default administrator account name of the image. |
| `templates[].icon` | string or null | no | Icon name. |
| `templates[].size_gb` | integer or null | yes | Minimum system disk the image needs, in GiB, when known. |
| `templates[].zone_ids` | array of integer | yes |  |
| `templates[].license_monthly_cents` | integer or null | no | Operating-system license fee in US cents for a 30-day month (730 hours), added to the plan price. `0` for free operating systems and `null` for images that are not sold with a licensed region. Windows images carry a fee. |
| `templates[].license_hourly_uusd` | integer or null | no | The same license fee per hour, in millionths of a US dollar. |
| `templates[].cycles` | array or null | no |  |
| `templates[].min` | object or null | no |  |
| `templates[].min.cpu` | integer | yes | Smallest number of vCPU cores this image can be installed on. |
| `templates[].min.ram_mb` | integer | yes | Smallest memory in MiB. |
| `templates[].min.disk_gb` | integer | yes | Smallest system disk in GiB. |
| `templates[].category` | string | no | `desktop` for a VM Desktop image (Ubuntu Desktop, at least 16 GB of memory), empty for a standard image. A plan below `min` is rejected with `image_requirements`. |
| `cycles` | array of object | yes |  |
| `cycles[].slug` | string | yes | Cycle identifier. |
| `cycles[].name` | string | yes | Display name. |
| `cycles[].months` | integer | yes | Months in the cycle. |
| `cycles[].discount_pct` | number | yes | Discount percent. |
| `zones` | array of VmCatalogZone | yes | Regions you can order a server in. Besides the region itself, each one tells what servers there can do (`capabilities`), which billing cycles are sold (`cycles`), how traffic is provided (`traffic`) and whether a stopped server is still charged (`billed_when_stopped`). Plans and images carry `zone_id` / `zone_ids` to say where they are sold. |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when creating a server. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | no | English display name. |
| `zones[].country` | string | no | ISO country code. |
| `zones[].city` | string or null | no | City. |
| `zones[].capabilities` | VmCapabilities | yes | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `zones[].capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `zones[].capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `zones[].capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `zones[].capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `zones[].capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `zones[].capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `zones[].capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `zones[].capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `zones[].capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `zones[].capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `zones[].capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `zones[].capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `zones[].capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `zones[].capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `zones[].capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `zones[].capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `zones[].capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `zones[].capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `zones[].capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `zones[].capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `zones[].capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `zones[].capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `zones[].capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `zones[].capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `zones[].capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `zones[].cycles` | array or null | yes |  |
| `zones[].traffic` | VmTraffic or null | yes |  |
| `zones[].billed_when_stopped` | boolean | yes | `true` when a stopped server in this region is still charged, at a reduced hourly rate, because its disk and address stay reserved. `false` otherwise. |
| `zones[].continent` | string or null: `asia`, `europe`, `north_america`, `middle_east`, `oceania` | no | Continent of the region, for grouping. `null` in the platform's standard regions. |
| `zones[].price_from_cents` | integer or null | no | Monthly price in US cents of the cheapest fixed plan on sale in the region. `null` in the platform's standard regions. |
| `zones[].custom` | VmCatalogCustom or null | no |  |
| `zones[].extras` | VmZoneExtras or null | no |  |
| `default_zone_id` | integer or null | yes | Region used when you omit `zone_id`, or null when you must choose. |
| `settings` | object | yes | Site rules: `min_balance_cents`, `min_topup_cents`, `hours_per_month`, `snapshot_limit`, feature flags and similar. Fields may be added over time. |
| `account` | object | yes |  |
| `account.email_verified` | boolean | yes | Whether the account e-mail is verified. Servers can only be created once it is. |
| `account.lang` | string | yes | Preferred language of the account. |

Example:

```json
{
  "account": {
    "email_verified": true,
    "lang": "en"
  },
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "default_zone_id": 1,
  "plans": [
    {
      "cpu": 2,
      "cycles": [
        {
          "cents": 343,
          "discount_pct": 0.0,
          "months": 1,
          "name": "Monthly",
          "slug": "monthly"
        }
      ],
      "description": "2 vCPU, 4 GB RAM, 60 GB SSD",
      "disk_gb": 60,
      "hourly": "$0.004704",
      "hourly_mills": 7,
      "id": 3,
      "monthly_cents": 343,
      "name": "Standard 2/4",
      "ram_mb": 4096,
      "slug": "s-2c-4g",
      "zone_id": 1
    }
  ],
  "settings": {
    "hours_per_month": 730,
    "min_balance_cents": 500,
    "snapshot_limit": 3
  },
  "templates": [
    {
      "display_name": "Ubuntu 24.04 LTS",
      "icon": "ubuntu",
      "id": 11,
      "os_family": "linux",
      "os_version": "24.04",
      "size_gb": 10,
      "username": "ubuntu",
      "zone_ids": [
        1
      ]
    }
  ],
  "zones": [
    {
      "billed_when_stopped": false,
      "capabilities": {
        "autoscale": true,
        "backup": true,
        "bandwidth": true,
        "byoip": true,
        "change_ip": true,
        "console": "vnc",
        "ddos_shield": true,
        "firewall": true,
        "hypervisor": true,
        "ipv6": true,
        "iso": true,
        "metrics": true,
        "metrics_mem_disk": true,
        "nics": true,
        "port_forward": true,
        "private_ip": true,
        "reinstall": true,
        "reset_password": true,
        "resize_cpu_ram": true,
        "resize_disk_grow": true,
        "resize_live": true,
        "snapshot": true,
        "ssh_key_reset": true,
        "volumes": true,
        "vpc": true
      },
      "city": "Ho Chi Minh City",
      "country": "VN",
      "cycles": null,
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1",
      "traffic": null
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/vm/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public price list of the site

`GET /v1/public/plans`

Returns the public price list of the site: fixed plans and the unit prices of custom configurations. It is the same information as the pricing page, with no account data, and is cached for up to a minute.

Use [Get the VM catalog](#operation/catalog_vm) when you also need images and regions.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog plans`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plans` | array of object | yes |  |
| `plans[].name` | string | yes | Display name. |
| `plans[].slug` | string | yes | Stable short name. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_mb` | integer | yes | Memory in MiB. |
| `plans[].disk_gb` | integer | yes | System disk in GiB. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].hourly` | string | yes | Price per hour as a decimal string. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month in US cents. |
| `custom` | object | yes | Custom configuration pricing: `enabled`, unit prices per vCPU / GB RAM / GB disk, limits and allowed cycles. |
| `settings` | object | yes | Site settings relevant to prices: `port_speed`, `bw_quota_gb`, `hours_per_month`, `min_balance_cents`, `brand_name`, `fx`. |

Example:

```json
{
  "custom": {
    "enabled": false
  },
  "plans": [
    {
      "cpu": 2,
      "disk_gb": 60,
      "hourly": "$0.004704",
      "hourly_uusd": 4704,
      "monthly_cents": 343,
      "name": "Standard 2/4",
      "ram_mb": 4096,
      "slug": "s-2c-4g"
    }
  ],
  "settings": {
    "brand_name": "Example Cloud",
    "bw_quota_gb": 2048,
    "hours_per_month": 730,
    "min_balance_cents": 500,
    "port_speed": "10 Gbps"
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/public/plans" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Unit prices per component (vCPU, RAM, disk)

`GET /v1/vm/prices`

Returns the price of every plan on sale for each billing cycle, plus the unit prices used for custom configurations. A compact alternative to the catalog when you only need prices (for example to display a cost estimate).

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog prices`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `hpm` | integer | yes | Hours in a billing month (730). |
| `fx` | object | yes | Public exchange-rate information used to display local-currency prices. |
| `plans` | array of object | yes |  |
| `plans[].id` | integer | yes | Plan identifier. |
| `plans[].slug` | string | yes | Stable short name. |
| `plans[].name` | string | yes | Display name. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].hourly` | string | yes | Price per hour as a decimal string. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month in US cents. |
| `plans[].cycles` | array of CycleQuote | yes |  |
| `plans[].cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `plans[].cycles[].name` | string | yes | Display name of the cycle. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `plans[].cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `plans[].cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `custom` | object | yes | Custom configuration unit prices and limits (`enabled` is false when the site does not sell custom configurations). |

Example:

```json
{
  "custom": {
    "enabled": false
  },
  "fx": {},
  "hpm": 730,
  "plans": [
    {
      "cycles": [
        {
          "cents": 343,
          "discount_pct": 0.0,
          "months": 1,
          "name": "Monthly",
          "slug": "monthly"
        }
      ],
      "hourly": "$0.004704",
      "hourly_uusd": 4704,
      "id": 3,
      "monthly_cents": 343,
      "name": "Standard 2/4",
      "slug": "s-2c-4g"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/vm/prices" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a custom configuration

`GET /v1/vm/custom-quote`

Prices a custom configuration (any vCPU / RAM / disk combination within the site limits) without creating anything and without charging. The response includes the cost per billing cycle, the cost of the first charge, a per-resource breakdown, the cheapest fixed plan that is at least as large, and your current balance, so you can check you can afford it before calling Create a VM with `custom`.

The site must sell custom configurations; otherwise the call fails with `feature_disabled`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog custom-quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `cpu` | integer | yes | Number of vCPU cores. |
| `ram_mb` | integer | yes | Memory in MiB. |
| `disk_gb` | integer | yes | System disk in GiB. |
| `cycle` | string | no | Billing cycle slug (see the catalog). |
| `template_id` | integer | no | OS image the disk must fit; the quote reports the minimum disk it needs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cpu` | integer | yes | Requested vCPU cores. |
| `ram_mb` | integer | yes | Requested memory in MiB. |
| `disk_gb` | integer | yes | Requested disk in GiB. |
| `cycle` | string | yes | Billing cycle used for the quote. |
| `months` | integer | yes | Months in the cycle. |
| `discount_pct` | number | yes | Cycle discount in percent. |
| `hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `hourly` | string | yes | Price per hour as a decimal string. |
| `monthly_cents` | integer | yes | Price for a 30-day month in US cents. |
| `cycle_cents` | integer | yes | Price of one cycle in US cents. |
| `first_charge_cents` | integer | yes | Amount charged from the wallet when the server is created, in US cents. |
| `cycles` | array of CycleQuote | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `breakdown` | object | yes | Per-resource cost: `cpu`, `ram_gb`, `disk_gb`, each with `qty` and `uusd`. |
| `compare` | object or null | yes | Smallest fixed plan that is at least as large, with `cheaper` and `cheaper_pct`; null when none fits. |
| `min_disk_gb` | integer | yes | Smallest disk allowed for the chosen image. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "balance_cents": 2500,
  "breakdown": {
    "cpu": {
      "qty": 4,
      "uusd": 5000
    },
    "disk_gb": {
      "qty": 80,
      "uusd": 2200
    },
    "ram_gb": {
      "qty": 8,
      "uusd": 4000
    }
  },
  "compare": null,
  "cpu": 4,
  "cycle": "monthly",
  "cycle_cents": 818,
  "cycles": [
    {
      "cents": 818,
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "discount_pct": 0.0,
  "disk_gb": 80,
  "first_charge_cents": 818,
  "hourly": "$0.011200",
  "hourly_uusd": 11200,
  "min_disk_gb": 10,
  "monthly_cents": 818,
  "months": 1,
  "ram_mb": 8192
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | The site does not sell custom configurations. |
| 422 | `invalid_argument` | `cpu`, `ram_mb` or `disk_gb` is missing or outside the allowed limits. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/custom-quote?cpu=<cpu>&ram_mb=<ram_mb>&disk_gb=<disk_gb>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a custom configuration in a region (CPU type, cores, RAM, disk)

`GET /v1/vm/px-quote`

Prices a custom size (CPU type, cores, memory, disk) in a region that offers several CPU types, without creating anything and without charging. Only values listed in that region's `custom` block of the catalog are accepted. Use it to show the price while the customer moves the sliders, then send the same values as `custom` (with `cpu_type`) and the region as `zone_id` to Create a VM.

A stopped server in these regions is still charged, at `off_hourly_uusd` per hour. Traffic is billed per gigabyte used (`traffic`). Limited to 60 calls per minute per account.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `catalog region-quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `zone_id` | integer | yes | Region from the catalog `zones` that has a `custom` block. |
| `cpu_type` | string: `A`, `B`, `D` | yes | CPU type: `A` Availability (shared cores, best value), `B` General Purpose (consistent performance), `D` Dedicated (dedicated cores). |
| `cores` | integer | yes | Number of cores, one of the values listed for the CPU type. |
| `ram_mb` | integer | yes | Memory in MiB, one of the values listed for the CPU type. |
| `disk_gb` | integer | yes | System disk in GiB, one of the listed values. |
| `template_id` | integer | no | OS image you intend to install; when given, the size must reach that image's minimum (`min` in the catalog `templates`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `spec` | object | yes |  |
| `spec.cpu_type` | string | yes | CPU type. |
| `spec.cores` | integer | yes | Number of cores. |
| `spec.ram_mb` | integer | yes | Memory in MiB. |
| `spec.disk_gb` | integer | yes | System disk in GiB. |
| `hourly_uusd` | integer | yes | Price per hour while running, in millionths of a US dollar. |
| `hourly` | string | yes | Price per hour as a decimal string. |
| `monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `off_hourly_uusd` | integer | yes | Price per hour while the server is stopped, in millionths of a US dollar. Includes the license fee of a licensed image (it is charged while stopped too). |
| `license` | object or null | no |  |
| `license.family` | string: `server`, `desktop` | yes | Which operating-system license the image needs: Windows Server or Windows desktop. |
| `license.hourly_uusd` | integer | yes | License price per hour, in millionths of a US dollar. Already included in `hourly_uusd`, `off_hourly_uusd` and the cycle prices. |
| `license.monthly_cents` | integer | yes | License price for a 30-day month (730 hours) in US cents. |
| `cycles` | array of CycleQuote | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `traffic` | VmTraffic or null | yes |  |

Example:

```json
{
  "cycles": [
    {
      "cents": 0,
      "discount_pct": 0.0,
      "months": 0,
      "name": "Hourly",
      "slug": "hourly"
    },
    {
      "cents": 8103,
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "hourly": "$0.111",
  "hourly_uusd": 111000,
  "monthly_cents": 8103,
  "off_hourly_uusd": 16000,
  "spec": {
    "cores": 4,
    "cpu_type": "B",
    "disk_gb": 100,
    "ram_mb": 8192
  },
  "traffic": {
    "pay_per_use": true,
    "usd_per_gb": 0.011
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A parameter is missing, not a listed value for the region, or `cpu_type` is not one of A, B, T, D. `detail` names the parameter. |
| 404 | `zone_not_found` | The region does not exist, is not open to your account, or has no custom sizes. |
| 409 | `zone_not_ready` | The region cannot price this size at the moment, or the licensed image (`template_id`) has no license price yet. |
| 409 | `not_supported_in_zone` | Custom sizes are switched off for the region (`capability` is `custom`). |
| 422 | `image_requirements` | `template_id` was given and the size is below the image's minimum. The error carries `min` (`cpu`, `ram_mb`, `disk_gb`). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/px-quote?zone_id=<zone_id>&cpu_type=<cpu_type>&cores=<cores>&ram_mb=<ram_mb>&disk_gb=<disk_gb>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Regions open for sale and starting prices

`GET /v1/public/vm-regions`

Lists the regions where servers are on sale to everyone, with the monthly price of the cheapest fixed plan and the CPU types on offer. It needs no account, is the same for every visitor and is cached for up to five minutes. Use [Get the VM catalog](#operation/catalog_vm) for the full plan list of a signed-in account.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog regions`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `regions` | array of object | yes |  |
| `regions[].slug` | string | yes | Stable short name of the region. |
| `regions[].name` | string | yes | Display name. |
| `regions[].city` | string or null | yes | City. |
| `regions[].iso2` | string | yes | ISO country code. |
| `regions[].continent` | string or null: `asia`, `europe`, `north_america`, `middle_east`, `oceania` | yes | Continent, for grouping. |
| `regions[].price_from_cents` | integer or null | yes | Monthly price in US cents of the cheapest fixed plan. `null` when none is on sale. |
| `regions[].traffic` | object or null | yes |  |
| `regions[].traffic.unlimited` | boolean | yes | Always `true`: bandwidth is unlimited, there is no traffic allowance and no traffic fee. |
| `regions[].traffic.uplink_gbps` | integer | yes | Uplink port speed in Gbit/s (1). |
| `regions[].cpu_types` | array of string: `A`, `B`, `D` | yes |  |
| `updated_at` | integer | yes | When the list was built, Unix seconds. |

Example:

```json
{
  "regions": [
    {
      "city": "Ho Chi Minh City",
      "continent": "asia",
      "cpu_types": [],
      "iso2": "VN",
      "name": "Ho Chi Minh City",
      "price_from_cents": 343,
      "slug": "hcm-1",
      "traffic": null
    },
    {
      "city": "Singapore",
      "continent": "asia",
      "cpu_types": [
        "A",
        "B",
        "D"
      ],
      "iso2": "SG",
      "name": "Singapore",
      "price_from_cents": 402,
      "slug": "sg-singapore",
      "traffic": {
        "unlimited": true,
        "uplink_gbps": 1
      }
    }
  ],
  "updated_at": 1792400000
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | The site you call is not the main site. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/vm-regions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### One region in detail: CPU types, plans, custom sizes, traffic, cycles

`GET /v1/public/vm-regions/{slug}`

Describes one region that is on sale to everyone: its CPU types (with a one-line description), every fixed plan with its hourly and monthly price, the custom sizes you can build (same `custom` block as the catalog), the price of traffic and the billing cycles sold there. It needs no account and is cached for up to five minutes.

Use [Quote a custom size (public)](#operation/catalog_region-price) to price a custom size, and [List regions](#operation/catalog_regions) to find the `slug`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog region`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `slug` | string | yes | Region `slug` from List regions. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `region` | object | yes |  |
| `region.slug` | string | yes | Stable short name of the region. |
| `region.name` | string | yes | Display name. |
| `region.city` | string or null | yes | City. |
| `region.iso2` | string | yes | ISO country code. |
| `region.continent` | string or null: `asia`, `europe`, `north_america`, `middle_east`, `oceania` | yes | Continent, for grouping. |
| `cpu_types` | array of object | yes |  |
| `cpu_types[].type` | string: `A`, `B`, `D` | yes | CPU type. |
| `cpu_types[].label` | string | yes | Display name: `Availability`, `General Purpose` or `Dedicated`. |
| `cpu_types[].description` | string | yes | One-line description of the CPU type. |
| `plans` | array of object | yes |  |
| `plans[].id` | integer | yes | Plan identifier. |
| `plans[].cpu_type` | string or null: `A`, `B`, `D` | yes | CPU type of the plan. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_mb` | integer | yes | Memory in MiB. |
| `plans[].disk_gb` | integer | yes | System disk in GiB. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `custom` | VmCatalogCustom or null | yes |  |
| `traffic` | object or null | yes |  |
| `traffic.unlimited` | boolean | yes | Always `true`: bandwidth is unlimited, there is no traffic allowance and no traffic fee. |
| `traffic.uplink_gbps` | integer | yes | Uplink port speed in Gbit/s (1). |
| `cycles` | array of string | yes |  |

Example:

```json
{
  "cpu_types": [
    {
      "description": "Shared cores, best value",
      "label": "Availability",
      "type": "A"
    }
  ],
  "custom": null,
  "cycles": [
    "hourly",
    "monthly"
  ],
  "plans": [
    {
      "cpu": 1,
      "cpu_type": "A",
      "disk_gb": 20,
      "hourly_uusd": 5500,
      "id": 41,
      "monthly_cents": 402,
      "ram_mb": 1024
    }
  ],
  "region": {
    "city": "Singapore",
    "continent": "asia",
    "iso2": "SG",
    "name": "Singapore",
    "slug": "sg-singapore"
  },
  "traffic": {
    "unlimited": true,
    "uplink_gbps": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `zone_not_found` | The region does not exist or is not on sale, or the site you call is not the main site. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/vm-regions/<slug>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a custom size in a region (public)

`GET /v1/public/vm-quote`

Prices a custom size in a region without an account: the same answer as [Quote a custom size in a region](#operation/catalog_region-quote) but for visitors. Only values listed in the region's `custom` block are accepted. Limited to 30 calls per minute per IP address.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog region-price`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `region` | string | yes | Region `slug` from List regions. |
| `cpu_type` | string: `A`, `B`, `D` | yes | CPU type: `A` Availability, `B` General Purpose, `D` Dedicated. |
| `cores` | integer | yes | Number of cores, one of the values listed for the CPU type. |
| `ram_mb` | integer | yes | Memory in MiB, one of the values listed for the CPU type. |
| `disk_gb` | integer | yes | System disk in GiB, one of the listed values. |
| `template_id` | integer | no | OS image you intend to install; when given, the size must reach that image's minimum. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `spec` | object | yes |  |
| `spec.cpu_type` | string | yes | CPU type. |
| `spec.cores` | integer | yes | Number of cores. |
| `spec.ram_mb` | integer | yes | Memory in MiB. |
| `spec.disk_gb` | integer | yes | System disk in GiB. |
| `hourly_uusd` | integer | yes | Price per hour while running, in millionths of a US dollar. |
| `hourly` | string | yes | Price per hour as a decimal string. |
| `monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `off_hourly_uusd` | integer | yes | Price per hour while the server is stopped, in millionths of a US dollar. Includes the license fee of a licensed image (it is charged while stopped too). |
| `license` | object or null | no |  |
| `license.family` | string: `server`, `desktop` | yes | Which operating-system license the image needs: Windows Server or Windows desktop. |
| `license.hourly_uusd` | integer | yes | License price per hour, in millionths of a US dollar. Already included in `hourly_uusd`, `off_hourly_uusd` and the cycle prices. |
| `license.monthly_cents` | integer | yes | License price for a 30-day month (730 hours) in US cents. |
| `cycles` | array of CycleQuote | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `traffic` | VmTraffic or null | yes |  |

Example:

```json
{
  "cycles": [
    {
      "cents": 0,
      "discount_pct": 0.0,
      "months": 0,
      "name": "Hourly",
      "slug": "hourly"
    },
    {
      "cents": 10118,
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "hourly": "$0.1386",
  "hourly_uusd": 138600,
  "monthly_cents": 10118,
  "off_hourly_uusd": 15400,
  "spec": {
    "cores": 4,
    "cpu_type": "B",
    "disk_gb": 100,
    "ram_mb": 8192
  },
  "traffic": {
    "pay_per_use": true,
    "usd_per_gb": 0.011
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A parameter is missing or is not a listed value for the region. `detail` names the parameter. |
| 404 | `zone_not_found` | The region does not exist or is not on sale. |
| 409 | `zone_not_ready` | The region cannot price this size at the moment. |
| 422 | `image_requirements` | `template_id` was given and the size is below the image's minimum. The error carries `min` (`cpu`, `ram_mb`, `disk_gb`). |
| 429 | `rate_limited` | More than 30 calls per minute from this IP address. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/vm-quote?region=<region>&cpu_type=<cpu_type>&cores=<cores>&ram_mb=<ram_mb>&disk_gb=<disk_gb>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Sale zones and per-service availability

`GET /v1/zones`

Lists the regions your site sells from, with the availability of each service in each region: virtual machines (`vm`), VPN IPs (`vpn`, with the number of free IPs) and object storage (`s3`). Use a region `id` as `zone_id` when ordering. Add `service` to keep only the regions where that service is on sale.

`default_zone_id` is the region used when an order omits `zone_id`; it is always one of the listed regions, or null when the list is empty. The response may be cached for 15 seconds.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog zones`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `service` | string: `vm`, `vpn`, `s3` | no | Only return regions where this service is sold. For `vm` and `s3` the region must also be ready to take orders; for `vpn` every region that sells VPN is returned, so check `vpn.available`. Omit to return every region. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].is_default` | boolean | yes | Whether this is the default region of the site. |
| `zones[].services` | array of string | yes |  |
| `zones[].vm` | object | yes |  |
| `zones[].vm.available` | boolean | yes | Whether servers can be created in this region right now. |
| `zones[].vpn` | object | yes |  |
| `zones[].vpn.available` | boolean | yes | Whether the region sells VPN IPs and has at least one free IP. |
| `zones[].vpn.free_ips` | integer | yes | Number of free VPN IPs that can be ordered in the region. |
| `zones[].s3` | object | yes |  |
| `zones[].s3.available` | boolean | yes | Whether object storage can be ordered in this region right now. |
| `default_zone_id` | integer or null | yes | Default region; null when no region is listed. |

Example:

```json
{
  "default_zone_id": 1,
  "zones": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "is_default": true,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "s3": {
        "available": true
      },
      "services": [
        "vm",
        "vpn",
        "s3"
      ],
      "slug": "hcm-1",
      "vm": {
        "available": true
      },
      "vpn": {
        "available": true,
        "free_ips": 120
      }
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 422 | `invalid_service` | `service` is not `vm`, `vpn` or `s3`. |

**Example request**

```bash
curl "https://api.onie.net/v1/zones" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Consolidated site pricing (VMs, storage, enabled features)

`GET /v1/public/pricing`

Returns the complete retail price list of the site in one call: every fixed plan with the price of each billing cycle, the unit prices of custom configurations, the unit prices of the optional storage services, and the list of optional features switched on for the site. It is the data behind a public pricing page and contains no account information. Hourly prices are in millionths of a US dollar (`hourly_uusd`) and cycle prices are in US cents. The response may be cached for 60 seconds.

Plans here have no identifiers; use [Get the VM catalog](#operation/catalog_vm) to get the `plan_id` and image identifiers needed to create a server.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog pricing`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plans` | array of object | yes |  |
| `plans[].name` | string | yes | Display name. |
| `plans[].slug` | string | yes | Stable short name. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_mb` | integer | yes | Memory in MiB. |
| `plans[].disk_gb` | integer | yes | System disk in GiB. |
| `plans[].hourly_mills` | integer | yes | Price per hour in mills (1 mill = US$0.001), rounded. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar (exact). |
| `plans[].hourly` | string | yes | Price per hour as a decimal string, e.g. `$0.004704`. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `plans[].cycles` | array of CycleQuote | no |  |
| `plans[].cycles[].slug` | string | yes | Billing cycle identifier, e.g. `monthly`, `quarterly`, `yearly`. |
| `plans[].cycles[].name` | string | yes | Display name of the cycle. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `plans[].cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent. |
| `plans[].cycles[].cents` | integer | yes | Price of one full cycle in US cents (0 for pay-by-the-hour). |
| `custom` | object | yes | Custom configuration pricing (any vCPU / RAM / disk combination within `limits`). |
| `custom.enabled` | boolean | yes | Whether the site sells custom configurations. When false no other field is present. |
| `custom.unit_uusd_h` | object | no |  |
| `custom.unit_uusd_h.cpu` | integer | yes | Price of one vCPU per hour, in millionths of a US dollar. |
| `custom.unit_uusd_h.ram_gb` | integer | yes | Price of 1 GB of RAM per hour, in millionths of a US dollar. |
| `custom.unit_uusd_h.disk_gb` | integer | yes | Price of 1 GB of disk per hour, in millionths of a US dollar. |
| `custom.unit_hourly` | object | no |  |
| `custom.unit_hourly.cpu` | string | yes | Same as `unit_uusd_h.cpu` as a decimal string. |
| `custom.unit_hourly.ram_gb` | string | yes | Same as `unit_uusd_h.ram_gb` as a decimal string. |
| `custom.unit_hourly.disk_gb` | string | yes | Same as `unit_uusd_h.disk_gb` as a decimal string. |
| `custom.limits` | object | no |  |
| `custom.limits.cpu` | object | yes | vCPU cores. |
| `custom.limits.ram_gb` | object | yes | RAM in GB. |
| `custom.limits.disk_gb` | object | yes | Disk in GB. |
| `custom.cycles` | array of object | no |  |
| `custom.cycles[].slug` | string | yes | Billing cycle identifier. |
| `custom.cycles[].name` | string | yes | Display name of the cycle. |
| `custom.cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `custom.cycles[].discount_pct` | number | yes | Discount applied for paying this cycle up front, in percent. |
| `custom.cycle_discount` | boolean | no | Whether the cycle discounts also apply to custom configurations. |
| `custom.from_monthly_cents` | integer | no | Monthly price of the smallest allowed configuration, in US cents. |
| `settings` | object | yes |  |
| `settings.port_speed` | string | yes | Network port speed of servers, e.g. `10 Gbps`. |
| `settings.bw_quota_gb` | integer | yes | Monthly outbound traffic included with each server, in GB. 0 when traffic is not metered. |
| `settings.hours_per_month` | integer | yes | Hours in a billing month (730). |
| `settings.min_balance_cents` | integer | yes | Minimum wallet balance needed to create a server, in US cents. |
| `settings.brand_name` | string | yes | Name of the provider. |
| `settings.fx` | CatalogFx | yes |  |
| `settings.fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `settings.fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `settings.fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `settings.fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `settings.fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `settings.fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `settings.fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `settings.fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |
| `storage` | object | yes | Unit prices of the optional storage services that are switched on. Fields of services that are off are absent. See [Get storage prices](#operation/catalog_storage) for limits. |
| `storage.volume_uusd_gb_hour` | integer | no | Block storage volume price per GB per hour, in millionths of a US dollar. Present only when volumes are on sale. |
| `storage.backup_uusd_gb_hour` | integer | no | Backup price per GB per hour, in millionths of a US dollar. Present only when backups are on sale. |
| `storage.snapshot_gb_month_cents` | integer | no | Snapshot price per GB per month in US cents, rounded. Snapshots are billed by size at the same price as data volumes. Present only when snapshots are on sale. |
| `storage.snapshot_uusd_gb_hour` | integer | no | Exact snapshot price per GB per hour, in millionths of a US dollar (equal to `volume_uusd_gb_hour`). Present only when snapshots are on sale. |
| `storage.snapshot_limit` | integer | no | Most snapshots per server. Every snapshot is billed by size. Present only when snapshots are on sale. |
| `storage.backup_auto_daily` | boolean | no | `true` when the site runs the automatic daily backup: one free copy per server, extra or pinned copies are billed. Present only when backups are on sale. |
| `features` | object | yes | Optional features of the site, keyed by feature name (for example `snapshots`, `backup`, `volume`, `gpu`, `bandwidth`). Names may be added over time. |

Example:

```json
{
  "custom": {
    "cycle_discount": false,
    "cycles": [
      {
        "discount_pct": 0.0,
        "months": 1,
        "name": "Monthly",
        "slug": "monthly"
      }
    ],
    "enabled": true,
    "from_monthly_cents": 160,
    "limits": {
      "cpu": {
        "max": 16,
        "min": 1,
        "step": 1
      },
      "disk_gb": {
        "max": 500,
        "min": 10,
        "step": 10
      },
      "ram_gb": {
        "max": 64,
        "min": 1,
        "step": 1
      }
    },
    "unit_hourly": {
      "cpu": "$0.002",
      "disk_gb": "$0.00008",
      "ram_gb": "$0.001"
    },
    "unit_uusd_h": {
      "cpu": 2000,
      "disk_gb": 80,
      "ram_gb": 1000
    }
  },
  "features": {
    "backup": true,
    "bandwidth": true,
    "custom_plan": true,
    "gpu": false,
    "snapshots": true,
    "volume": true
  },
  "plans": [
    {
      "cpu": 2,
      "cycles": [
        {
          "cents": 0,
          "discount_pct": 0.0,
          "months": 0,
          "name": "Hourly",
          "slug": "hourly"
        },
        {
          "cents": 343,
          "discount_pct": 0.0,
          "months": 1,
          "name": "Monthly",
          "slug": "monthly"
        }
      ],
      "disk_gb": 60,
      "hourly": "$0.004704",
      "hourly_mills": 5,
      "hourly_uusd": 4704,
      "monthly_cents": 343,
      "name": "Standard 2/4",
      "ram_mb": 4096,
      "slug": "s-2c-4g"
    }
  ],
  "settings": {
    "brand_name": "Example Cloud",
    "bw_quota_gb": 2048,
    "fx": {
      "margin_bp": 0,
      "round_step": 1000,
      "source": "auto",
      "stale": false,
      "updated_at": 1760000100,
      "usd_vnd": 26000,
      "vcb_at": 1760000000,
      "vcb_sell": 26050
    },
    "hours_per_month": 730,
    "min_balance_cents": 500,
    "port_speed": "10 Gbps"
  },
  "storage": {
    "backup_uusd_gb_hour": 76,
    "snapshot_gb_month_cents": 10,
    "snapshot_limit": 3,
    "volume_uusd_gb_hour": 136
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site is closed or inactive. |
| 503 | `catalog_unavailable` | The price list could not be built right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/pricing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Block Storage, Backup, Snapshot and Images pricing

`GET /v1/public/storage`

Returns the retail prices and limits of the storage services: block storage volumes, backups, snapshots and uploaded images. Each service appears as an object with `enabled`; when a service is not on sale at your site only `{"enabled": false}` is returned for it. Prices per GB-hour are in millionths of a US dollar. The response may be cached for 60 seconds.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog storage`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `hours_per_month` | integer | yes | Hours in a billing month (730). |
| `fx` | CatalogFx | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |
| `volume` | object | yes | Block storage volumes. |
| `volume.enabled` | boolean | yes | Whether block storage volumes are on sale. When false no other field is present. |
| `volume.uusd_gb_hour` | integer | no | Price per GB per hour, in millionths of a US dollar. |
| `volume.min_gb` | integer | no | Smallest volume size in GB. |
| `volume.max_gb` | integer | no | Largest volume size in GB. |
| `volume.step_gb` | integer | no | Volume sizes must be a multiple of this many GB. |
| `volume.max_per_vm` | integer | no | Most data volumes that can be attached to one server. |
| `volume.max_per_account` | integer | no | Most data volumes per account. |
| `volume.attach_with_backups` | boolean | no | Whether a volume can be attached to or detached from a server that has backups. When false, delete the server backups first. |
| `backup` | object | yes | Server backups. |
| `backup.enabled` | boolean | yes | Whether backups are on sale. When false no other field is present. |
| `backup.uusd_gb_hour` | integer | no | Price per GB of backup data per hour, in millionths of a US dollar. |
| `backup.max_per_vm` | integer | no | Most backups kept per server. |
| `backup.keep_default` | integer | no | Number of backups kept by default when a schedule does not say otherwise. |
| `backup.auto_daily` | boolean | no | `true` when the automatic daily backup is running on this site. |
| `backup.auto_free_copies` | integer | no | Copies per server that are free under the automatic daily backup (the newest unpinned one). |
| `snapshot` | object | yes | Server snapshots. |
| `snapshot.enabled` | boolean | yes | Whether snapshots are on sale. When false no other field is present. |
| `snapshot.gb_month_cents` | integer | no | Price per GB per month in US cents, rounded. Snapshots are billed by size at the data-volume price. |
| `snapshot.uusd_gb_hour` | integer | no | Exact price per GB per hour, in millionths of a US dollar. |
| `snapshot.limit_per_vm` | integer | no | Most snapshots per server. |
| `snapshot.schedules_per_vm` | integer | no | Most automatic snapshot schedules per server. |
| `images` | object | yes | Uploaded OS and ISO images. |
| `images.enabled` | boolean | yes | Whether uploaded images are on sale. When false no other field is present. |
| `images.uusd_gb_hour` | integer | no | Price per GB of stored image per hour, in millionths of a US dollar. |
| `images.iso_max_gb` | integer | no | Largest ISO image in GB. |
| `images.template_max_gb` | integer | no | Largest OS image in GB. |
| `images.max_per_account` | integer | no | Most images per account. |
| `images.max_gb_per_account` | integer | no | Most total image storage per account, in GB. |

Example:

```json
{
  "backup": {
    "enabled": true,
    "keep_default": 3,
    "max_per_vm": 5,
    "uusd_gb_hour": 76
  },
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "hours_per_month": 730,
  "images": {
    "enabled": false
  },
  "snapshot": {
    "enabled": true,
    "gb_month_cents": 10,
    "limit_per_vm": 3,
    "schedules_per_vm": 2
  },
  "volume": {
    "attach_with_backups": false,
    "enabled": true,
    "max_gb": 2000,
    "max_per_account": 20,
    "max_per_vm": 4,
    "min_gb": 10,
    "step_gb": 10,
    "uusd_gb_hour": 136
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site is closed or inactive. |
| 503 | `catalog_unavailable` | The price list could not be built right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/storage" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public S3 price list

`GET /v1/public/s3`

Returns the public price list of pay-as-you-go object storage: the price per GB of storage and per GB downloaded, the free allowance, and the regions where it can be ordered. Uploads are free.

Unlike the rest of the catalog, **object storage prices are in Vietnamese dong (VND)**, not US dollars. Use `fx.usd_vnd` to convert. Usage is metered per hour (the monthly storage price divided by 730 per GB-hour) and charged to the wallet in US cents at the exchange rate of the day. Object storage is not sold on every site: when your site does not sell it the call returns `404 service_unavailable`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog s3`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `policy` | object | yes |  |
| `policy.storage_price_per_gb_month` | number | yes | Storage price per GB per month, in VND. |
| `policy.bandwidth_out_price_per_gb` | number | yes | Download (outbound traffic) price per GB, in VND. |
| `policy.bandwidth_in_price_per_gb` | number | yes | Upload (inbound traffic) price per GB, in VND. Always 0. |
| `policy.free_tier_gb` | number | yes | Storage in GB that is free while the account has a running server. |
| `zones` | array of CatalogZone | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].is_default` | boolean | yes | Whether this is the default region of the site. |
| `zones[].services` | array of string | yes |  |
| `fx` | CatalogFx | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |
| `units` | object | yes |  |
| `units.gb_bytes` | integer | yes | Bytes in one GB as used for billing (1073741824, i.e. a GiB). |
| `units.hours_per_month` | integer | yes | Hours used to turn the monthly storage price into an hourly one (730). |

Example:

```json
{
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "policy": {
    "bandwidth_in_price_per_gb": 0.0,
    "bandwidth_out_price_per_gb": 999.0,
    "free_tier_gb": 100.0,
    "storage_price_per_gb_month": 399.0
  },
  "units": {
    "gb_bytes": 1073741824,
    "hours_per_month": 730
  },
  "zones": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "is_default": true,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "services": [
        "vm",
        "vpn",
        "s3"
      ],
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell object storage. |
| 503 | `catalog_unavailable` | The price list could not be read right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/s3" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public VPN IPv4 price list

`GET /v1/public/vpn`

Returns the public price list of VPN IPs: the price per IP at each order size, the bandwidth tiers, the add-ons, the billing cycles and the regions. Only the `dedicated` tier is on sale; `shared` and `private` stay in the response for compatibility but have empty `ip_breaks`. All prices are in millionths of a US dollar. The response may be cached for 60 seconds.

To price a specific order call [Quote a VPN order](#operation/catalog_vpn_quote). When your site does not sell VPN the call returns `404 service_unavailable`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog vpn`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `shared` | VpnTierPricing | yes |  |
| `shared.ip_breaks` | array of object | yes |  |
| `shared.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `shared.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `shared.bw_breaks` | array of object | yes |  |
| `shared.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `shared.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `shared.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `shared.max_ips` | integer | yes | Largest number of IPs in one order. |
| `private` | VpnTierPricing | yes |  |
| `private.ip_breaks` | array of object | yes |  |
| `private.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `private.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `private.bw_breaks` | array of object | yes |  |
| `private.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `private.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `private.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `private.max_ips` | integer | yes | Largest number of IPs in one order. |
| `dedicated` | VpnTierPricing | yes |  |
| `dedicated.ip_breaks` | array of object | yes |  |
| `dedicated.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `dedicated.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `dedicated.bw_breaks` | array of object | yes |  |
| `dedicated.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `dedicated.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `dedicated.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `dedicated.max_ips` | integer | yes | Largest number of IPs in one order. |
| `addons` | array of VpnAddonPrice | yes |  |
| `addons[].key` | string | yes | Add-on key. Pass it in the `addons` list of a quote or order. |
| `addons[].name` | string | yes | Display name. |
| `addons[].uusd_month` | integer | yes | Monthly price of the add-on, in millionths of a US dollar. |
| `cycles` | array of VpnCyclePrice | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier, e.g. `daily`, `weekly`, `monthly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. It is a label only; use `slug` in requests. |
| `cycles[].months` | integer | yes | Length of the cycle in months; 0 for day-based cycles. |
| `cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent (month-based cycles). |
| `cycles[].days` | integer | yes | Length of the cycle in days for day-based cycles; 0 otherwise. |
| `cycles[].price_bp` | integer | yes | For day-based cycles, price of one cycle as a share of the monthly price in basis points (10000 = the full monthly price); 0 otherwise. |
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].available` | boolean | yes | Whether the region can take new orders right now. |
| `fx` | CatalogFx | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "addons": [
    {
      "key": "concurrency",
      "name": "High Concurrency",
      "uusd_month": 10090000
    }
  ],
  "cycles": [
    {
      "days": 1,
      "discount_pct": 0.0,
      "months": 0,
      "name": "Daily",
      "price_bp": 500,
      "slug": "daily"
    },
    {
      "days": 0,
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "price_bp": 0,
      "slug": "monthly"
    },
    {
      "days": 0,
      "discount_pct": 30.0,
      "months": 12,
      "name": "Yearly",
      "price_bp": 0,
      "slug": "yearly"
    }
  ],
  "dedicated": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      },
      {
        "gb": 1000,
        "uusd_month": 13460000
      },
      {
        "gb": 0,
        "uusd_month": 61890000
      }
    ],
    "ip_breaks": [
      {
        "min_ip": 1,
        "uusd_ip_month": 958000
      },
      {
        "min_ip": 10,
        "uusd_ip_month": 843000
      }
    ],
    "max_ips": 10000,
    "min_ips": 1
  },
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "private": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      }
    ],
    "ip_breaks": [],
    "max_ips": 15000,
    "min_ips": 1
  },
  "shared": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      },
      {
        "gb": 1000,
        "uusd_month": 13460000
      }
    ],
    "ip_breaks": [],
    "max_ips": 15000,
    "min_ips": 1
  },
  "zones": [
    {
      "available": true,
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell VPN. |
| 503 | `catalog_unavailable` | The price list could not be read right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/vpn" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a VPN IPv4 order (nothing is purchased)

`POST /v1/public/vpn/quote`

Prices a VPN order without creating anything and without charging. The body describes the order (tier, number of IPs, bandwidth tier, billing cycle, add-ons) and the response is the price breakdown in millionths of a US dollar; `total_uusd` is what one cycle costs.

When the order is not valid (for example too many IPs or an unknown cycle) the call returns **422 with the same quote object**, whose `errors` array lists the problems. Orders for the retired `shared` and `private` tiers or for retired add-ons fail with `tier_retired` or `addon_retired` in the usual error format. A body that cannot be parsed at all gets a plain-text 400 or 422 from the server rather than the usual error object. When your site does not sell VPN the call returns `404 service_unavailable`.

The account-level call [Quote a VPN order for your account](#operation/vpn_quote) also returns the wallet amount in cents.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog vpn-quote`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `tier` | string: `shared`, `private`, `dedicated` | yes | IP sharing tier. Only `dedicated` can be ordered; the other two are rejected with `tier_retired`. |
| `ip_count` | integer | yes | Number of IPs, at least 1. The allowed maximum is in the catalog (`dedicated.max_ips`). |
| `bandwidth_gb` | integer | yes | Monthly bandwidth tier in GB; must be one of the catalog `bw_breaks[].gb` values. 0 means unlimited (fair use). |
| `cycle` | string | yes | Billing cycle slug from the catalog `cycles`, e.g. `monthly`. |
| `addons` | array of string | no | Add-ons to include. Default none. Duplicates are ignored; at most 16 entries. |
| `zone_id` | integer | no | Region to order from, as returned by `zones`. Does not change the price. |
| `zone` | string | no | Region slug, used when `zone_id` is not given. Does not change the price. |

Example:

```json
{
  "addons": [
    "concurrency"
  ],
  "bandwidth_gb": 1000,
  "cycle": "monthly",
  "ip_count": 10,
  "tier": "dedicated"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `tier` | string | yes | Tier that was priced: `shared`, `private` or `dedicated`. |
| `ip_count` | integer | yes | Number of IPs priced. When the request was outside the allowed range the value is clamped to the nearest limit and `errors` explains why. |
| `bandwidth_gb` | integer | yes | Monthly bandwidth in GB that was priced (0 = unlimited). |
| `cycle` | string | yes | Billing cycle slug that was priced. |
| `months` | integer | yes | Length of the cycle in months (0 for day-based cycles). |
| `days` | integer | yes | Length of the cycle in days for day-based cycles (daily, weekly); 0 for monthly cycles. |
| `unit_uusd_month` | integer | yes | Price of one IP per month at this order size, in millionths of a US dollar. |
| `list_unit_uusd_month` | integer | yes | Price of one IP per month at the smallest order size, before volume pricing, in millionths of a US dollar. |
| `ips_uusd_month` | integer | yes | IP part of the monthly price (`unit_uusd_month` x `ip_count`), in millionths of a US dollar. |
| `bandwidth_uusd_month` | integer | yes | Bandwidth part of the monthly price, in millionths of a US dollar. |
| `addons_uusd_month` | integer | yes | Add-on part of the monthly price, in millionths of a US dollar. |
| `addon_lines` | array of array | yes |  |
| `monthly_uusd` | integer | yes | Monthly price before the cycle discount (IPs + bandwidth + add-ons), in millionths of a US dollar. |
| `list_monthly_uusd` | integer | yes | Monthly price at list (non-volume) unit prices, for strike-through display, in millionths of a US dollar. |
| `discount_pct` | number | yes | Cycle discount applied to the total, in percent (0 for day-based cycles). |
| `total_uusd` | integer | yes | Total for one full cycle after the cycle discount, in millionths of a US dollar. This is the amount an order would be charged. |
| `effective_monthly_uusd` | integer | yes | `total_uusd` converted to a per-month figure, for display only, in millionths of a US dollar. |
| `errors` | array of string | yes |  |

Example:

```json
{
  "addon_lines": [
    [
      "High Concurrency",
      10090000
    ]
  ],
  "addons_uusd_month": 10090000,
  "bandwidth_gb": 1000,
  "bandwidth_uusd_month": 13460000,
  "cycle": "monthly",
  "days": 0,
  "discount_pct": 0.0,
  "effective_monthly_uusd": 31980000,
  "errors": [],
  "ip_count": 10,
  "ips_uusd_month": 8430000,
  "list_monthly_uusd": 33120000,
  "list_unit_uusd_month": 958000,
  "monthly_uusd": 31980000,
  "months": 1,
  "tier": "dedicated",
  "total_uusd": 31980000,
  "unit_uusd_month": 843000
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell VPN. |
| 422 | `tier_retired` | The `shared` and `private` tiers are no longer sold; use `dedicated`. |
| 422 | `addon_retired` | An add-on in the request is no longer sold. |
| 503 | `catalog_unavailable` | The price list could not be read right now. Retry shortly. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/public/vpn/quote" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"addons":["concurrency"],"bandwidth_gb":1000,"cycle":"monthly","ip_count":10,"tier":"dedicated"}'
```

---

#### Public worldwide proxy price list (Datacenter, Static/Rotating Residential)

`GET /v1/public/proxy`

Returns the public price list of the worldwide proxy products: Datacenter, Static Residential (fixed IPs, priced per IP per month with a 250 GB traffic allowance) and Rotating Residential (priced per GB of traffic). For each product it lists the countries with stock, the price a customer pays from, and sample price tiers. All prices are in millionths of a US dollar and already include every fee. Stock numbers are rounded down. The response may be cached for 10 minutes.

When the products are not on sale `enabled` is false and nothing else is returned. Place an order from your account with the VPN order flow.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog proxy intl`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the worldwide proxy products are on sale. When false no other field is present. |
| `kinds` | array of object | no |  |
| `kinds[].kind` | string: `dc`, `isp`, `resi` | yes | `dc` Datacenter, `isp` Static Residential, `resi` Rotating Residential. |
| `kinds[].unit` | string: `ip`, `gb` | yes | What the price is per: one IP per month, or one GB of traffic. |
| `kinds[].gb` | integer or null | no | Traffic allowance in GB of the sample plan (IP-based products); null for traffic-priced products. |
| `kinds[].cycles` | array of string | yes |  |
| `kinds[].from_uusd` | integer | yes | Lowest price per unit (`unit`) across the tiers, in millionths of a US dollar. |
| `kinds[].tiers` | array of object | yes |  |
| `kinds[].tiers[].qty` | integer | yes | Number of IPs or GB the tier prices. |
| `kinds[].tiers[].total_uusd` | integer | yes | Price of the whole tier for one month, in millionths of a US dollar. |
| `kinds[].tiers[].unit_uusd` | integer | yes | Price per IP or per GB at this tier, in millionths of a US dollar. |
| `kinds[].countries` | array of object | yes |  |
| `kinds[].countries[].code` | string | yes | ISO 3166-1 alpha-2 country code. |
| `kinds[].countries[].stock` | integer | no | IPs in stock, rounded down. Absent for traffic-priced products. |
| `supply_hours` | integer | no | Hours within which a paid order is delivered; an order not delivered by then is refunded automatically. |
| `fx` | CatalogFx | no |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "enabled": true,
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "kinds": [
    {
      "countries": [
        {
          "code": "DE",
          "stock": 480
        },
        {
          "code": "US",
          "stock": 900
        }
      ],
      "cycles": [
        "monthly"
      ],
      "from_uusd": 1890000,
      "gb": 250,
      "kind": "dc",
      "tiers": [
        {
          "qty": 1,
          "total_uusd": 1890000,
          "unit_uusd": 1890000
        },
        {
          "qty": 10,
          "total_uusd": 15000000,
          "unit_uusd": 1500000
        }
      ],
      "unit": "ip"
    }
  ],
  "supply_hours": 24
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell VPN products. |
| 503 | `catalog_unavailable` | The price list could not be read right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/proxy" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public Proxy IPv6 price list

`GET /v1/public/proxy6`

Returns the public price list of IPv6 proxies: the fixed plans with the price of each billing period, the bandwidth and device add-ons, and the regions with their availability. All prices are in millionths of a US dollar. The response may be cached for 60 seconds.

When your site does not sell IPv6 proxies the call returns `200` with just `{"enabled": false}`. When it does not sell VPN products at all it returns `404 service_unavailable`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog proxy6`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the site sells IPv6 proxies. When false no other field is present. |
| `available` | boolean | no | Whether proxies can be ordered right now. False means capacity is temporarily out. |
| `cycles` | array of object | no |  |
| `cycles[].slug` | string | yes | Billing period identifier: `daily`, `weekly`, `monthly` or `yearly`. |
| `cycles[].months` | integer | yes | Length in months (0 for daily and weekly). |
| `cycles[].days` | integer | yes | Length in days (0 for monthly and yearly). |
| `plans` | array of object | no |  |
| `plans[].slug` | string | yes | Plan identifier, e.g. `static-100`. Pass it as `plan` when quoting or ordering. |
| `plans[].kind` | string: `static`, `rotate`, `unlimited` | yes | `static` keeps fixed IPs, `rotate` changes IP on request with a limited number of rotations, `unlimited` rotates without a limit. |
| `plans[].count` | integer | yes | Static plans: number of IPs. Rotating plans: rotations per period. Unlimited plans: 0. |
| `plans[].mbps` | integer | yes | Standard speed of the plan in Mbps. |
| `plans[].devices` | integer | yes | Devices included (0 = not limited per device). |
| `plans[].prices` | Proxy6PriceSet | yes |  |
| `plans[].prices.daily` | integer | yes | Price of one day, in millionths of a US dollar. |
| `plans[].prices.weekly` | integer | yes | Price of one week (7 days), in millionths of a US dollar. |
| `plans[].prices.monthly` | integer | yes | Price of one month, in millionths of a US dollar. |
| `plans[].prices.yearly` | integer | yes | Price of one year, in millionths of a US dollar. |
| `mbps_addon` | object | no |  |
| `mbps_addon.step` | integer | yes | Each add-on unit adds this many Mbps. |
| `mbps_addon.prices` | Proxy6PriceSet | yes |  |
| `mbps_addon.prices.daily` | integer | yes | Price of one day, in millionths of a US dollar. |
| `mbps_addon.prices.weekly` | integer | yes | Price of one week (7 days), in millionths of a US dollar. |
| `mbps_addon.prices.monthly` | integer | yes | Price of one month, in millionths of a US dollar. |
| `mbps_addon.prices.yearly` | integer | yes | Price of one year, in millionths of a US dollar. |
| `mbps_addon.max` | integer | yes | Most units per order. |
| `device_addon` | object | no |  |
| `device_addon.prices` | Proxy6PriceSet | yes |  |
| `device_addon.prices.daily` | integer | yes | Price of one day, in millionths of a US dollar. |
| `device_addon.prices.weekly` | integer | yes | Price of one week (7 days), in millionths of a US dollar. |
| `device_addon.prices.monthly` | integer | yes | Price of one month, in millionths of a US dollar. |
| `device_addon.prices.yearly` | integer | yes | Price of one year, in millionths of a US dollar. |
| `device_addon.max` | integer | yes | Most units per order. |
| `zones` | array of object | no |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].available` | boolean | yes | Whether the region can take new orders right now. |
| `egress` | string | no | Address family of outbound traffic: always `ipv6_only`. |
| `blocked_ports` | array of integer | no |  |
| `fx` | CatalogFx | no |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "available": true,
  "blocked_ports": [
    25,
    465,
    587,
    2525
  ],
  "cycles": [
    {
      "days": 1,
      "months": 0,
      "slug": "daily"
    },
    {
      "days": 7,
      "months": 0,
      "slug": "weekly"
    },
    {
      "days": 0,
      "months": 1,
      "slug": "monthly"
    },
    {
      "days": 0,
      "months": 12,
      "slug": "yearly"
    }
  ],
  "device_addon": {
    "max": 20,
    "prices": {
      "daily": 192000,
      "monthly": 3837000,
      "weekly": 1200000,
      "yearly": 32230000
    }
  },
  "egress": "ipv6_only",
  "enabled": true,
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "mbps_addon": {
    "max": 20,
    "prices": {
      "daily": 192000,
      "monthly": 3837000,
      "weekly": 1200000,
      "yearly": 32230000
    },
    "step": 50
  },
  "plans": [
    {
      "count": 100,
      "devices": 0,
      "kind": "static",
      "mbps": 50,
      "prices": {
        "daily": 288000,
        "monthly": 5755000,
        "weekly": 1800000,
        "yearly": 48342000
      },
      "slug": "static-100"
    }
  ],
  "zones": [
    {
      "available": true,
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell VPN products. |
| 503 | `catalog_unavailable` | The price list could not be read right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/proxy6" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public GPU price list

`GET /v1/public/gpu`

Returns the public price list of GPU servers: the available configurations with their hourly and monthly prices and current stock, and the software templates that can be started on them. Prices are the retail prices for the default disk size (`disk_gb`) in millionths of a US dollar per hour. The list follows the live market, so prices and stock change; it is refreshed at most once a minute.

GPU servers are not sold on every site: when your site does not sell them the call returns `404 service_unavailable`. Right after a restart the first call can return `503 catalog_unavailable`; retry in a few seconds. Use [Get the GPU catalog](#operation/gpu_catalog) for the full catalog needed to order.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog gpu`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | When the market snapshot behind the list was taken (Unix time, seconds, UTC) |
| `stale` | boolean | yes | True when the snapshot could not be refreshed recently and may be out of date. |
| `sales_enabled` | boolean | yes | Whether new GPU orders are being accepted. |
| `hours_per_month` | integer | yes | Hours in a billing month (730). |
| `disk_gb` | integer | yes | Disk size the prices are computed for, in GB. |
| `plans` | array of object | yes |  |
| `plans[].slug` | string | yes | Stable short name of the configuration, e.g. `1x-rtx-4090`. |
| `plans[].name` | string | yes | Display name. |
| `plans[].gpu_name` | string | yes | GPU model. |
| `plans[].model_slug` | string | yes | URL-friendly name of the GPU model, e.g. `rtx-4090`. |
| `plans[].gpu_count` | integer | yes | Number of GPUs. |
| `plans[].vram_gb` | integer | yes | Total GPU memory in GB. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_gb` | integer | yes | System memory in GB. |
| `plans[].disk_gb` | integer | yes | Disk size the price is for, in GB. |
| `plans[].cuda_max` | number | yes | Highest CUDA version supported. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `plans[].storage_uusd_gb_h` | integer | yes | Price per extra GB of disk per hour, in millionths of a US dollar. |
| `plans[].stock` | integer | yes | Number of matching machines in stock. |
| `plans[].is_5090` | boolean | yes | Whether the configuration uses an RTX 5090. |
| `plans[].hot_rank` | integer or null | no | Popularity rank (1 = most popular); null when not ranked. |
| `plans[].hot` | boolean | no | Whether the configuration is among the most popular ones. |
| `templates` | array of object | yes |  |
| `templates[].name` | string | yes | Template name. |
| `templates[].category` | string | yes | Template category. |
| `templates[].is_vm` | boolean | yes | True for a full virtual machine, false for a container. |
| `templates[].default_disk_gb` | integer | yes | Default (and minimum) disk size in GB. |
| `templates[].min_cuda` | number | yes | Lowest CUDA version the template needs. |
| `templates[].min_vram_gb` | integer | yes | Lowest GPU memory the template needs, in GB. |
| `fx` | CatalogFx | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "at": 1760000000,
  "disk_gb": 32,
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "hours_per_month": 730,
  "plans": [
    {
      "cpu": 16,
      "cuda_max": 12.8,
      "disk_gb": 32,
      "gpu_count": 1,
      "gpu_name": "RTX 4090",
      "hot": true,
      "hot_rank": 2,
      "hourly_uusd": 410000,
      "is_5090": false,
      "model_slug": "rtx-4090",
      "monthly_cents": 28400,
      "name": "RTX 4090 - 24 GB",
      "ram_gb": 64,
      "slug": "1x-rtx-4090",
      "stock": 14,
      "storage_uusd_gb_h": 120,
      "vram_gb": 24
    }
  ],
  "sales_enabled": true,
  "stale": false,
  "templates": [
    {
      "category": "Machine learning",
      "default_disk_gb": 32,
      "is_vm": false,
      "min_cuda": 12.0,
      "min_vram_gb": 8,
      "name": "PyTorch"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site does not sell GPU servers. |
| 503 | `catalog_unavailable` | The market list has not been loaded yet. Retry in a few seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/gpu" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public Kubernetes price list

`GET /v1/public/k8s`

Returns the public price list of managed clusters: the worker plans with their hourly, monthly and per-cycle prices, the billing cycles, the versions on sale, the regions, the free control plane and the account limits. Prices are in US cents or millionths of a US dollar as named. The response may be cached for 60 seconds.

When your site does not sell managed clusters the call returns `200` with just `{"enabled": false}`. The same minimal answer is returned while no region is ready to create clusters.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog k8s`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether clusters can be created right now. When false the other fields may be absent or empty. |
| `zones` | array of Zone | no |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when creating resources. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | no | English display name. |
| `zones[].country` | string | no | ISO country code. |
| `zones[].city` | string or null | no | City. |
| `versions` | array of object | no |  |
| `versions[].name` | string | yes | Version name to pass when creating a cluster. |
| `versions[].semver` | string | yes | Semantic version. |
| `versions[].is_default` | boolean | yes | Whether this version is used when none is chosen. |
| `worker_plans` | array of object | no |  |
| `worker_plans[].code` | string | yes | Worker plan code, e.g. `K8S-1`. |
| `worker_plans[].vcpu` | integer | yes | Virtual CPU cores per worker. |
| `worker_plans[].ram_gb` | integer | yes | Memory per worker in GB. |
| `worker_plans[].disk_gb` | integer | yes | Disk per worker in GB. |
| `worker_plans[].hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `worker_plans[].monthly_cents` | integer | yes | Price of one worker for a 30-day month in US cents. |
| `worker_plans[].cycles` | array of object | yes |  |
| `worker_plans[].cycles[].cycle` | string | yes | Billing cycle slug. |
| `worker_plans[].cycles[].months` | integer | yes | Length of the cycle in months. |
| `worker_plans[].cycles[].discount_pct` | number | yes | Cycle discount in percent. |
| `worker_plans[].cycles[].cycle_cents` | integer | yes | Price of one worker for one cycle, in US cents. |
| `worker_disk_gb` | integer | no | Disk size of every worker in GB. |
| `cycles` | array of object | no |  |
| `cycles[].slug` | string | yes | Billing cycle identifier. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied for paying this cycle up front, in percent. |
| `control_plane` | object | no |  |
| `control_plane.free` | boolean | yes | Whether the control plane is free of charge. |
| `control_plane.count` | integer | yes | Number of control plane nodes. |
| `control_plane.cpu` | integer | yes | vCPU cores of the control plane node. |
| `control_plane.ram_mb` | integer | yes | Memory of the control plane node in MiB. |
| `limits` | object | no |  |
| `limits.workers_min` | integer | yes | Fewest workers in a cluster. |
| `limits.workers_max` | integer | yes | Most workers in a cluster. |
| `limits.clusters_max` | integer | yes | Most clusters per account. |
| `hours_per_month` | integer | no | Hours in a billing month (730). |
| `fx` | CatalogFx | no |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "control_plane": {
    "count": 1,
    "cpu": 2,
    "free": true,
    "ram_mb": 2048
  },
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "enabled": true,
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "hours_per_month": 730,
  "limits": {
    "clusters_max": 2,
    "workers_max": 9,
    "workers_min": 1
  },
  "versions": [
    {
      "is_default": true,
      "name": "v1.30.4",
      "semver": "1.30.4"
    }
  ],
  "worker_disk_gb": 70,
  "worker_plans": [
    {
      "code": "K8S-1",
      "cycles": [
        {
          "cycle": "monthly",
          "cycle_cents": 715,
          "discount_pct": 0.0,
          "months": 1
        }
      ],
      "disk_gb": 70,
      "hourly_uusd": 9800,
      "monthly_cents": 715,
      "ram_gb": 4,
      "vcpu": 2
    }
  ],
  "zones": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site is closed or inactive. |
| 503 | `catalog_unavailable` | The price list could not be built right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/k8s" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public Private Cloud price list

`GET /v1/public/vpc`

Returns the public price list of private cloud networks: the plans (dedicated unmetered bandwidth in Mbps) with their hourly, monthly and per-cycle prices, the billing cycles, the region, the account limits and the network features. Prices are in US cents or millionths of a US dollar as named. The response may be cached for 60 seconds.

When your site does not sell private cloud networks the call returns `200` with just `{"enabled": false}`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog vpc`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether private cloud networks are on sale. When false no other field is present. |
| `plans` | array of object | no |  |
| `plans[].slug` | string | yes | Plan identifier. |
| `plans[].name` | string | yes | Display name. |
| `plans[].mbps` | integer | yes | Dedicated unmetered bandwidth in Mbps. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month in US cents. |
| `plans[].cycles` | array of object | yes |  |
| `plans[].cycles[].cycle` | string | yes | Billing cycle slug. |
| `plans[].cycles[].name` | string | yes | Display name of the cycle. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `plans[].cycles[].discount_pct` | number | yes | Cycle discount in percent. |
| `plans[].cycles[].cycle_cents` | integer | yes | Price of one cycle in US cents (0 for hourly). |
| `cycles` | array of object | no |  |
| `cycles[].slug` | string | yes | Billing cycle identifier. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied for paying this cycle up front, in percent. |
| `zone` | Zone or null | no | Region where private cloud networks are created; null when none is ready. |
| `limits` | object | no |  |
| `limits.max_per_account` | integer | yes | Most private cloud networks per account. |
| `limits.max_tiers` | integer | yes | Most subnets (tiers) per network. |
| `limits.max_vms` | integer | yes | Most servers per network. |
| `limits.max_acl_rules` | integer | yes | Most network ACL rules per network. |
| `features` | object | no |  |
| `features.unmetered` | boolean | yes | Traffic is not metered. |
| `features.ipv6_per_tier` | string | yes | IPv6 prefix size given to each subnet, e.g. `/64`. |
| `features.cidr` | string | yes | Address range size of the network, e.g. `/16`. |
| `features.router` | string | yes | Router layout: `single`. |
| `features.network_acl` | boolean | yes | Whether network ACL rules are available. |
| `hours_per_month` | integer | no | Hours in a billing month (730). |
| `fx` | CatalogFx | no |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "enabled": true,
  "features": {
    "cidr": "/16",
    "ipv6_per_tier": "/64",
    "network_acl": true,
    "router": "single",
    "unmetered": true
  },
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "hours_per_month": 730,
  "limits": {
    "max_acl_rules": 50,
    "max_per_account": 1,
    "max_tiers": 3,
    "max_vms": 50
  },
  "plans": [
    {
      "cycles": [
        {
          "cycle": "monthly",
          "cycle_cents": 803,
          "discount_pct": 0.0,
          "months": 1,
          "name": "Monthly"
        }
      ],
      "hourly_uusd": 11000,
      "mbps": 100,
      "monthly_cents": 803,
      "name": "Private Cloud 100 Mbps",
      "slug": "vpc-100"
    }
  ],
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site is closed or inactive. |
| 503 | `catalog_unavailable` | The price list could not be built right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/vpc" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public Dedicated Server (Bare Metal) plans: specifications; prices only while on sale

`GET /v1/public/dedicated`

Returns the public list of Dedicated Server (Bare Metal) plans: a physical Dell PowerEdge server for your exclusive use, with the hardware of each plan. Prices are in whole Vietnamese dong (VND) per month; `fx` gives the exchange rate for showing them in US dollars. The response may be cached for 60 seconds.

Prices are only shown while the service is on sale at your site (`available` is true) and only for the plans that are on sale. While it is not on sale `available` is false and every plan lists its specifications only: no `monthly_vnd`, `setup_fee_vnd` or `cycles`. Stock, addresses and host names are never part of this list. Sites run by resellers do not sell Dedicated Servers and answer `404 service_unavailable`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `catalog dedicated`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `available` | boolean | yes | Whether Dedicated Servers are on sale at your site right now. When false the plans carry no prices. |
| `order_url` | string | no | Path of the order page (`/deploy/bare-metal`); present only while `available` is true. |
| `currency` | string | yes | Currency of the prices: always `VND`. |
| `plans` | array of object | yes |  |
| `plans[].code` | string | yes | Plan code, e.g. `DS-6138-128`. |
| `plans[].name` | string | yes | Display name. |
| `plans[].spec` | object | yes | Hardware of the plan. Only the fields that are published for the plan are present. |
| `plans[].spec.cpu` | string | no | Processors, e.g. `2x Intel Xeon Gold 6138`. |
| `plans[].spec.cores` | integer | no | Total physical cores. |
| `plans[].spec.threads` | integer | no | Total threads. |
| `plans[].spec.ram_gb` | integer | no | Memory in GB. |
| `plans[].spec.ram_note` | string | no | Remark on how the memory is installed. |
| `plans[].spec.storage` | string | no | Storage, e.g. `SSD ~1 TB`. |
| `plans[].spec.disk` | string | no | Disk description when `storage` is not given. |
| `plans[].spec.ipv4` | integer | no | Public IPv4 addresses included. |
| `plans[].spec.console` | boolean | no | Whether a browser console is included. |
| `plans[].spec.port` | string | no | Network port speed when published. |
| `plans[].spec.bandwidth` | string | no | Included bandwidth when published. |
| `plans[].available` | boolean | yes | Whether this plan can be ordered: the service is on sale and the plan is enabled. When false the price fields are absent. |
| `plans[].monthly_vnd` | integer | no | Price for one month, in VND. Present only when `available` is true. |
| `plans[].setup_fee_vnd` | integer | no | One-time setup fee in VND (0 = none). Present only when `available` is true. |
| `plans[].cycles` | array of object | no | Billing cycles offered for the plan. Present only when `available` is true. |
| `plans[].cycles[].cycle` | string | yes | Billing cycle slug, e.g. `yearly`. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months. |
| `plans[].cycles[].discount_pct` | number | yes | Discount on the monthly price for paying this cycle up front, in percent. |
| `fx` | CatalogFx | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show local-currency prices: Vietnamese dong per 1 US dollar. 0 when no rate is available. |
| `fx.source` | string | yes | Where the rate comes from, for example an automatic bank feed, a manual override, or `none` when no rate has been set. |
| `fx.vcb_sell` | integer | yes | Selling rate published by the reference bank at `vcb_at`, dong per US dollar. 0 when unknown. |
| `fx.vcb_at` | integer | yes | When the reference bank published `vcb_sell`; 0 when unknown (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | When `usd_vnd` was last changed (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added on top of the reference rate, in basis points (1 bp = 0.01 percent). |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently and may be out of date. |
| `fx.round_step` | integer | yes | Rounding step applied to local-currency amounts, in dong: 1, 100, 1000 or 10000. |

Example:

```json
{
  "available": true,
  "currency": "VND",
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "auto",
    "stale": false,
    "updated_at": 1760000100,
    "usd_vnd": 26000,
    "vcb_at": 1760000000,
    "vcb_sell": 26050
  },
  "plans": [
    {
      "available": true,
      "code": "DS-6138-128",
      "cycles": [
        {
          "cycle": "monthly",
          "discount_pct": 0.0,
          "months": 1
        },
        {
          "cycle": "yearly",
          "discount_pct": 12.0,
          "months": 12
        }
      ],
      "monthly_vnd": 2990000,
      "name": "DS-6138-128",
      "setup_fee_vnd": 500000,
      "spec": {
        "console": true,
        "cores": 40,
        "cpu": "2x Intel Xeon Gold 6138",
        "ipv4": 1,
        "ram_gb": 128,
        "storage": "SSD ~1 TB",
        "threads": 80
      }
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `service_unavailable` | Your site is closed or inactive, or is run by a reseller (Dedicated Servers are not sold there). |
| 503 | `catalog_unavailable` | The plan list could not be built right now. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/public/dedicated" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### GPU catalog: configurations, templates and sale prices

`GET /v1/gpu/catalog`

Returns the live GPU catalog: the configurations that can be ordered with their prices and stock, the software templates, and which configurations each template can run on. The list follows the live market, so prices and stock change; the server keeps a snapshot that is refreshed in the background (at most about once every 45 seconds), and `stale` is true when the market could not be reached recently. The price you pay is fixed by the quote you take when ordering, not by this list.

Prices are computed for the disk size in `disk_gb` (default 32 GB, never below a template minimum). `sales_enabled` is false when your site does not take new GPU orders.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `gpu catalog`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `disk_gb` | integer | no | Disk size in GB to compute prices for. Clamped to 8-2000. |
| `refresh` | integer | no | Set to 1 to ask for a fresh snapshot instead of the cached one. Honoured only when the cached snapshot is more than 20 seconds old, and at most 6 times a minute per account; otherwise ignored. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | When the market snapshot was taken (Unix time, seconds, UTC) |
| `fetched_at` | integer | yes | Same as `at` (Unix time, seconds, UTC) |
| `age_secs` | integer | yes | Age of the snapshot in seconds. |
| `stale` | boolean | yes | True when the snapshot could not be refreshed recently and may be out of date. |
| `sales_enabled` | boolean | yes | Whether your site takes new GPU orders. |
| `total_offers` | integer | yes | Number of machines in the market that can run at least one template. |
| `plans` | array of GpuCatalogPlan | yes |  |
| `plans[].id` | string | yes | Plan identifier, the same as `slug`. |
| `plans[].slug` | string | yes | Stable short name of the configuration, e.g. `1x-rtx-4090`. Pass it as the configuration when ordering a GPU server. |
| `plans[].name` | string | yes | Display name, e.g. `RTX 4090 - 24 GB`. |
| `plans[].gpu_name` | string | yes | GPU model. |
| `plans[].gpu_count` | integer | yes | Number of GPUs in the configuration. |
| `plans[].vram_gb` | integer | yes | Total GPU memory in GB. |
| `plans[].cpu` | integer | yes | Virtual CPU cores. |
| `plans[].ram_mb` | integer | yes | System memory in MiB. |
| `plans[].disk_gb` | integer | yes | Disk size the prices are computed for, in GB (the `disk_gb` query value, never below the template minimum). |
| `plans[].max_disk_gb` | integer | yes | Largest disk currently available for this configuration, in GB. |
| `plans[].tier` | string | yes | Class of the GPU: `rtx5090`, `cluster`, `enterprise`, `workstation`, `prosumer` or `mainstream`. |
| `plans[].is_5090` | boolean | yes | Whether the configuration uses an RTX 5090. |
| `plans[].stock` | integer | yes | Number of matching machines in stock right now. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar, for the displayed disk size. |
| `plans[].storage_uusd_gb_h` | integer | yes | Price per extra GB of disk per hour, in millionths of a US dollar. |
| `plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours), in US cents, including the monthly-cycle discount. |
| `plans[].cuda_max` | number | yes | Highest CUDA version supported. |
| `plans[].top_locations` | array of string | yes |  |
| `plans[].hot_rank` | integer or null | no | Popularity rank among configurations (1 = most popular); null when not ranked. |
| `plans[].hot` | boolean | no | Whether the configuration is among the most popular ones. |
| `rtx5090_plans` | array of GpuCatalogPlan | yes | The configurations of `plans` that use an RTX 5090. |
| `rtx5090_plans[].id` | string | yes | Plan identifier, the same as `slug`. |
| `rtx5090_plans[].slug` | string | yes | Stable short name of the configuration, e.g. `1x-rtx-4090`. Pass it as the configuration when ordering a GPU server. |
| `rtx5090_plans[].name` | string | yes | Display name, e.g. `RTX 4090 - 24 GB`. |
| `rtx5090_plans[].gpu_name` | string | yes | GPU model. |
| `rtx5090_plans[].gpu_count` | integer | yes | Number of GPUs in the configuration. |
| `rtx5090_plans[].vram_gb` | integer | yes | Total GPU memory in GB. |
| `rtx5090_plans[].cpu` | integer | yes | Virtual CPU cores. |
| `rtx5090_plans[].ram_mb` | integer | yes | System memory in MiB. |
| `rtx5090_plans[].disk_gb` | integer | yes | Disk size the prices are computed for, in GB (the `disk_gb` query value, never below the template minimum). |
| `rtx5090_plans[].max_disk_gb` | integer | yes | Largest disk currently available for this configuration, in GB. |
| `rtx5090_plans[].tier` | string | yes | Class of the GPU: `rtx5090`, `cluster`, `enterprise`, `workstation`, `prosumer` or `mainstream`. |
| `rtx5090_plans[].is_5090` | boolean | yes | Whether the configuration uses an RTX 5090. |
| `rtx5090_plans[].stock` | integer | yes | Number of matching machines in stock right now. |
| `rtx5090_plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar, for the displayed disk size. |
| `rtx5090_plans[].storage_uusd_gb_h` | integer | yes | Price per extra GB of disk per hour, in millionths of a US dollar. |
| `rtx5090_plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours), in US cents, including the monthly-cycle discount. |
| `rtx5090_plans[].cuda_max` | number | yes | Highest CUDA version supported. |
| `rtx5090_plans[].top_locations` | array of string | yes |  |
| `rtx5090_plans[].hot_rank` | integer or null | no | Popularity rank among configurations (1 = most popular); null when not ranked. |
| `rtx5090_plans[].hot` | boolean | no | Whether the configuration is among the most popular ones. |
| `rtx5090_offers` | array of object | yes | Up to 36 individual RTX 5090 listings, cheapest first. Provided for dashboards; use `plans` to order. |
| `templates` | array of object | yes |  |
| `templates[].id` | integer | yes | Template identifier. Pass it as `template_id` when quoting or ordering. |
| `templates[].slug` | string | yes | Stable short name. |
| `templates[].name` | string | yes | Display name. |
| `templates[].category` | string | yes | Template category. |
| `templates[].is_vm` | boolean | yes | True for a full virtual machine, false for a container. |
| `templates[].default_disk_gb` | integer | yes | Default (and minimum) disk size in GB. |
| `templates[].min_cuda` | number | yes | Lowest CUDA version the template needs. |
| `templates[].min_vram_mb` | integer | yes | Lowest GPU memory the template needs, in MB. |
| `templates[].description` | string | yes | Description. |
| `templates[].compatible_plan_ids` | array of string | yes | Configurations this template can run on. |
| `templates[].stock` | integer | yes | Number of machines that can run this template. |
| `availability` | array of object | yes | Per template, the configurations it can run on. |
| `availability[].template_id` | integer | yes | Template identifier. |
| `availability[].disk_gb` | integer | yes | Disk size the prices were computed for, in GB. |
| `availability[].plans` | array of GpuCatalogPlan | yes | Configurations this template can run on, with prices for that disk size. |
| `availability[].plans[].id` | string | yes | Plan identifier, the same as `slug`. |
| `availability[].plans[].slug` | string | yes | Stable short name of the configuration, e.g. `1x-rtx-4090`. Pass it as the configuration when ordering a GPU server. |
| `availability[].plans[].name` | string | yes | Display name, e.g. `RTX 4090 - 24 GB`. |
| `availability[].plans[].gpu_name` | string | yes | GPU model. |
| `availability[].plans[].gpu_count` | integer | yes | Number of GPUs in the configuration. |
| `availability[].plans[].vram_gb` | integer | yes | Total GPU memory in GB. |
| `availability[].plans[].cpu` | integer | yes | Virtual CPU cores. |
| `availability[].plans[].ram_mb` | integer | yes | System memory in MiB. |
| `availability[].plans[].disk_gb` | integer | yes | Disk size the prices are computed for, in GB (the `disk_gb` query value, never below the template minimum). |
| `availability[].plans[].max_disk_gb` | integer | yes | Largest disk currently available for this configuration, in GB. |
| `availability[].plans[].tier` | string | yes | Class of the GPU: `rtx5090`, `cluster`, `enterprise`, `workstation`, `prosumer` or `mainstream`. |
| `availability[].plans[].is_5090` | boolean | yes | Whether the configuration uses an RTX 5090. |
| `availability[].plans[].stock` | integer | yes | Number of matching machines in stock right now. |
| `availability[].plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar, for the displayed disk size. |
| `availability[].plans[].storage_uusd_gb_h` | integer | yes | Price per extra GB of disk per hour, in millionths of a US dollar. |
| `availability[].plans[].monthly_cents` | integer | yes | Price for a 30-day month (730 hours), in US cents, including the monthly-cycle discount. |
| `availability[].plans[].cuda_max` | number | yes | Highest CUDA version supported. |
| `availability[].plans[].top_locations` | array of string | yes |  |
| `availability[].plans[].hot_rank` | integer or null | no | Popularity rank among configurations (1 = most popular); null when not ranked. |
| `availability[].plans[].hot` | boolean | no | Whether the configuration is among the most popular ones. |
| `compatibility_version` | integer | yes | Version of the availability format (currently 1). |
| `templates_checked_at` | integer | yes | When the template list was last checked; 0 when never (Unix time, seconds, UTC) |
| `cycles` | array of object | yes | Billing cycles. GPU servers are billed by the hour; the other cycles are prepaid with the discount shown. |
| `cycles[].slug` | string | yes | Billing cycle identifier. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount applied for paying this cycle up front, in percent. |
| `hours_per_month` | integer | yes | Hours in a billing month (730). |
| `min_balance_cents` | integer | yes | Minimum wallet balance needed to order, in US cents. |

Example:

```json
{
  "age_secs": 12,
  "at": 1760000000,
  "availability": [
    {
      "disk_gb": 32,
      "plans": [],
      "template_id": 1
    }
  ],
  "compatibility_version": 1,
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 0,
      "name": "Hourly",
      "slug": "hourly"
    },
    {
      "discount_pct": 5.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    }
  ],
  "fetched_at": 1760000000,
  "hours_per_month": 730,
  "min_balance_cents": 100,
  "plans": [
    {
      "cpu": 16,
      "cuda_max": 12.8,
      "disk_gb": 32,
      "gpu_count": 1,
      "gpu_name": "RTX 4090",
      "hot": true,
      "hot_rank": 2,
      "hourly_uusd": 410000,
      "id": "1x-rtx-4090",
      "is_5090": false,
      "max_disk_gb": 800,
      "monthly_cents": 28400,
      "name": "RTX 4090 - 24 GB",
      "ram_mb": 65536,
      "slug": "1x-rtx-4090",
      "stock": 14,
      "storage_uusd_gb_h": 120,
      "tier": "prosumer",
      "top_locations": [
        "US",
        "DE"
      ],
      "vram_gb": 24
    }
  ],
  "rtx5090_offers": [],
  "rtx5090_plans": [],
  "sales_enabled": true,
  "stale": false,
  "templates": [
    {
      "category": "Machine learning",
      "compatible_plan_ids": [
        "1x-rtx-4090"
      ],
      "default_disk_gb": 32,
      "description": "PyTorch with CUDA",
      "id": 1,
      "is_vm": false,
      "min_cuda": 12.0,
      "min_vram_mb": 8000,
      "name": "PyTorch",
      "slug": "pytorch",
      "stock": 14
    }
  ],
  "templates_checked_at": 1759999000,
  "total_offers": 214
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 500 | `internal` | The market list could not be loaded. Retry shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/gpu/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### S3 catalog: price policy and zones

`GET /v1/s3/catalog`

Returns the object storage catalog for your account: the price policy, the regions where an account can be created, whether your account currently qualifies for the free storage allowance, and the account limits. Create an account with a region `id` from `zones`.

**Prices are in Vietnamese dong (VND)**, not US dollars; `fx_usd_vnd` is the conversion rate. Usage is metered per hour and charged to the wallet in US cents at the exchange rate of the day. Unlike the session-based dashboard, API keys do not receive your wallet balance in this response; read it from the billing endpoints with a key that has the billing scope.

Object storage is not sold on every site; when your site does not sell it the call fails with `404 s3_error`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `s3 catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `policy` | object | yes |  |
| `policy.storage_price_per_gb_month` | number | yes | Storage price per GB per month, in VND. |
| `policy.bandwidth_out_price_per_gb` | number | yes | Download (outbound traffic) price per GB, in VND. |
| `policy.bandwidth_in_price_per_gb` | number | yes | Upload (inbound traffic) price per GB, in VND. Always 0. |
| `policy.free_tier_gb` | number | yes | Storage in GB that is free while the account has a running server. |
| `policy.max_debt` | number | yes | Unpaid accrued usage, in VND, above which the wallet is charged immediately. If the wallet cannot cover it, the storage account is locked until it is paid. |
| `policy.min_settle` | number | yes | Smallest daily amount, in VND, that is invoiced; smaller amounts roll over and are invoiced at the start of the month. |
| `policy.min_balance_create` | number | yes | Minimum wallet balance, in VND, required to create a storage account. |
| `policy.max_accounts_per_user` | integer | yes | Most storage accounts per customer. |
| `policy.default_quota_gb` | integer | yes | Storage quota given to a new account, in GB. |
| `zones` | array of CatalogZone | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].is_default` | boolean | yes | Whether this is the default region of the site. |
| `zones[].services` | array of string | yes |  |
| `free_eligible` | boolean | yes | Whether your account has a running server, which unlocks the free storage allowance. |
| `units` | object | yes |  |
| `units.gb_bytes` | integer | yes | Bytes in one GB as used for billing (1073741824, i.e. a GiB). |
| `units.hours_per_month` | integer | yes | Hours used to turn the monthly storage price into an hourly one (730). |
| `fx_usd_vnd` | integer | yes | Exchange rate: Vietnamese dong per 1 US dollar. 0 when no rate is set. |

Example:

```json
{
  "free_eligible": true,
  "fx_usd_vnd": 26000,
  "policy": {
    "bandwidth_in_price_per_gb": 0.0,
    "bandwidth_out_price_per_gb": 999.0,
    "default_quota_gb": 2048,
    "free_tier_gb": 100.0,
    "max_accounts_per_user": 10,
    "max_debt": 50000.0,
    "min_balance_create": 50000.0,
    "min_settle": 500.0,
    "storage_price_per_gb_month": 399.0
  },
  "units": {
    "gb_bytes": 1073741824,
    "hours_per_month": 730
  },
  "zones": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "is_default": true,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "services": [
        "vm",
        "vpn",
        "s3"
      ],
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | Your site does not sell object storage. |
| 503 | `s3_error` | The price policy has not been configured yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### VPN IPv4 catalog: plans, cycles, zones and free IPs

`GET /v1/vpn/catalog`

Returns the VPN price book for your site: the price per IP at each order size, the bandwidth tiers, the add-ons and billing cycles, plus the regions with the number of free IPs. Only the `dedicated` tier can be ordered; `shared` and `private` stay in the response for compatibility but have empty `ip_breaks`. All prices are in millionths of a US dollar (1 USD = 1 000 000).

Price a concrete order with [Quote a VPN order for your account](#operation/vpn_quote). The same price book without account context is at [Get VPN prices](#operation/catalog_vpn).

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `vpn catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `shared` | VpnTierPricing | yes |  |
| `shared.ip_breaks` | array of object | yes |  |
| `shared.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `shared.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `shared.bw_breaks` | array of object | yes |  |
| `shared.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `shared.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `shared.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `shared.max_ips` | integer | yes | Largest number of IPs in one order. |
| `private` | VpnTierPricing | yes |  |
| `private.ip_breaks` | array of object | yes |  |
| `private.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `private.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `private.bw_breaks` | array of object | yes |  |
| `private.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `private.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `private.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `private.max_ips` | integer | yes | Largest number of IPs in one order. |
| `dedicated` | VpnTierPricing | yes |  |
| `dedicated.ip_breaks` | array of object | yes |  |
| `dedicated.ip_breaks[].min_ip` | integer | yes | Order sizes of at least this many IPs get this unit price. |
| `dedicated.ip_breaks[].uusd_ip_month` | integer | yes | Price of one IP per month, in millionths of a US dollar. The unit price of the highest `min_ip` not above the order size applies to the whole order. |
| `dedicated.bw_breaks` | array of object | yes |  |
| `dedicated.bw_breaks[].gb` | integer | yes | Monthly bandwidth tier in GB. 0 means unlimited (fair use). |
| `dedicated.bw_breaks[].uusd_month` | integer | yes | Extra monthly price of this tier on top of the base tier (which costs 0), in millionths of a US dollar. |
| `dedicated.min_ips` | integer | yes | Smallest number of IPs in one order. |
| `dedicated.max_ips` | integer | yes | Largest number of IPs in one order. |
| `addons` | array of VpnAddonPrice | yes |  |
| `addons[].key` | string | yes | Add-on key. Pass it in the `addons` list of a quote or order. |
| `addons[].name` | string | yes | Display name. |
| `addons[].uusd_month` | integer | yes | Monthly price of the add-on, in millionths of a US dollar. |
| `cycles` | array of VpnCyclePrice | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier, e.g. `daily`, `weekly`, `monthly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. It is a label only; use `slug` in requests. |
| `cycles[].months` | integer | yes | Length of the cycle in months; 0 for day-based cycles. |
| `cycles[].discount_pct` | number | yes | Discount applied to the monthly price for paying this cycle up front, in percent (month-based cycles). |
| `cycles[].days` | integer | yes | Length of the cycle in days for day-based cycles; 0 otherwise. |
| `cycles[].price_bp` | integer | yes | For day-based cycles, price of one cycle as a share of the monthly price in basis points (10000 = the full monthly price); 0 otherwise. |
| `pool_free` | integer | yes | Total free IPs that can be ordered, over the regions listed in `zones`. |
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].is_default` | boolean | yes | Whether this is the default region of the site. |
| `zones[].available` | boolean | yes | Whether the region has at least one free IP. |
| `zones[].free_ips` | integer | yes | Number of free IPs that can be ordered in the region. |
| `default_zone_id` | integer or null | yes | Region used when an order omits `zone_id`; null when there is none. |

Example:

```json
{
  "addons": [
    {
      "key": "concurrency",
      "name": "High Concurrency",
      "uusd_month": 10090000
    }
  ],
  "cycles": [
    {
      "days": 0,
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "price_bp": 0,
      "slug": "monthly"
    },
    {
      "days": 0,
      "discount_pct": 30.0,
      "months": 12,
      "name": "Yearly",
      "price_bp": 0,
      "slug": "yearly"
    }
  ],
  "dedicated": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      },
      {
        "gb": 1000,
        "uusd_month": 13460000
      },
      {
        "gb": 0,
        "uusd_month": 61890000
      }
    ],
    "ip_breaks": [
      {
        "min_ip": 1,
        "uusd_ip_month": 958000
      },
      {
        "min_ip": 10,
        "uusd_ip_month": 843000
      }
    ],
    "max_ips": 10000,
    "min_ips": 1
  },
  "default_zone_id": 1,
  "pool_free": 120,
  "private": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      }
    ],
    "ip_breaks": [],
    "max_ips": 15000,
    "min_ips": 1
  },
  "shared": {
    "bw_breaks": [
      {
        "gb": 250,
        "uusd_month": 0
      }
    ],
    "ip_breaks": [],
    "max_ips": 15000,
    "min_ips": 1
  },
  "zones": [
    {
      "available": true,
      "city": "Ho Chi Minh City",
      "country": "VN",
      "free_ips": 120,
      "id": 1,
      "is_default": true,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 423 | `site_unavailable` | Your reseller site is currently unavailable. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a VPN IPv4 order at your site's price (nothing is purchased)

`POST /v1/vpn/quote`

Prices a VPN order at your site's price without creating anything and without charging. The response is the price breakdown in millionths of a US dollar plus `amount_cents`, the amount an order would take from your wallet. If the order is not valid (for example too many IPs, or a bandwidth tier or cycle that does not exist) the call still returns `200`: `errors` lists the problems and `amount_cents` is null.

The region is checked as it would be for an order: when your site has several VPN regions and no default, `zone_id` is required. Orders for the retired `shared` and `private` tiers or for retired add-ons are refused with `tier_retired` or `addon_retired`. You can send up to 240 quotes a minute per account.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `vpn quote`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `tier` | string: `shared`, `private`, `dedicated` | yes | IP sharing tier. Only `dedicated` can be ordered; the other two are rejected with `tier_retired`. |
| `ip_count` | integer | yes | Number of IPs, at least 1. The allowed maximum is in the catalog (`dedicated.max_ips`). |
| `bandwidth_gb` | integer | yes | Monthly bandwidth tier in GB; must be one of the catalog `bw_breaks[].gb` values. 0 means unlimited (fair use). |
| `cycle` | string | yes | Billing cycle slug from the catalog `cycles`, e.g. `monthly`. |
| `addons` | array of string | no | Add-ons to include. Default none. Duplicates are ignored; at most 16 entries. |
| `zone_id` | integer | no | Region to order from, as returned by `zones`. Does not change the price. |
| `zone` | string | no | Region slug, used when `zone_id` is not given. Does not change the price. |

Example:

```json
{
  "addons": [
    "concurrency"
  ],
  "bandwidth_gb": 1000,
  "cycle": "monthly",
  "ip_count": 10,
  "tier": "dedicated",
  "zone_id": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `tier` | string | yes | Tier that was priced: `shared`, `private` or `dedicated`. |
| `ip_count` | integer | yes | Number of IPs priced. When the request was outside the allowed range the value is clamped to the nearest limit and `errors` explains why. |
| `bandwidth_gb` | integer | yes | Monthly bandwidth in GB that was priced (0 = unlimited). |
| `cycle` | string | yes | Billing cycle slug that was priced. |
| `months` | integer | yes | Length of the cycle in months (0 for day-based cycles). |
| `days` | integer | yes | Length of the cycle in days for day-based cycles (daily, weekly); 0 for monthly cycles. |
| `unit_uusd_month` | integer | yes | Price of one IP per month at this order size, in millionths of a US dollar. |
| `list_unit_uusd_month` | integer | yes | Price of one IP per month at the smallest order size, before volume pricing, in millionths of a US dollar. |
| `ips_uusd_month` | integer | yes | IP part of the monthly price (`unit_uusd_month` x `ip_count`), in millionths of a US dollar. |
| `bandwidth_uusd_month` | integer | yes | Bandwidth part of the monthly price, in millionths of a US dollar. |
| `addons_uusd_month` | integer | yes | Add-on part of the monthly price, in millionths of a US dollar. |
| `addon_lines` | array of array | yes |  |
| `monthly_uusd` | integer | yes | Monthly price before the cycle discount (IPs + bandwidth + add-ons), in millionths of a US dollar. |
| `list_monthly_uusd` | integer | yes | Monthly price at list (non-volume) unit prices, for strike-through display, in millionths of a US dollar. |
| `discount_pct` | number | yes | Cycle discount applied to the total, in percent (0 for day-based cycles). |
| `total_uusd` | integer | yes | Total for one full cycle after the cycle discount, in millionths of a US dollar. This is the amount an order would be charged. |
| `effective_monthly_uusd` | integer | yes | `total_uusd` converted to a per-month figure, for display only, in millionths of a US dollar. |
| `errors` | array of string | yes |  |
| `amount_cents` | integer or null | yes | Amount the order would take from the wallet, in US cents. Null when `errors` is not empty. |
| `zone` | Zone | yes |  |
| `zone.id` | integer | yes | Region identifier. Pass it as `zone_id` when creating resources. |
| `zone.slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zone.name` | string | yes | Display name. |
| `zone.name_en` | string or null | no | English display name. |
| `zone.country` | string | no | ISO country code. |
| `zone.city` | string or null | no | City. |
| `trial` | object | yes | Trial credit for this order. The trial pays for one 1-day order per service (VPN / Proxy IPv4 and Proxy IPv6) while it is active. |
| `trial.applies` | boolean | yes | True when the order would be paid (fully or partly) from your active trial credit. |
| `trial.deduct_cents` | integer | yes | Part of `amount_cents` the trial credit would pay, in US cents; the rest comes from the wallet. |
| `trial.left_cents` | integer | no | Trial credit still available, in US cents (only when the credit is active and the order qualifies). |
| `trial.reason` | string: `invalid`, `off`, `inactive`, `used`, `plan`, `cycle` | no | Why the credit does not apply: `inactive` no active trial credit, `used` this service already used its trial order, `cycle` only the 1-day plan is covered, `off` not offered on this site, `invalid` the quote has errors. |

Example:

```json
{
  "addon_lines": [
    [
      "High Concurrency",
      10090000
    ]
  ],
  "addons_uusd_month": 10090000,
  "amount_cents": 3198,
  "bandwidth_gb": 1000,
  "bandwidth_uusd_month": 13460000,
  "cycle": "monthly",
  "days": 0,
  "discount_pct": 0.0,
  "effective_monthly_uusd": 31980000,
  "errors": [],
  "ip_count": 10,
  "ips_uusd_month": 8430000,
  "list_monthly_uusd": 33120000,
  "list_unit_uusd_month": 958000,
  "monthly_uusd": 31980000,
  "months": 1,
  "tier": "dedicated",
  "total_uusd": 31980000,
  "trial": {
    "applies": false,
    "deduct_cents": 0,
    "reason": "cycle"
  },
  "unit_uusd_month": 843000,
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or a required field is missing (`detail` says which). |
| 404 | `zone_not_found` | The region does not exist or is not available to your site. |
| 422 | `invalid_argument` | A field is outside what can be ordered, e.g. an unknown `tier` or `ip_count` below 1. `errors` lists the reason. |
| 422 | `tier_retired` | The `shared` and `private` tiers are no longer sold; use `dedicated`. |
| 422 | `addon_retired` | An add-on in the request is no longer sold. |
| 422 | `zone_required` | Your site has several VPN regions and no default; `zones` in the error lists them. Send `zone_id`. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 423 | `site_unavailable` | Your reseller site is currently unavailable. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/quote" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"addons":["concurrency"],"bandwidth_gb":1000,"cycle":"monthly","ip_count":10,"tier":"dedicated","zone_id":1}'
```

---

#### Proxy IPv6 catalog: plans, cycles and zones

`GET /v1/proxy6/catalog`

Returns the IPv6 proxy catalog for your site: the fixed plans with the price of each billing period, the bandwidth and device add-ons, the regions with their availability, and the connection details (gateway host, ports, rotation interval limits, blocked ports). All prices are in millionths of a US dollar.

The call works even when your site does not sell IPv6 proxies; `enabled` tells you whether ordering is possible. Price an order with [Quote an IPv6 proxy order](#operation/proxy6_quote).

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `proxy6 catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when ordering. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | yes | English display name. |
| `zones[].country` | string | yes | ISO 3166-1 alpha-2 country code. |
| `zones[].city` | string or null | yes | City. |
| `zones[].available` | boolean | yes | Whether the region can take new orders right now. |
| `default_zone_id` | integer | yes | Region used when an order omits `zone_id`. |
| `enabled` | boolean | yes | Whether IPv6 proxies can be ordered at your site. |
| `catalog` | object | yes |  |
| `catalog.plans` | array of object | yes |  |
| `catalog.plans[].slug` | string | yes | Plan identifier, e.g. `static-100`. Pass it as `plan` when quoting or ordering. |
| `catalog.plans[].kind` | string: `static`, `rotate`, `unlimited` | yes | `static` keeps fixed IPs, `rotate` changes IP on request with a limited number of rotations, `unlimited` rotates without a limit. |
| `catalog.plans[].count` | integer | yes | Static plans: number of IPs. Rotating plans: rotations per period. Unlimited plans: 0. |
| `catalog.plans[].prices` | Proxy6PriceSet | yes |  |
| `catalog.plans[].enabled` | boolean | yes | Whether the plan is on sale. Quotes for a plan that is off report an error. |
| `catalog.mbps_addon` | object | yes |  |
| `catalog.mbps_addon.prices` | Proxy6PriceSet | yes |  |
| `catalog.mbps_addon.max` | integer | yes | Most units per order. |
| `catalog.mbps_step` | integer | yes | Each bandwidth add-on unit adds this many Mbps. |
| `catalog.device_addon` | object | yes |  |
| `catalog.device_addon.prices` | Proxy6PriceSet | yes |  |
| `catalog.device_addon.max` | integer | yes | Most units per order. |
| `catalog.std_mbps_static` | integer | yes | Standard speed of static plans in Mbps. |
| `catalog.std_mbps_rotate` | integer | yes | Standard speed of rotating plans in Mbps. |
| `catalog.std_mbps_unlimited` | integer | yes | Standard speed of unlimited plans in Mbps. |
| `cycles` | array of object | yes |  |
| `cycles[].slug` | string | yes | Billing period identifier: `daily`, `weekly`, `monthly` or `yearly`. |
| `cycles[].months` | integer | yes | Length in months (0 for daily and weekly). |
| `cycles[].days` | integer | yes | Length in days (0 for monthly and yearly). |
| `hostname` | string | yes | Gateway host name that proxies are reached through. |
| `gw4` | string | yes | Gateway IPv4 address; empty when not set. |
| `gw6` | string | yes | Gateway IPv6 address; empty when not set. |
| `ports` | object | yes |  |
| `ports.http` | integer | yes | Port for HTTP proxy connections. |
| `ports.https` | integer | yes | Port for HTTPS proxy connections. |
| `ports.socks5` | integer | yes | Port for SOCKS5 connections. |
| `ports.static_from` | integer | yes | Advanced, optional: first port of the range that maps to individual IPs of a static plan. Normal use is ports 80/443 with the `user-N` user name. |
| `ports.static_to` | integer | yes | Last port of that range. |
| `rotate_interval` | object | yes |  |
| `rotate_interval.min_s` | integer | yes | Shortest automatic rotation interval in seconds. |
| `rotate_interval.max_s` | integer | yes | Longest automatic rotation interval in seconds. |
| `available` | boolean | yes | Whether proxies can be ordered right now. False means capacity is temporarily out. |
| `egress` | string | yes | Address family of outbound traffic: always `ipv6_only`. |
| `blocked_ports` | array of integer | yes |  |

Example:

```json
{
  "available": true,
  "blocked_ports": [
    25,
    465,
    587,
    2525
  ],
  "catalog": {
    "device_addon": {
      "max": 20,
      "prices": {
        "daily": 192000,
        "monthly": 3837000,
        "weekly": 1200000,
        "yearly": 32230000
      }
    },
    "mbps_addon": {
      "max": 20,
      "prices": {
        "daily": 192000,
        "monthly": 3837000,
        "weekly": 1200000,
        "yearly": 32230000
      }
    },
    "mbps_step": 50,
    "plans": [
      {
        "count": 100,
        "enabled": true,
        "kind": "static",
        "prices": {
          "daily": 288000,
          "monthly": 5755000,
          "weekly": 1800000,
          "yearly": 48342000
        },
        "slug": "static-100"
      }
    ],
    "std_mbps_rotate": 50,
    "std_mbps_static": 50,
    "std_mbps_unlimited": 100
  },
  "cycles": [
    {
      "days": 1,
      "months": 0,
      "slug": "daily"
    },
    {
      "days": 7,
      "months": 0,
      "slug": "weekly"
    },
    {
      "days": 0,
      "months": 1,
      "slug": "monthly"
    },
    {
      "days": 0,
      "months": 12,
      "slug": "yearly"
    }
  ],
  "default_zone_id": 1,
  "egress": "ipv6_only",
  "enabled": true,
  "gw4": "",
  "gw6": "",
  "hostname": "proxy.example.com",
  "ports": {
    "http": 80,
    "https": 443,
    "socks5": 443,
    "static_from": 60001,
    "static_to": 65535
  },
  "rotate_interval": {
    "max_s": 600,
    "min_s": 30
  },
  "zones": [
    {
      "available": true,
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 423 | `site_unavailable` | Your reseller site is currently unavailable. |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a Proxy IPv6 order at your site's price (nothing is purchased)

`POST /v1/proxy6/quote`

Prices an IPv6 proxy order at your site's price without creating anything and without charging. The response lists the price lines (plan and add-ons) in millionths of a US dollar and `amount_cents`, the amount an order would take from your wallet. If the order is not valid (unknown or disabled plan, unknown period, add-on count out of range, device add-on on a plan that does not take it) the call still returns `200`: `errors` lists the problems and `amount_cents` is null.

The quote works even when your site does not currently sell IPv6 proxies (see `enabled` in [Get the IPv6 proxy catalog](#operation/proxy6_catalog)); ordering is what is blocked then.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `proxy6 quote`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan` | string | yes | Plan `slug` from the catalog, e.g. `static-100`. |
| `cycle` | string: `daily`, `weekly`, `monthly`, `yearly` | yes | Billing period. |
| `mbps_addons` | integer | no | Number of bandwidth add-on units, each adding `mbps_step` Mbps. Default 0; at most the catalog `mbps_addon.max`. |
| `device_addons` | integer | no | Number of extra device units. Default 0; only valid for `unlimited` plans; at most the catalog `device_addon.max`. |
| `zone_id` | integer | no | Region to order from. Does not change the price and is not checked by the quote. |
| `auto_renew` | boolean | no | Accepted for symmetry with ordering and ignored by the quote. |

Example:

```json
{
  "cycle": "weekly",
  "mbps_addons": 1,
  "plan": "static-100"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plan` | string | yes | Plan slug that was priced. |
| `kind` | string | yes | Plan kind: `static`, `rotate` or `unlimited`; empty when the plan was not found. |
| `count` | integer | yes | Static plans: number of IPs. Rotating plans: rotations per period. Unlimited plans: 0. |
| `cycle` | string | yes | Billing period that was priced. |
| `months` | integer | yes | Length of the period in months (0 for daily and weekly). |
| `days` | integer | yes | Length of the period in days (0 for monthly and yearly). |
| `mbps` | integer | yes | Speed of the proxy with the add-ons, in Mbps. |
| `devices` | integer | yes | Devices allowed with the add-ons. |
| `mbps_addons` | integer | yes | Bandwidth add-on units priced (clamped to 0-100). |
| `device_addons` | integer | yes | Device add-on units priced (clamped to 0-100). |
| `lines` | array of object | yes |  |
| `lines[].key` | string: `plan`, `mbps`, `device` | yes | What the line is for. |
| `lines[].qty` | integer | yes | Quantity. |
| `lines[].unit_uusd` | integer | yes | Price of one unit for the period, in millionths of a US dollar. |
| `lines[].amount_uusd` | integer | yes | `qty` x `unit_uusd`. |
| `total_uusd` | integer | yes | Total for one period, in millionths of a US dollar. |
| `monthly_uusd` | integer | yes | The same configuration priced per month, for display only, in millionths of a US dollar. |
| `errors` | array of string | yes |  |
| `amount_cents` | integer or null | yes | Amount the order would take from the wallet, in US cents. Null when `errors` is not empty. |
| `trial` | object | yes | Trial credit for this order. The trial pays for one 1-day order per service (VPN / Proxy IPv4 and Proxy IPv6) while it is active. |
| `trial.applies` | boolean | yes | True when the order would be paid (fully or partly) from your active trial credit. |
| `trial.deduct_cents` | integer | yes | Part of `amount_cents` the trial credit would pay, in US cents; the rest comes from the wallet. |
| `trial.left_cents` | integer | no | Trial credit still available, in US cents (only when the credit is active and the order qualifies). |
| `trial.reason` | string: `invalid`, `off`, `inactive`, `used`, `plan`, `cycle` | no | Why the credit does not apply: `inactive` no active trial credit, `used` this service already used its trial order, `cycle` only the 1-day plan is covered, `off` not offered on this site, `invalid` the quote has errors. |

Example:

```json
{
  "amount_cents": 300,
  "count": 100,
  "cycle": "weekly",
  "days": 7,
  "device_addons": 0,
  "devices": 0,
  "errors": [],
  "kind": "static",
  "lines": [
    {
      "amount_uusd": 1800000,
      "key": "plan",
      "qty": 1,
      "unit_uusd": 1800000
    },
    {
      "amount_uusd": 1200000,
      "key": "mbps",
      "qty": 1,
      "unit_uusd": 1200000
    }
  ],
  "mbps": 100,
  "mbps_addons": 1,
  "monthly_uusd": 9592000,
  "months": 0,
  "plan": "static-100",
  "total_uusd": 3000000,
  "trial": {
    "applies": false,
    "deduct_cents": 0,
    "reason": "cycle"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or a required field (`plan`, `cycle`) is missing (`detail` says which). |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 423 | `site_unavailable` | Your reseller site is currently unavailable. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/quote" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"weekly","mbps_addons":1,"plan":"static-100"}'
```

---

### Virtual Machines

Create, inspect and operate virtual servers: power actions, plan changes, metrics, billing of a single server, and deletion. Creating a server, changing its plan and deleting it are destructive or charge the wallet and require an `Idempotency-Key`.

**Lifecycle.** A new server starts in `provisioning`, becomes `active` when it is ready, and moves to `deleting` and `deleted` when you delete it. A server that cannot be paid for (or that an administrator suspended) becomes `locked`: it keeps its data for a grace period (`destroy_after`) but refuses every action except top-ups and deletion-related reads. If deployment fails the server becomes `failed` and the order is refunded. Power state (`Running`, `Stopped`...) is reported separately in `cs_state` and is only meaningful while the server is `active`.

**Asynchronous actions.** Start, stop, reboot, password reset, SSH-key change, plan change and deletion return a `job_id` immediately. Follow it with List a VM's jobs, or poll Get a VM until `job_running` is `false`. Only one job can run on a server at a time; a second action meanwhile fails with `409 job_running`.

#### List VMs

`GET /v1/vm`

Returns the servers of your account, newest first by default, 25 per page (maximum 100). Servers in the `deleted` state are hidden unless you ask for them with `state=deleted`.

`counts` always covers all of your servers that are not deleted, whatever the filters and the page, so you can show tab badges without extra requests. Each item is a summary; call Get a VM for the full record.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `q` | string | no | Search text. Matches host name, display name, public IP address or server ID (substring, case-insensitive). |
| `state` | string | no | Lifecycle state to keep: `provisioning`, `active`, `locked`, `failed`, `deleting` or `deleted`. Several states can be given separated by commas, for example `locked,failed`. Without this filter every state except `deleted` is returned. |
| `cs_state` | string | no | Power state to keep. `Running` keeps running servers; `Stopped` keeps every server that is not running (including those whose power state is not known yet). Any other value is compared with the reported power state, ignoring case. |
| `zone_id` | integer | no | Keep only your servers in this region (`zones[].id` from the catalog). A region where you have no server gives an empty list. `total` and the paging apply after the filter; `counts` still covers all of your servers. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `hostname`, `display_name`, `state`, `public_ip`, `paid_until`, `billed_until`, `updated_at`, `zone` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VmSummary | yes |  |
| `items[].id` | string | yes | Server identifier (UUID). Use it in every `/v1/vm/{id}` path. |
| `items[].hostname` | string | yes | Host name chosen at creation: lowercase letters, digits and hyphens. It is unique on the platform and cannot be changed. |
| `items[].display_name` | string | yes | Free-form label shown in dashboards. Change it with Update a VM. |
| `items[].state` | string: `provisioning`, `active`, `locked`, `failed`, `deleting`, `deleted` | yes | Lifecycle state. `provisioning`: being created. `active`: ready to use (see `cs_state` for the power state). `locked`: suspended for lack of funds, expiry or by an administrator (see `lock_reason`). `failed`: creation failed and was refunded. `deleting`: deletion in progress. `deleted`: gone. |
| `items[].cs_state` | string or null | yes | Power state reported by the hypervisor, for example `Running`, `Stopped`, `Starting` or `Stopping`. null until the first status sync after creation. |
| `items[].public_ip` | string or null | yes | Public IPv4 address, once assigned. |
| `items[].private_ip` | string or null | yes | Private IPv4 address inside the platform network, once known. |
| `items[].ipv6` | string or null | yes | Public IPv6 address, when IPv6 is enabled and assigned. |
| `items[].plan` | VmPlanBrief | yes |  |
| `items[].plan.name` | string | yes | Plan name at the time of the order, or the generated name of a custom configuration (for example `Custom 4C/8G/80G`). |
| `items[].plan.cpu` | integer | yes | Virtual CPU cores. |
| `items[].plan.ram_mb` | integer | yes | Memory in MiB. |
| `items[].plan.disk_gb` | integer | yes | System disk in GiB. |
| `items[].plan.is_custom` | boolean | yes | `true` for a custom configuration (own vCPU / RAM / disk) rather than a fixed plan. |
| `items[].template` | VmTemplateBrief | yes |  |
| `items[].template.id` | integer | yes | Image identifier (the `template_id` used at creation). 0 when the image no longer exists. |
| `items[].template.display_name` | string | yes | Human readable image name, for example `Ubuntu 24.04 LTS`. |
| `items[].template.os_family` | string | yes | Operating system family: `linux`, `windows`... |
| `items[].template.os_version` | string or null | yes | Version label, when known. |
| `items[].template.icon` | string or null | yes | Icon name for the image, when known. |
| `items[].template.category` | string: `desktop` | no | Present when the image is a VM Desktop image (Ubuntu Desktop with a remote screen through RustDesk or Remote Desktop). Absent for standard images. |
| `items[].cycle` | string | yes | Billing cycle slug: `hourly` or a prepaid cycle such as `monthly` or `yearly`. See the catalog for the cycles on sale. |
| `items[].paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `items[].billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `items[].hourly_mills` | integer | yes | Hourly price in mills (1 mill = US$0.001), rounded. Use `hourly_uusd` for the exact price. |
| `items[].hourly_uusd` | integer | yes | Exact hourly price in millionths of a US dollar (4704 = US$0.004704 per hour). This is the price the server is billed at, whatever its cycle. |
| `items[].locked_at` | integer or null | yes | When the server was locked, or null (Unix time, seconds, UTC) |
| `items[].lock_reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the server is locked. `no_funds`: the wallet could not pay an hourly charge. `expired`: a prepaid period ended without renewal. `admin`: suspended by an administrator. `abuse`: suspended after an abuse report. |
| `items[].destroy_after` | integer or null | yes | When a locked server will be destroyed automatically if it is not unlocked before. null when no deadline applies (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `items[].ready_at` | integer or null | yes | When the server first became ready. null while it is still being created (Unix time, seconds, UTC) |
| `items[].job_running` | boolean | yes | `true` while a background job (start, resize, deletion...) is queued or running on the server. New actions fail with `409 job_running` until it ends. |
| `items[].autoscale_enabled` | boolean | yes | Whether automatic vertical scaling is switched on for this server. |
| `items[].zone` | Zone or null | yes |  |
| `items[].capabilities` | VmCapabilities | yes | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `items[].capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `items[].capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `items[].capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `items[].capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `items[].capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `items[].capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `items[].capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `items[].capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `items[].capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `items[].capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `items[].capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `items[].capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `items[].capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `items[].capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `items[].capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `items[].capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `items[].capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `items[].capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `items[].capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `items[].capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `items[].capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `items[].capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `items[].capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `items[].capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `items[].capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `items[].traffic` | VmTraffic or null | yes |  |
| `items[].imported` | boolean | no | `true` for a server that the team assigned to your account (free of charge). Only an administrator can delete it or change its plan or billing cycle; those calls fail with `409 imported_vm_admin_only`. Absent or `false` for every other server. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `counts` | object | yes |  |
| `counts.all` | integer | yes | All servers that are not deleted. |
| `counts.running` | integer | yes | Active servers that are running. |
| `counts.stopped` | integer | yes | Active servers that are not running. |
| `counts.error` | integer | yes | Servers that are `locked` or `failed`. |

Example:

```json
{
  "counts": {
    "all": 1,
    "error": 0,
    "running": 1,
    "stopped": 0
  },
  "items": [
    {
      "autoscale_enabled": false,
      "billed_until": null,
      "capabilities": {
        "autoscale": true,
        "backup": true,
        "bandwidth": true,
        "byoip": true,
        "change_ip": true,
        "console": "vnc",
        "ddos_shield": true,
        "firewall": true,
        "hypervisor": true,
        "ipv6": true,
        "iso": true,
        "metrics": true,
        "metrics_mem_disk": true,
        "nics": true,
        "port_forward": true,
        "private_ip": true,
        "reinstall": true,
        "reset_password": true,
        "resize_cpu_ram": true,
        "resize_disk_grow": true,
        "resize_live": true,
        "snapshot": true,
        "ssh_key_reset": true,
        "volumes": true,
        "vpc": true
      },
      "created_at": 1792368000,
      "cs_state": "Running",
      "cycle": "monthly",
      "destroy_after": null,
      "display_name": "Web server 01",
      "hostname": "web-01",
      "hourly_mills": 5,
      "hourly_uusd": 4704,
      "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "ipv6": "2001:db8:10::25",
      "job_running": false,
      "lock_reason": null,
      "locked_at": null,
      "paid_until": 1794960000,
      "plan": {
        "cpu": 2,
        "disk_gb": 60,
        "is_custom": false,
        "name": "Standard 2/4",
        "ram_mb": 4096
      },
      "private_ip": "10.1.1.25",
      "public_ip": "203.0.113.25",
      "ready_at": 1792368090,
      "state": "active",
      "template": {
        "display_name": "Ubuntu 24.04 LTS",
        "icon": "ubuntu",
        "id": 11,
        "os_family": "linux",
        "os_version": "24.04"
      },
      "traffic": null,
      "zone": {
        "city": "Ho Chi Minh City",
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "name_en": "Ho Chi Minh City",
        "slug": "hcm-1"
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `zone_id`, `page` or `per_page` is not an integer, or `sort` is not one of the listed fields. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one VM

`GET /v1/vm/{id}`

Returns one server with its plan, image, network placement, billing cycle and lock details.

`live` is included only when the power state was synced during the last two minutes. Pass `refresh=1` to read the current state from the infrastructure first; this is limited to one refresh every 10 seconds per server, and a faster call simply returns the stored data without an error. `job_running` tells you whether an action is still in flight.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `refresh` | string: `1`, `true` | no | Set to `1` or `true` to refresh the power state and addresses from the infrastructure before answering. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Server identifier (UUID). Use it in every `/v1/vm/{id}` path. |
| `hostname` | string | yes | Host name chosen at creation: lowercase letters, digits and hyphens. It is unique on the platform and cannot be changed. |
| `display_name` | string | yes | Free-form label shown in dashboards. Change it with Update a VM. |
| `state` | string: `provisioning`, `active`, `locked`, `failed`, `deleting`, `deleted` | yes | Lifecycle state. `provisioning`: being created. `active`: ready to use (see `cs_state` for the power state). `locked`: suspended for lack of funds, expiry or by an administrator (see `lock_reason`). `failed`: creation failed and was refunded. `deleting`: deletion in progress. `deleted`: gone. |
| `cs_state` | string or null | yes | Power state reported by the hypervisor, for example `Running`, `Stopped`, `Starting` or `Stopping`. null until the first status sync after creation. |
| `public_ip` | string or null | yes | Public IPv4 address, once assigned. |
| `private_ip` | string or null | yes | Private IPv4 address inside the platform network, once known. |
| `ipv6` | string or null | yes | Public IPv6 address, when IPv6 is enabled and assigned. |
| `plan` | VmPlanBrief | yes |  |
| `plan.name` | string | yes | Plan name at the time of the order, or the generated name of a custom configuration (for example `Custom 4C/8G/80G`). |
| `plan.cpu` | integer | yes | Virtual CPU cores. |
| `plan.ram_mb` | integer | yes | Memory in MiB. |
| `plan.disk_gb` | integer | yes | System disk in GiB. |
| `plan.is_custom` | boolean | yes | `true` for a custom configuration (own vCPU / RAM / disk) rather than a fixed plan. |
| `template` | VmTemplateBrief | yes |  |
| `template.id` | integer | yes | Image identifier (the `template_id` used at creation). 0 when the image no longer exists. |
| `template.display_name` | string | yes | Human readable image name, for example `Ubuntu 24.04 LTS`. |
| `template.os_family` | string | yes | Operating system family: `linux`, `windows`... |
| `template.os_version` | string or null | yes | Version label, when known. |
| `template.icon` | string or null | yes | Icon name for the image, when known. |
| `template.category` | string: `desktop` | no | Present when the image is a VM Desktop image (Ubuntu Desktop with a remote screen through RustDesk or Remote Desktop). Absent for standard images. |
| `cycle` | string | yes | Billing cycle slug: `hourly` or a prepaid cycle such as `monthly` or `yearly`. See the catalog for the cycles on sale. |
| `paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `hourly_mills` | integer | yes | Hourly price in mills (1 mill = US$0.001), rounded. Use `hourly_uusd` for the exact price. |
| `hourly_uusd` | integer | yes | Exact hourly price in millionths of a US dollar (4704 = US$0.004704 per hour). This is the price the server is billed at, whatever its cycle. |
| `locked_at` | integer or null | yes | When the server was locked, or null (Unix time, seconds, UTC) |
| `lock_reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the server is locked. `no_funds`: the wallet could not pay an hourly charge. `expired`: a prepaid period ended without renewal. `admin`: suspended by an administrator. `abuse`: suspended after an abuse report. |
| `destroy_after` | integer or null | yes | When a locked server will be destroyed automatically if it is not unlocked before. null when no deadline applies (Unix time, seconds, UTC) |
| `created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `ready_at` | integer or null | yes | When the server first became ready. null while it is still being created (Unix time, seconds, UTC) |
| `job_running` | boolean | yes | `true` while a background job (start, resize, deletion...) is queued or running on the server. New actions fail with `409 job_running` until it ends. |
| `autoscale_enabled` | boolean | yes | Whether automatic vertical scaling is switched on for this server. |
| `capabilities` | VmCapabilities | no | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `traffic` | VmTraffic or null | no |  |
| `ips` | array of string | no |  |
| `extras` | object | no |  |
| `extras.extra_ips` | integer | yes | Additional IPv4 addresses chosen when the server was ordered (0 to 3). |
| `cycles` | array or null | no |  |
| `provisioning` | VmProvisioning or null | no |  |
| `imported` | boolean | no | `true` for a server that the team assigned to your account (free of charge). Only an administrator can delete it or change its plan or billing cycle; those calls fail with `409 imported_vm_admin_only`. Absent or `false` for every other server. |
| `username` | string | yes | Default administrator account name of the operating system image (for example `ubuntu` or `Administrator`). |
| `ssh_key` | string or null | yes | Name of the SSH key installed on the server, or null when no key was chosen. |
| `cs_vm_id` | string or null | yes | Identifier of the server on the underlying infrastructure. null until deployment has created it. Quote it in support requests. |
| `ha` | boolean | yes | Whether the server is restarted automatically on another host if its host fails. |
| `password_lost` | boolean | yes | `true` when the platform could not obtain the administrator password after the last install or reset. Use Reset password to get a new one. |
| `cycle_cents` | integer | yes | Price of one billing cycle in US cents, as locked in for the current period. 0 for hourly servers. |
| `cycle_started_at` | integer or null | yes | Start of the current billing cycle (Unix time, seconds, UTC) |
| `auto_renew` | boolean | yes | Whether a prepaid server renews automatically from the wallet when the period ends. |
| `cancel_requested` | boolean | yes | `true` when deletion was requested while the server was still being created; the deployment stops at its next step and the order is refunded. |
| `enable_ipv6` | boolean | yes | Whether the server is on the dual-stack (IPv4 + IPv6) network. |
| `autoscale_state` | string | no | State of the automatic scaling rule (for example `idle` or `scaled`). Present only when a rule exists. |
| `autoscale_target_cpu` | integer | no | vCPU count the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `autoscale_target_ram_mb` | integer | no | Memory in MiB the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `zone` | Zone or null | no |  |
| `network` | VmNetwork | no |  |
| `network.type` | string: `shared`, `vpc` | yes | `shared`: the standard shared network. `vpc`: a tier of your own Private Cloud. |
| `network.vpc_id` | string | no | Private Cloud identifier. Present when `type` is `vpc`. |
| `network.vpc_name` | string | no | Private Cloud name. Present when `type` is `vpc`. |
| `network.tier_id` | string | no | Tier identifier. Present when `type` is `vpc`. |
| `network.tier` | string | no | Tier name. Present when `type` is `vpc`. |
| `network.cidr` | string | no | Tier address range. Present when `type` is `vpc`. |
| `network.mbps` | integer | no | Bandwidth of the Private Cloud in Mbit/s. Present when `type` is `vpc`. |
| `network.unmetered` | boolean | no | Whether traffic inside the Private Cloud plan is unmetered. Present when `type` is `vpc`. |
| `live` | object | no |  |
| `live.cs_state` | string or null | yes | Power state read from the hypervisor. |
| `live.nic` | string or null | yes | Private IPv4 address. |
| `live.ip` | string or null | yes | Public IPv4 address. |
| `live.ipv6` | string or null | yes | Public IPv6 address. |
| `live.synced_at` | integer or null | yes | When the data was read (Unix time, seconds, UTC) |
| `lock_note` | string or null | no | Note left by an administrator when the server was locked. |
| `failed_reason` | string or null | no | Short reason when `state` is `failed`. |
| `credentials_once` | string or null | no | Token the web panel uses to show the initial password a single time. It cannot be redeemed with an API key; the password itself is e-mailed to the account holder. |

Example:

```json
{
  "auto_renew": true,
  "autoscale_enabled": false,
  "billed_until": null,
  "cancel_requested": false,
  "capabilities": {
    "autoscale": true,
    "backup": true,
    "bandwidth": true,
    "byoip": true,
    "change_ip": true,
    "console": "vnc",
    "ddos_shield": true,
    "firewall": true,
    "hypervisor": true,
    "ipv6": true,
    "iso": true,
    "metrics": true,
    "metrics_mem_disk": true,
    "nics": true,
    "port_forward": true,
    "private_ip": true,
    "reinstall": true,
    "reset_password": true,
    "resize_cpu_ram": true,
    "resize_disk_grow": true,
    "resize_live": true,
    "snapshot": true,
    "ssh_key_reset": true,
    "volumes": true,
    "vpc": true
  },
  "created_at": 1792368000,
  "credentials_once": null,
  "cs_state": "Running",
  "cs_vm_id": "b6a3f6d2-4c1e-4f7a-9d58-2e0c7b1a9f34",
  "cycle": "monthly",
  "cycle_cents": 343,
  "cycle_started_at": 1792368000,
  "destroy_after": null,
  "display_name": "Web server 01",
  "enable_ipv6": true,
  "failed_reason": null,
  "ha": true,
  "hostname": "web-01",
  "hourly_mills": 5,
  "hourly_uusd": 4704,
  "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "ipv6": "2001:db8:10::25",
  "job_running": false,
  "live": {
    "cs_state": "Running",
    "ip": "203.0.113.25",
    "ipv6": "2001:db8:10::25",
    "nic": "10.1.1.25",
    "synced_at": 1792400000
  },
  "lock_note": null,
  "lock_reason": null,
  "locked_at": null,
  "network": {
    "type": "shared"
  },
  "paid_until": 1794960000,
  "password_lost": false,
  "plan": {
    "cpu": 2,
    "disk_gb": 60,
    "is_custom": false,
    "name": "Standard 2/4",
    "ram_mb": 4096
  },
  "private_ip": "10.1.1.25",
  "public_ip": "203.0.113.25",
  "ready_at": 1792368090,
  "ssh_key": "laptop",
  "state": "active",
  "template": {
    "display_name": "Ubuntu 24.04 LTS",
    "icon": "ubuntu",
    "id": 11,
    "os_family": "linux",
    "os_version": "24.04"
  },
  "traffic": null,
  "username": "ubuntu",
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### CPU/RAM/disk/network over time

`GET /v1/vm/{id}/metrics`

Returns CPU, memory, disk and network time series for the last 30 minutes up to 12 hours, one sample per minute, plus the current reading in `now`. Rates are in KB/s; CPU and memory are percentages. Results are cached for 60 seconds per server and range.

Fails with `409 vm_not_ready` while the server has not been created on the infrastructure yet.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm metrics`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `30m`, `1h`, `6h`, `12h` | no | Length of the window ending now. Unknown values fall back to the default. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `range` | string | yes | Window that was applied. |
| `points` | integer | yes | Number of samples returned. |
| `cpu` | object | yes |  |
| `cpu.labels` | array of string | yes |  |
| `cpu.values` | array of number | yes |  |
| `memory` | object | yes |  |
| `memory.values` | array of number | yes |  |
| `network` | object | yes |  |
| `network.values_read` | array of number | yes |  |
| `network.values_write` | array of number | yes |  |
| `network.unit` | string | yes | Always `KB/s`. |
| `disk` | object | yes |  |
| `disk.values_read` | array of number | yes |  |
| `disk.values_write` | array of number | yes |  |
| `disk.unit` | string | yes | Always `KB/s`. |
| `now` | object or null | yes |  |
| `now.cpu_pct` | number | yes | Current CPU usage in percent. |
| `now.mem_pct` | number | yes | Current memory usage in percent. |
| `now.mem_used_mb` | number | yes | Memory in use, in MiB. |
| `now.mem_total_mb` | number | yes | Memory installed, in MiB. |
| `now.state` | string or null | yes | Current power state. |

Example:

```json
{
  "cpu": {
    "labels": [
      "2026-10-19T09:00:00Z",
      "2026-10-19T09:01:00Z",
      "2026-10-19T09:02:00Z"
    ],
    "values": [
      3.2,
      4.1,
      2.8
    ]
  },
  "disk": {
    "unit": "KB/s",
    "values_read": [
      0.0,
      1.2,
      0.0
    ],
    "values_write": [
      14.5,
      9.8,
      11.1
    ]
  },
  "memory": {
    "values": [
      41.5,
      41.7,
      41.6
    ]
  },
  "network": {
    "unit": "KB/s",
    "values_read": [
      12.4,
      8.1,
      9.7
    ],
    "values_write": [
      30.2,
      22.9,
      25.0
    ]
  },
  "now": {
    "cpu_pct": 2.8,
    "mem_pct": 41.6,
    "mem_total_mb": 4096.0,
    "mem_used_mb": 1704.0,
    "state": "Running"
  },
  "points": 3,
  "range": "1h"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server has not been created on the infrastructure yet (still provisioning, or creation failed). The error carries the current `state`. |
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/metrics" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth usage

`GET /v1/vm/{id}/bandwidth`

Returns the traffic of the server as a time series (bytes) together with the monthly bandwidth quota. `in` is traffic into the server, `out` is traffic leaving it.

With `range=1h` the points are 5-second live samples (`source` is `edge_live`); longer ranges are hourly (`6h`, `12h`, `24h`) or daily (`7d`, `30d`) totals. Pass both `from` and `to` to choose an exact window of at most 31 days. `quota` and `period` describe the current quota month, which is anchored on the hour the server was created; they are null when the server has no quota record. `bw` is the same object as Get a service's bandwidth.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm bandwidth`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `12h`, `24h`, `7d`, `30d` | no | Window ending now. Unknown values fall back to the default. |
| `from` | integer | no | Start of an explicit window, Unix seconds. Used only together with `to`, and only when `to` is later than `from` and the window is at most 31 days; otherwise `range` applies. |
| `to` | integer | no | End of an explicit window, Unix seconds. See `from`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `points` | array of object | yes |  |
| `points[].t` | integer | yes | Start of the bucket (Unix time, seconds, UTC) |
| `points[].in` | integer | yes | Bytes received by the server in the bucket. |
| `points[].out` | integer | yes | Bytes sent by the server in the bucket. |
| `points[].total` | integer | yes | `in` + `out`. |
| `totals` | object | yes |  |
| `totals.in` | integer | yes | Bytes received over the window. |
| `totals.out` | integer | yes | Bytes sent over the window. |
| `totals.total` | integer | yes | `in` + `out` over the window. |
| `peak` | object | yes |  |
| `peak.total` | integer | yes | Largest bucket total, in bytes. |
| `peak.at` | integer | yes | Start of the busiest bucket (Unix time, seconds, UTC) |
| `bucket` | string: `raw`, `hour`, `day` | yes | Size of the points: `raw` (5-second samples), `hour` or `day`. |
| `range` | string | yes | Range that was applied. |
| `from` | integer | yes | Start of the window (Unix time, seconds, UTC) |
| `to` | integer | yes | End of the window (Unix time, seconds, UTC) |
| `quota` | object or null | yes |  |
| `quota.limit_bytes` | integer | yes | Bytes allowed in the quota month (monthly allowance plus purchased add-ons). |
| `quota.used_bytes` | integer | yes | Bytes counted against the quota so far. |
| `quota.used_in` | integer | yes | Bytes received in the quota month. |
| `quota.used_out` | integer | yes | Bytes sent in the quota month. |
| `quota.period_start` | integer | yes | Start of the quota month (Unix time, seconds, UTC) |
| `quota.period_end` | integer | yes | End of the quota month (Unix time, seconds, UTC) |
| `period` | object or null | yes |  |
| `period.start` | integer | yes | Start of the quota month (Unix time, seconds, UTC) |
| `period.end` | integer | yes | End of the quota month (Unix time, seconds, UTC) |
| `period.in` | integer | yes | Bytes received in the quota month. |
| `period.out` | integer | yes | Bytes sent in the quota month. |
| `period.total` | integer | yes | `in` + `out` in the quota month. |
| `period.kind` | string | yes | How the month is defined, for example `anchored_month`. |
| `bw` | object or null | yes | Full bandwidth record of the server (quota, add-ons, usage). Same shape as the response of Get a service's bandwidth. |
| `source` | string: `edge_live`, `edge_flow` | yes | Where the points come from: `edge_live` for 5-second samples, `edge_flow` for hourly and daily totals. |
| `port_speed` | string | yes | Network port speed of the site, for example `10 Gbps`. |

Example:

```json
{
  "bucket": "hour",
  "bw": null,
  "from": 1792281600,
  "peak": {
    "at": 1792360800,
    "total": 70500000
  },
  "period": {
    "end": 1793545200,
    "in": 27600000,
    "kind": "anchored_month",
    "out": 83900000,
    "start": 1790953200,
    "total": 111500000
  },
  "points": [
    {
      "in": 18400000,
      "out": 52100000,
      "t": 1792360800,
      "total": 70500000
    },
    {
      "in": 9200000,
      "out": 31800000,
      "t": 1792364400,
      "total": 41000000
    }
  ],
  "port_speed": "10 Gbps",
  "quota": {
    "limit_bytes": 2199023255552,
    "period_end": 1793545200,
    "period_start": 1790953200,
    "used_bytes": 111500000,
    "used_in": 27600000,
    "used_out": 83900000
  },
  "range": "24h",
  "source": "edge_flow",
  "to": 1792368000,
  "totals": {
    "in": 27600000,
    "out": 83900000,
    "total": 111500000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Volumes of the VM

`GET /v1/vm/{id}/volumes`

Lists the disks attached to the server: the system disk and any data disks, with size and state. Results are cached for 20 seconds. Fails with `409 vm_not_ready` while the server has not been created on the infrastructure yet.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm volumes`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string or null | yes | Disk identifier on the infrastructure. |
| `items[].name` | string or null | yes | Disk name. |
| `items[].type` | string or null | yes | `ROOT` for the system disk, `DATADISK` for data disks. |
| `items[].size_gb` | integer or null | yes | Size in GiB. |
| `items[].size_bytes` | integer or null | yes | Size in bytes. |
| `items[].state` | string or null | yes | Disk state, for example `Ready`. |
| `items[].device_id` | integer or null | yes | Device position: 0 is the system disk. |
| `items[].storage_type` | string or null | yes | Storage class, for example `shared`. |
| `items[].created` | string or null | yes | Creation time as reported by the infrastructure. |
| `at` | integer | yes | When the data was read (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792400000,
  "items": [
    {
      "created": "2026-10-19T08:00:12+0000",
      "device_id": 0,
      "id": "5d0c2b7e-93a1-4b6f-8e2d-71c4a9f03b58",
      "name": "ROOT-1042",
      "size_bytes": 64424509440,
      "size_gb": 60,
      "state": "Ready",
      "storage_type": "shared",
      "type": "ROOT"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server has not been created on the infrastructure yet (still provisioning, or creation failed). The error carries the current `state`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`volumes`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/volumes" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Network interfaces and IPs

`GET /v1/vm/{id}/nics`

Lists the network interfaces of the server with their IPv4 and IPv6 addressing. `public_ip` is the address the server is reached on from the internet; it is mapped 1:1 to the private address of the default interface. Results are cached for 20 seconds. Fails with `409 vm_not_ready` while the server has not been created on the infrastructure yet.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm nics`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string or null | yes | Interface identifier. |
| `items[].ipaddress` | string or null | yes | Private IPv4 address. |
| `items[].netmask` | string or null | yes | IPv4 netmask. |
| `items[].gateway` | string or null | yes | IPv4 gateway. |
| `items[].macaddress` | string or null | yes | MAC address. |
| `items[].isdefault` | boolean | yes | Whether this is the default interface. |
| `items[].networkname` | string or null | yes | Name of the network the interface is attached to. |
| `items[].ip6address` | string or null | yes | IPv6 address, when IPv6 is enabled. |
| `items[].ip6cidr` | string or null | yes | IPv6 prefix. |
| `items[].ip6gateway` | string or null | yes | IPv6 gateway. |
| `items[].traffictype` | string or null | yes | Traffic type of the interface, for example `Guest`. |
| `public_ip` | string or null | yes | Public IPv4 address of the server. |
| `static_nat` | boolean | yes | Always `true`: the public address is mapped 1:1 to the server. |
| `at` | integer | yes | When the data was read (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792400000,
  "items": [
    {
      "gateway": "10.1.1.1",
      "id": "9a4e1c77-2b0d-4d5e-b3a8-6f1d2e8c0a45",
      "ip6address": "2001:db8:10::25",
      "ip6cidr": "2001:db8:10::/64",
      "ip6gateway": "2001:db8:10::1",
      "ipaddress": "10.1.1.25",
      "isdefault": true,
      "macaddress": "02:00:2f:7a:00:19",
      "netmask": "255.255.255.0",
      "networkname": "shared-dualstack",
      "traffictype": "Guest"
    }
  ],
  "public_ip": "203.0.113.25",
  "static_nat": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server has not been created on the infrastructure yet (still provisioning, or creation failed). The error carries the current `state`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`nics`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/nics" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### VM event log

`GET /v1/vm/{id}/events`

Returns the activity log of the server, newest first: power actions, plan changes, renewals, locks, failures. `msg` is display text in English (older entries can be in Vietnamese); to show the message in your own language use `key` and `args`, and rely on `kind` and `status` for logic. Use `exclude=billing` to hide renewals, refunds, charges and lock events.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `kind` | string | no | Keep only events of this exact kind (letters, digits and underscores, at most 40 characters). |
| `q` | string | no | Search text matched against the message and the actor (substring). |
| `keys` | string | no | Optional, used together with `q`: comma-separated event `key` values (at most 200; each made of lowercase letters, digits, `_` and `.`, up to 80 characters). Events whose `key` is in the list match as well, so a client can search in its own language by sending the keys whose translated text contains the search text. Invalid entries are ignored. |
| `exclude` | string | no | Set to `billing` to hide billing-related kinds (`renewal`, `refund`, `extend`, `billing_edit`, `change_cycle`, `lock`, `unlock`, `charge`, `reminder`, `invoice`). Several values can be separated by commas. |
| `status` | string: `success`, `failed`, `warning` | no | Keep only events with this outcome. Other values are ignored. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VmEvent | yes |  |
| `items[].id` | integer | yes | Event identifier. Higher means newer. |
| `items[].at` | integer | yes | When the event happened (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | Event type, for example `create`, `start`, `stop`, `reboot`, `rename`, `change_plan`, `renewal`, `refund`, `lock`, `unlock`, `destroy`, `job_failed`. New kinds can appear. |
| `items[].actor` | string | yes | Who caused the event: `customer:<account id>`, `system:<reason>`, or `previous_owner` for actions taken by an earlier owner of a transferred server. |
| `items[].msg` | string | yes | Human-readable text for display, in English (older entries can be in Vietnamese). Do not parse it; use `kind` for logic, and `key` + `args` to show the message in your own language. |
| `items[].key` | string or null | yes | Stable message code, for example `vm.ready` or `bill.ordered`; `null` for entries written before message codes existed. Failed operations carry a public code such as `error.capacity` instead of the raw error. |
| `items[].args` | object | yes | Raw values to fill into the message named by `key` (string values): IPs, plan names, billing cycle codes such as `hourly`, amounts in cents (`*_cents`), prices in micro-dollars (`*_uusd`), timestamps in seconds (`*_at`). An empty object when `key` is `null`. |
| `items[].status` | string: `success`, `failed`, `warning` | yes | Outcome badge derived from `kind`. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "actor": "customer:1042",
      "args": {},
      "at": 1792400000,
      "id": 981,
      "key": "vm.rebooted",
      "kind": "reboot",
      "msg": "Rebooted",
      "status": "success"
    },
    {
      "actor": "customer:1042",
      "args": {
        "cycle": "monthly",
        "host": "web-01",
        "plan": "Standard 2/4"
      },
      "at": 1792368000,
      "id": 975,
      "key": "bill.ordered",
      "kind": "create",
      "msg": "Ordered Standard 2/4 (web-01) cycle monthly",
      "status": "success"
    }
  ],
  "page": 1,
  "per_page": 50,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Running jobs of the VM

`GET /v1/vm/{id}/jobs`

Returns the 50 most recent background jobs of the server, newest first: creation, power actions, plan changes, SSH-key changes and deletion. Every action endpoint returns a `job_id`; poll this list until that job's `state` is `done`, `failed` or `cancelled`. `last_error` is a short customer-safe message and `error_code` a stable short code; internal diagnostics are never exposed.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm jobs`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VmJob | yes |  |
| `items[].id` | integer | yes | Job identifier (the `job_id` returned by the action). |
| `items[].kind` | string | yes | What the job does: `deploy`, `start`, `stop`, `force_stop`, `reboot`, `reset_password`, `reinstall`, `change_template`, `change_plan`, `sshkey_reset`, `change_ip`, `toggle_ipv6`, `destroy`... New kinds can appear. |
| `items[].state` | string: `queued`, `running`, `done`, `failed`, `cancelled` | yes | `queued` and `running` are in flight; `done`, `failed` and `cancelled` are final. |
| `items[].step` | string | yes | Free-form progress marker of the job. Informational only; the values can change. |
| `items[].attempt` | integer | yes | Number of attempts made so far. Jobs are retried automatically on transient errors. |
| `items[].created_at` | integer | yes | When the job was queued (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Last progress update (Unix time, seconds, UTC) |
| `items[].finished_at` | integer or null | yes | When the job reached a final state. null while it is in flight (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Short, customer-safe description of the last error, or null. |
| `items[].error_code` | string or null: `cancelled`, `capacity`, `timeout`, `ip_alloc`, `network`, `provision`, `destroy`, `resize`, `error` | yes | Stable short code for `last_error`: `capacity` (no room on the infrastructure), `timeout`, `ip_alloc` (no public IP available), `network`, `provision`, `destroy`, `resize`, `cancelled` or the generic `error`. |
| `items[].payload` | object | no |  |
| `items[].payload.enable` | boolean or null | yes | Target IPv6 setting requested by the job. |

Example:

```json
{
  "items": [
    {
      "attempt": 1,
      "created_at": 1792400000,
      "error_code": null,
      "finished_at": 1792400042,
      "id": 4812,
      "kind": "reboot",
      "last_error": null,
      "state": "done",
      "step": "done",
      "updated_at": 1792400042
    },
    {
      "attempt": 1,
      "created_at": 1792368000,
      "error_code": null,
      "finished_at": 1792368090,
      "id": 4790,
      "kind": "deploy",
      "last_error": null,
      "state": "done",
      "step": "done",
      "updated_at": 1792368090
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/jobs" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Billing of this VM

`GET /v1/vm/{id}/billing`

Returns the billing state of one server: price, billing cycle, how far it is paid, your wallet balance, and the wallet charges and invoices that belong to this server. `charges` holds up to the 200 latest wallet entries linked to the server (newest first) and `invoices` up to the 100 latest invoices. If the server was transferred to you, invoices of earlier owners are included with `previous_owner: true` and their personal fields redacted.

For the account-wide wallet and invoices use the Billing endpoints.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm billing`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cycle` | string | yes | Billing cycle slug. |
| `hourly_mills` | integer | yes | Hourly price in mills (US$0.001), rounded. |
| `hourly` | string | yes | Hourly price as a decimal string, for example `$0.005`. |
| `monthly_cents` | integer | yes | Price of a 30-day month (730 hours) in US cents, at the hourly price. |
| `cycle_cents` | integer | yes | Price of one billing cycle in US cents, as locked in for the current period. 0 for hourly servers. |
| `cycle_started_at` | integer or null | yes | Start of the current billing cycle (Unix time, seconds, UTC) |
| `paid_until` | integer or null | yes | End of the paid period. null for hourly servers (Unix time, seconds, UTC) |
| `billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `auto_renew` | boolean | yes | Whether a prepaid server renews automatically from the wallet. |
| `balance_cents` | integer | yes | Wallet balance in US cents. |
| `charges` | array of VmLedgerEntry | yes |  |
| `charges[].id` | integer | yes | Ledger entry identifier. |
| `charges[].account_id` | integer | yes | Account the entry belongs to. |
| `charges[].delta_cents` | integer | yes | Change of the wallet balance in US cents. Negative for charges, positive for refunds and top-ups. |
| `charges[].kind` | string: `deposit`, `charge`, `refund`, `adjust` | yes | Entry type. |
| `charges[].ref` | string | yes | Unique reference of the entry; it also makes charges idempotent. |
| `charges[].vm_id` | string or null | yes | Server the entry relates to. |
| `charges[].note` | string or null | yes | Human-readable note. |
| `charges[].actor` | string | yes | Who caused the entry: `customer:<account id>` or `system:<reason>`. |
| `charges[].at` | integer | yes | When the entry was written (Unix time, seconds, UTC) |
| `invoices` | array of VmInvoice | yes |  |
| `invoices[].id` | integer | yes | Invoice identifier. |
| `invoices[].number` | string or null | yes | Invoice number, for example `EX202610-000042`. |
| `invoices[].account_id` | integer or null | yes | Account that was invoiced. null for invoices of a previous owner. |
| `invoices[].vm_id` | string or null | yes | Server the invoice relates to. |
| `invoices[].kind` | string: `receipt`, `renewal`, `topup`, `manual`, `refund` | yes | Invoice type. |
| `invoices[].status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | yes | Payment status. |
| `invoices[].subtotal_cents` | integer | yes | Amount before tax in US cents. |
| `invoices[].total_cents` | integer | yes | Amount due in US cents. |
| `invoices[].currency` | string | yes | Lower-case currency code, `usd`. |
| `invoices[].due_at` | integer or null | yes | Payment deadline (Unix time, seconds, UTC) |
| `invoices[].paid_at` | integer or null | yes | When the invoice was paid (Unix time, seconds, UTC) |
| `invoices[].ledger_ref` | string or null | yes | Reference of the wallet entry that paid the invoice. |
| `invoices[].seller_json` | string | yes | Seller details as a JSON-encoded string. |
| `invoices[].buyer_json` | string | yes | Buyer details as a JSON-encoded string. `{"redacted":true}` for invoices of a previous owner. |
| `invoices[].note` | string or null | yes | Free-form note. null for invoices of a previous owner. |
| `invoices[].created_at` | integer | yes | When the invoice was created (Unix time, seconds, UTC) |
| `invoices[].updated_at` | integer | yes | When the invoice last changed (Unix time, seconds, UTC) |
| `invoices[].previous_owner` | boolean | no | `true` when the invoice was issued to an earlier owner of a transferred server; personal fields are then redacted. |

Example:

```json
{
  "auto_renew": true,
  "balance_cents": 2157,
  "billed_until": null,
  "charges": [
    {
      "account_id": 1042,
      "actor": "customer:1042",
      "at": 1792368000,
      "delta_cents": -343,
      "id": 5531,
      "kind": "charge",
      "note": "New VM web-01 (monthly)",
      "ref": "vm:new:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "cycle": "monthly",
  "cycle_cents": 343,
  "cycle_started_at": 1792368000,
  "hourly": "$0.005",
  "hourly_mills": 5,
  "invoices": [
    {
      "account_id": 1042,
      "buyer_json": "{}",
      "created_at": 1792368000,
      "currency": "usd",
      "due_at": null,
      "id": 311,
      "kind": "receipt",
      "ledger_ref": "vm:new:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "note": null,
      "number": "EX202610-000042",
      "paid_at": 1792368000,
      "seller_json": "{}",
      "status": "paid",
      "subtotal_cents": 343,
      "total_cents": 343,
      "updated_at": 1792368000,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "monthly_cents": 343,
  "paid_until": 1794960000
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/billing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote before changing plan

`GET /v1/vm/{id}/plan-quote`

Dry run of Change plan: tells you what moving the server to another fixed plan would cost or refund, without changing or charging anything. For prepaid servers the amount is the prorated price difference for the time left in the paid period; for hourly servers the new price simply applies from the next hour (`hourly_note` is `true`). `allowed` says whether Change plan would accept the change right now.

`cycle` lets you preview the price for another billing cycle; it does not change the cycle of the server.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm plan-quote`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `plan_id` | integer | yes | Plan to move to, from the catalog. |
| `cycle` | string | no | Billing cycle slug to quote for. Defaults to the cycle of the server. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `from` | VmQuotePlan | yes |  |
| `from.plan_id` | integer | yes | Plan identifier. |
| `from.name` | string | yes | Plan name. |
| `from.cpu` | integer | yes | Virtual CPU cores. |
| `from.ram_mb` | integer | yes | Memory in MiB. |
| `from.disk_gb` | integer | yes | System disk in GiB. |
| `from.hourly_mills` | integer | yes | Hourly price in mills (US$0.001), rounded. |
| `from.hourly` | string | no | Hourly price as a decimal string, for example `$0.005`. |
| `from.monthly_cents` | integer | no | Price for a 30-day month (730 hours) in US cents. |
| `from.cents` | integer | yes | Price of one full cycle of the quoted billing cycle, in US cents. 0 for hourly billing. |
| `to` | VmQuotePlan | yes |  |
| `to.plan_id` | integer | yes | Plan identifier. |
| `to.name` | string | yes | Plan name. |
| `to.cpu` | integer | yes | Virtual CPU cores. |
| `to.ram_mb` | integer | yes | Memory in MiB. |
| `to.disk_gb` | integer | yes | System disk in GiB. |
| `to.hourly_mills` | integer | yes | Hourly price in mills (US$0.001), rounded. |
| `to.hourly` | string | no | Hourly price as a decimal string, for example `$0.005`. |
| `to.monthly_cents` | integer | no | Price for a 30-day month (730 hours) in US cents. |
| `to.cents` | integer | yes | Price of one full cycle of the quoted billing cycle, in US cents. 0 for hourly billing. |
| `cycle` | string | yes | Billing cycle the quote was computed for. |
| `months` | integer | yes | Months in that cycle. 0 for hourly billing. |
| `remaining_hours` | integer | yes | Hours left in the paid period of the server (0 for hourly billing). |
| `unused_cents` | integer | yes | Value in US cents of the unused part of the current period. |
| `amount_due_cents` | integer | yes | Amount that would be charged now, in US cents. 0 when the new plan is cheaper or the server is billed hourly. |
| `refund_cents` | integer | yes | Amount that would be credited back now, in US cents (never more than you actually paid for the period). |
| `immediate` | boolean | yes | Always `true`: the money moves when the change is requested. |
| `disk_shrink` | boolean | yes | `true` when the new plan has a smaller disk. Disks cannot shrink, so the change is not allowed. |
| `same_plan` | boolean | yes | `true` when the target is the plan the server already has. |
| `allowed` | boolean | yes | Whether Change plan would accept this change right now. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |
| `hourly_note` | boolean | yes | `true` for hourly servers, where the new price simply applies from the next hour. |

Example:

```json
{
  "allowed": true,
  "amount_due_cents": 288,
  "balance_cents": 2500,
  "cycle": "monthly",
  "disk_shrink": false,
  "from": {
    "cents": 343,
    "cpu": 2,
    "disk_gb": 60,
    "hourly": "$0.005",
    "hourly_mills": 5,
    "monthly_cents": 343,
    "name": "Standard 2/4",
    "plan_id": 3,
    "ram_mb": 4096
  },
  "hourly_note": false,
  "immediate": true,
  "months": 1,
  "refund_cents": 0,
  "remaining_hours": 612,
  "same_plan": false,
  "to": {
    "cents": 686,
    "cpu": 4,
    "disk_gb": 80,
    "hourly": "$0.010",
    "hourly_mills": 10,
    "monthly_cents": 686,
    "name": "Standard 4/8",
    "plan_id": 4,
    "ram_mb": 8192
  },
  "unused_cents": 288
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `plan_other_zone` | The plan belongs to another region. A server cannot move between regions; create a new server there instead. |
| 409 | `resize_license` | The chosen plan carries an operating-system license the server does not have, or a different one. |
| 422 | `invalid_argument` | `plan_id` is missing, unknown, not on sale, a custom configuration, not visible to your site, or `cycle` is not a valid billing cycle. The error names the offending `field`. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/plan-quote?plan_id=<plan_id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Available templates for this VM

`GET /v1/vm/{id}/template-options`

Lists the operating-system templates this server can be reinstalled with (Change OS): templates available in the server's region for its source, in display order. Pass an `id` from this list as `template_id` to the reinstall action; any other value is rejected.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm template-options`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Template identifier, used as `template_id` when reinstalling. |
| `items[].display_name` | string | yes | Name shown to users, for example `Ubuntu 24.04`. |
| `items[].os_family` | string | yes | Operating-system family, for example `ubuntu`, `debian` or `windows`. |
| `items[].os_version` | string or null | yes | Operating-system version, when known. |
| `items[].username` | string | yes | Default login user name of the template. |
| `items[].icon` | string or null | yes | Icon key of the operating system, when set. |
| `items[].size_gb` | integer or null | yes | Minimum system disk size in GiB, when known. |
| `items[].min` | object or null | yes |  |
| `items[].min.cpu` | integer | yes | Smallest number of vCPU cores this template can be installed on. |
| `items[].min.ram_mb` | integer | yes | Smallest memory in MiB. |
| `items[].min.disk_gb` | integer | yes | Smallest system disk in GiB. |
| `items[].category` | string | yes | `desktop` for a VM Desktop image, empty for a standard image. |

Example:

```json
{
  "items": [
    {
      "category": "",
      "display_name": "Ubuntu 24.04",
      "icon": "ubuntu",
      "id": 12,
      "min": null,
      "os_family": "ubuntu",
      "os_version": "24.04",
      "size_gb": 20,
      "username": "ubuntu"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/template-options" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Plans this VM can switch to (same zone)

`GET /v1/vm/{id}/plan-options`

Lists the fixed plans this server can switch to: plans in the same region that are on sale to you, have a disk at least as large as the current one and differ from the current plan, cheapest first. Each option carries a ready-made `quote` (the same object Get plan quote returns), whether the change needs the server to be stopped (`requires_stop`), and what kind of change it is.

`blocked` is non-null when plan changes are impossible at the moment, for example because the server runs a custom configuration (use Change custom configuration instead) or is not `active`.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm plan-options`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm_id` | string | yes | Server identifier. |
| `zone` | Zone or null | yes |  |
| `current` | object | yes |  |
| `current.plan_id` | integer | yes | Current plan identifier. |
| `current.name` | string | yes | Current plan name. |
| `current.cpu` | integer | yes | Virtual CPU cores. |
| `current.ram_mb` | integer | yes | Memory in MiB. |
| `current.disk_gb` | integer | yes | System disk in GiB. |
| `current.is_custom` | boolean | yes | `true` when the server runs a custom configuration. |
| `current.cycle` | string | yes | Billing cycle slug. |
| `blocked` | object or null | yes |  |
| `blocked.code` | string: `custom_switch_unsupported`, `vm_not_active` | yes | Why plan changes are blocked: `custom_switch_unsupported` (the server runs a custom configuration) or `vm_not_active`. |
| `options` | array of object | yes |  |
| `options[].plan_id` | integer | yes | Plan identifier. Pass it to Change plan. |
| `options[].name` | string | yes | Plan name. |
| `options[].cpu` | integer | yes | Virtual CPU cores. |
| `options[].ram_mb` | integer | yes | Memory in MiB. |
| `options[].disk_gb` | integer | yes | System disk in GiB. |
| `options[].hourly_uusd` | integer | yes | Exact hourly price at your site, in millionths of a US dollar. |
| `options[].monthly_cents` | integer | yes | Price for a 30-day month at your site, in US cents. |
| `options[].change` | string: `upgrade`, `downgrade`, `sidegrade` | yes | Kind of change compared with the current plan. |
| `options[].live` | boolean | yes | Always `false`: plan changes are not applied without a restart. |
| `options[].requires_stop` | boolean | yes | `true` when the server is (or may be) running and the change needs it to be stopped and started again. |
| `options[].quote` | VmPlanQuote or null | yes |  |

Example:

```json
{
  "blocked": null,
  "current": {
    "cpu": 2,
    "cycle": "monthly",
    "disk_gb": 60,
    "is_custom": false,
    "name": "Standard 2/4",
    "plan_id": 3,
    "ram_mb": 4096
  },
  "options": [
    {
      "change": "upgrade",
      "cpu": 4,
      "disk_gb": 80,
      "hourly_uusd": 9408,
      "live": false,
      "monthly_cents": 686,
      "name": "Standard 4/8",
      "plan_id": 4,
      "quote": {
        "allowed": true,
        "amount_due_cents": 288,
        "balance_cents": 2500,
        "cycle": "monthly",
        "disk_shrink": false,
        "from": {
          "cents": 343,
          "cpu": 2,
          "disk_gb": 60,
          "hourly": "$0.005",
          "hourly_mills": 5,
          "monthly_cents": 343,
          "name": "Standard 2/4",
          "plan_id": 3,
          "ram_mb": 4096
        },
        "hourly_note": false,
        "immediate": true,
        "months": 1,
        "refund_cents": 0,
        "remaining_hours": 612,
        "same_plan": false,
        "to": {
          "cents": 686,
          "cpu": 4,
          "disk_gb": 80,
          "hourly": "$0.010",
          "hourly_mills": 10,
          "monthly_cents": 686,
          "name": "Standard 4/8",
          "plan_id": 4,
          "ram_mb": 8192
        },
        "unused_cents": 288
      },
      "ram_mb": 8192,
      "requires_stop": true
    }
  ],
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/plan-options" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Preview before delete

`GET /v1/vm/{id}/delete-preview`

Shows what deleting the server would do, without deleting anything: the estimated refund, how the refund is computed, and the resources that will be destroyed with it (data disks, backups, IP addresses, VM snapshots). Call it before Delete a VM and show it to the user.

`formula` explains the refund: `prorated` (prepaid servers get the unused part of the paid period back), `hourly_no_refund` (hourly servers are billed up to the hour already started) or `cancel_full` (a server still being created is refunded in full). `can_delete` is `false` for locked servers.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm delete-preview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `refund_cents` | integer | yes | Estimated refund in US cents. The real refund is credited when deletion completes. |
| `formula` | string: `prorated`, `hourly_no_refund`, `cancel_full` | yes | How the refund is computed. |
| `used_hours` | integer | yes | Hours used in the current billing cycle (rounded up). |
| `paid_cents` | integer | yes | Money actually paid for the current cycle in US cents. This is the ceiling of any refund. |
| `cycle_cents` | integer | yes | Price of one billing cycle in US cents. |
| `cycle` | string | yes | Billing cycle slug. |
| `paid_until` | integer or null | yes | End of the paid period (Unix time, seconds, UTC) |
| `hostname` | string | yes | Host name to send as `confirm_hostname` when deleting. |
| `can_delete` | boolean | yes | Whether Delete a VM would be accepted right now (state `active`, `failed` or `provisioning`, and not locked). |
| `backup_count` | integer | yes | Number of backups that will be destroyed with the server. |
| `backup_schedule` | string or null | yes | Backup schedule that will be removed, for example `daily`. |
| `volumes` | array of object | yes |  |
| `volumes[].name` | string | yes | Data disk name. |
| `volumes[].size_gb` | integer | yes | Data disk size in GiB. |
| `ip` | string or null | yes | Public IPv4 address that will be released. |
| `ipv6` | string or null | yes | Public IPv6 address that will be released. |
| `vm_snapshot_count` | integer or null | yes | Number of VM snapshots that will be destroyed. null when the count could not be read. |

Example:

```json
{
  "backup_count": 0,
  "backup_schedule": null,
  "can_delete": true,
  "cycle": "monthly",
  "cycle_cents": 343,
  "formula": "prorated",
  "hostname": "web-01",
  "ip": "203.0.113.25",
  "ipv6": "2001:db8:10::25",
  "paid_cents": 343,
  "paid_until": 1794960000,
  "refund_cents": 297,
  "used_hours": 82,
  "vm_snapshot_count": 0,
  "volumes": []
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/delete-preview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### The pre-attached ops SSH key (name + fingerprint, not a secret)

`GET /v1/vm/ops-key`

Returns the name and fingerprint of the platform's maintenance SSH key. When `attach` is `true`, this key is installed on new servers next to your own key so that support can help you; use the fingerprint to recognise it in your server's authorized keys. The value is public information and the same for every customer of the site; it is cached for 15 minutes.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm ops-key`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `name` | string | yes | Key name. |
| `fingerprint` | string or null | yes | Key fingerprint, or null when the key is not found. |
| `found` | boolean | yes | Whether the key exists. |
| `attach` | boolean | yes | Whether the key is installed on new servers. |

Example:

```json
{
  "attach": true,
  "fingerprint": "5c:2a:91:0e:7b:63:d4:18:aa:f0:3e:4d:92:6b:71:c5",
  "found": true,
  "name": "support-ops"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/ops-key" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Start the VM

`POST /v1/vm/{id}/start`

Powers the server on. The call returns immediately with a `job_id`; the server is running once the job is `done` and `cs_state` is `Running`. Starting a server that is already running succeeds without effect. Powering on is refused while the server is locked.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm start`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/start" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Stop the VM (graceful)

`POST /v1/vm/{id}/stop`

Shuts the server down gracefully (an ACPI power-button signal, so the operating system can close files and services). If the guest does not shut down in time, it is powered off forcibly. The call returns immediately with a `job_id`. A stopped prepaid server stays billed; a stopped hourly server is still billed hourly because its resources remain reserved.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm stop`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/stop" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Force stop the VM

`POST /v1/vm/{id}/force-stop`

Powers the server off immediately, like pulling the power cable. Unsaved data in memory is lost and file systems may need a repair on the next boot, so use Stop first and keep this for servers that do not respond. The call returns immediately with a `job_id`.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm force-stop` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/force-stop" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Reboot the VM

`POST /v1/vm/{id}/reboot`

Restarts the server (a soft reboot signalled to the operating system). A stopped server is started instead. The call returns immediately with a `job_id`.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm reboot`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/reboot" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Reset the admin password

`POST /v1/vm/{id}/reset-password`

Generates a new administrator password for the server. A running server is stopped, the password is reset, and the server is started again, so expect a short downtime. The new password is never returned by the API: it is e-mailed to the account holder once the job is `done`. Keep a copy of your SSH key as the alternative way in.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm reset-password`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/reset-password" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach an SSH key to the VM

`POST /v1/vm/{id}/ssh-key`

Replaces the SSH key installed on the server with one of your saved keys (see List SSH keys). A running server is stopped, the key is installed, and the server is started again, so expect a short downtime; the previous key stops working. The server is recorded as using the new key once the job is `done`.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm ssh-key attach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `ssh_key_id` | integer | yes | Identifier of one of your saved SSH keys. |

Example:

```json
{
  "ssh_key_id": 7
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the action. Follow it with List a VM's jobs. |

Example:

```json
{
  "job_id": 4812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 404 | `not_found` | The server does not exist or is not yours, or the SSH key does not exist or is not yours. |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 409 | `same_key` | The server already uses this key. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`ssh_key_reset`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | `ssh_key_id` is missing or not a positive integer. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/ssh-key" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ssh_key_id":7}'
```

---

#### Rename / notes

`PATCH /v1/vm/{id}`

Changes the display name of the server. The host name cannot be changed. Works in any state except `locked`; it does not need the server to be idle. The updated server is returned (without the network and lock details that Get a VM adds).

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `display_name` | string | yes | New display name, 1 to 120 characters after trimming. Control characters are removed. |

Example:

```json
{
  "display_name": "Production web server"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm` | Vm | yes |  |
| `vm.id` | string | yes | Server identifier (UUID). Use it in every `/v1/vm/{id}` path. |
| `vm.hostname` | string | yes | Host name chosen at creation: lowercase letters, digits and hyphens. It is unique on the platform and cannot be changed. |
| `vm.display_name` | string | yes | Free-form label shown in dashboards. Change it with Update a VM. |
| `vm.state` | string: `provisioning`, `active`, `locked`, `failed`, `deleting`, `deleted` | yes | Lifecycle state. `provisioning`: being created. `active`: ready to use (see `cs_state` for the power state). `locked`: suspended for lack of funds, expiry or by an administrator (see `lock_reason`). `failed`: creation failed and was refunded. `deleting`: deletion in progress. `deleted`: gone. |
| `vm.cs_state` | string or null | yes | Power state reported by the hypervisor, for example `Running`, `Stopped`, `Starting` or `Stopping`. null until the first status sync after creation. |
| `vm.public_ip` | string or null | yes | Public IPv4 address, once assigned. |
| `vm.private_ip` | string or null | yes | Private IPv4 address inside the platform network, once known. |
| `vm.ipv6` | string or null | yes | Public IPv6 address, when IPv6 is enabled and assigned. |
| `vm.plan` | VmPlanBrief | yes |  |
| `vm.plan.name` | string | yes | Plan name at the time of the order, or the generated name of a custom configuration (for example `Custom 4C/8G/80G`). |
| `vm.plan.cpu` | integer | yes | Virtual CPU cores. |
| `vm.plan.ram_mb` | integer | yes | Memory in MiB. |
| `vm.plan.disk_gb` | integer | yes | System disk in GiB. |
| `vm.plan.is_custom` | boolean | yes | `true` for a custom configuration (own vCPU / RAM / disk) rather than a fixed plan. |
| `vm.template` | VmTemplateBrief | yes |  |
| `vm.template.id` | integer | yes | Image identifier (the `template_id` used at creation). 0 when the image no longer exists. |
| `vm.template.display_name` | string | yes | Human readable image name, for example `Ubuntu 24.04 LTS`. |
| `vm.template.os_family` | string | yes | Operating system family: `linux`, `windows`... |
| `vm.template.os_version` | string or null | yes | Version label, when known. |
| `vm.template.icon` | string or null | yes | Icon name for the image, when known. |
| `vm.template.category` | string: `desktop` | no | Present when the image is a VM Desktop image (Ubuntu Desktop with a remote screen through RustDesk or Remote Desktop). Absent for standard images. |
| `vm.cycle` | string | yes | Billing cycle slug: `hourly` or a prepaid cycle such as `monthly` or `yearly`. See the catalog for the cycles on sale. |
| `vm.paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `vm.billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `vm.hourly_mills` | integer | yes | Hourly price in mills (1 mill = US$0.001), rounded. Use `hourly_uusd` for the exact price. |
| `vm.hourly_uusd` | integer | yes | Exact hourly price in millionths of a US dollar (4704 = US$0.004704 per hour). This is the price the server is billed at, whatever its cycle. |
| `vm.locked_at` | integer or null | yes | When the server was locked, or null (Unix time, seconds, UTC) |
| `vm.lock_reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the server is locked. `no_funds`: the wallet could not pay an hourly charge. `expired`: a prepaid period ended without renewal. `admin`: suspended by an administrator. `abuse`: suspended after an abuse report. |
| `vm.destroy_after` | integer or null | yes | When a locked server will be destroyed automatically if it is not unlocked before. null when no deadline applies (Unix time, seconds, UTC) |
| `vm.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `vm.ready_at` | integer or null | yes | When the server first became ready. null while it is still being created (Unix time, seconds, UTC) |
| `vm.job_running` | boolean | yes | `true` while a background job (start, resize, deletion...) is queued or running on the server. New actions fail with `409 job_running` until it ends. |
| `vm.autoscale_enabled` | boolean | yes | Whether automatic vertical scaling is switched on for this server. |
| `vm.capabilities` | VmCapabilities | no | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `vm.capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `vm.capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `vm.capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `vm.capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `vm.capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `vm.capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `vm.capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `vm.capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `vm.capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `vm.capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `vm.capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `vm.capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `vm.capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `vm.capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `vm.capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `vm.capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `vm.capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `vm.capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `vm.capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `vm.capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `vm.capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `vm.capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `vm.capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `vm.capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `vm.capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `vm.traffic` | VmTraffic or null | no |  |
| `vm.ips` | array of string | no |  |
| `vm.extras` | object | no |  |
| `vm.extras.extra_ips` | integer | yes | Additional IPv4 addresses chosen when the server was ordered (0 to 3). |
| `vm.cycles` | array or null | no |  |
| `vm.provisioning` | VmProvisioning or null | no |  |
| `vm.imported` | boolean | no | `true` for a server that the team assigned to your account (free of charge). Only an administrator can delete it or change its plan or billing cycle; those calls fail with `409 imported_vm_admin_only`. Absent or `false` for every other server. |
| `vm.username` | string | yes | Default administrator account name of the operating system image (for example `ubuntu` or `Administrator`). |
| `vm.ssh_key` | string or null | yes | Name of the SSH key installed on the server, or null when no key was chosen. |
| `vm.cs_vm_id` | string or null | yes | Identifier of the server on the underlying infrastructure. null until deployment has created it. Quote it in support requests. |
| `vm.ha` | boolean | yes | Whether the server is restarted automatically on another host if its host fails. |
| `vm.password_lost` | boolean | yes | `true` when the platform could not obtain the administrator password after the last install or reset. Use Reset password to get a new one. |
| `vm.cycle_cents` | integer | yes | Price of one billing cycle in US cents, as locked in for the current period. 0 for hourly servers. |
| `vm.cycle_started_at` | integer or null | yes | Start of the current billing cycle (Unix time, seconds, UTC) |
| `vm.auto_renew` | boolean | yes | Whether a prepaid server renews automatically from the wallet when the period ends. |
| `vm.cancel_requested` | boolean | yes | `true` when deletion was requested while the server was still being created; the deployment stops at its next step and the order is refunded. |
| `vm.enable_ipv6` | boolean | yes | Whether the server is on the dual-stack (IPv4 + IPv6) network. |
| `vm.autoscale_state` | string | no | State of the automatic scaling rule (for example `idle` or `scaled`). Present only when a rule exists. |
| `vm.autoscale_target_cpu` | integer | no | vCPU count the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.autoscale_target_ram_mb` | integer | no | Memory in MiB the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.zone` | Zone or null | no |  |
| `vm.network` | VmNetwork | no |  |
| `vm.network.type` | string: `shared`, `vpc` | yes | `shared`: the standard shared network. `vpc`: a tier of your own Private Cloud. |
| `vm.network.vpc_id` | string | no | Private Cloud identifier. Present when `type` is `vpc`. |
| `vm.network.vpc_name` | string | no | Private Cloud name. Present when `type` is `vpc`. |
| `vm.network.tier_id` | string | no | Tier identifier. Present when `type` is `vpc`. |
| `vm.network.tier` | string | no | Tier name. Present when `type` is `vpc`. |
| `vm.network.cidr` | string | no | Tier address range. Present when `type` is `vpc`. |
| `vm.network.mbps` | integer | no | Bandwidth of the Private Cloud in Mbit/s. Present when `type` is `vpc`. |
| `vm.network.unmetered` | boolean | no | Whether traffic inside the Private Cloud plan is unmetered. Present when `type` is `vpc`. |
| `vm.live` | object | no |  |
| `vm.live.cs_state` | string or null | yes | Power state read from the hypervisor. |
| `vm.live.nic` | string or null | yes | Private IPv4 address. |
| `vm.live.ip` | string or null | yes | Public IPv4 address. |
| `vm.live.ipv6` | string or null | yes | Public IPv6 address. |
| `vm.live.synced_at` | integer or null | yes | When the data was read (Unix time, seconds, UTC) |
| `vm.lock_note` | string or null | no | Note left by an administrator when the server was locked. |
| `vm.failed_reason` | string or null | no | Short reason when `state` is `failed`. |
| `vm.credentials_once` | string or null | no | Token the web panel uses to show the initial password a single time. It cannot be redeemed with an API key; the password itself is e-mailed to the account holder. |

Example:

```json
{
  "vm": {
    "auto_renew": true,
    "autoscale_enabled": false,
    "billed_until": null,
    "cancel_requested": false,
    "capabilities": {
      "autoscale": true,
      "backup": true,
      "bandwidth": true,
      "byoip": true,
      "change_ip": true,
      "console": "vnc",
      "ddos_shield": true,
      "firewall": true,
      "hypervisor": true,
      "ipv6": true,
      "iso": true,
      "metrics": true,
      "metrics_mem_disk": true,
      "nics": true,
      "port_forward": true,
      "private_ip": true,
      "reinstall": true,
      "reset_password": true,
      "resize_cpu_ram": true,
      "resize_disk_grow": true,
      "resize_live": true,
      "snapshot": true,
      "ssh_key_reset": true,
      "volumes": true,
      "vpc": true
    },
    "created_at": 1792368000,
    "cs_state": "Running",
    "cs_vm_id": "b6a3f6d2-4c1e-4f7a-9d58-2e0c7b1a9f34",
    "cycle": "monthly",
    "cycle_cents": 343,
    "cycle_started_at": 1792368000,
    "destroy_after": null,
    "display_name": "Production web server",
    "enable_ipv6": true,
    "ha": true,
    "hostname": "web-01",
    "hourly_mills": 5,
    "hourly_uusd": 4704,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": "2001:db8:10::25",
    "job_running": false,
    "lock_reason": null,
    "locked_at": null,
    "paid_until": 1794960000,
    "password_lost": false,
    "plan": {
      "cpu": 2,
      "disk_gb": 60,
      "is_custom": false,
      "name": "Standard 2/4",
      "ram_mb": 4096
    },
    "private_ip": "10.1.1.25",
    "public_ip": "203.0.113.25",
    "ready_at": 1792368090,
    "ssh_key": "laptop",
    "state": "active",
    "template": {
      "display_name": "Ubuntu 24.04 LTS",
      "icon": "ubuntu",
      "id": 11,
      "os_family": "linux",
      "os_version": "24.04"
    },
    "traffic": null,
    "username": "ubuntu"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `display_name` is missing or empty. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). |
| 502 | `cloudstack_error` | The new name could not be applied on the infrastructure. Retry in a few seconds. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/vm/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"Production web server"}'
```

---

#### Create a VM (charges the wallet)

`POST /v1/vm`

Orders a new server and returns it at once in the `provisioning` state; it becomes `active` (usually within a couple of minutes) when the operating system is installed. The first charge is taken from your wallet in the same request: the first hour for `hourly` servers, or the whole price of the cycle for prepaid cycles. Nothing is charged if the request fails, and a deployment that fails later is refunded automatically (the server becomes `failed`).

Choose the size with either `plan_id` (a fixed plan, see the catalog) or `custom` (your own vCPU, RAM and disk, only on sites that sell custom configurations; if both are sent, `custom` wins). `template_id` selects the operating system image; it must be available in the chosen region. Use `zone_id` to pick a region when the site has several; leave it out to use the default one.

The initial administrator password is never returned by the API: it is e-mailed to the account holder when the server is ready. Pass `ssh_key_id` to log in with an SSH key instead. Follow the deployment with List a VM's jobs or poll Get a VM.

Your wallet must cover the first charge and the site's minimum balance, your e-mail address must be verified, and new accounts can run only a few servers (2 by default) until a first payment of at least US$10 has completed. Use Get the VM catalog for plans, images, cycles and regions, and Quote a custom configuration to price a custom size.

**Required scope:** `vm:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:create` | CLI: `vm create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `hostname` | string | yes | Host name: 1 to 63 characters, lowercase letters, digits and hyphens, not starting or ending with a hyphen (upper case is lowered). It must be unique on the whole platform. |
| `display_name` | string | no | Label for dashboards, at most 100 characters. Defaults to the host name. |
| `plan_id` | integer | no | Fixed plan from the catalog. Required unless `custom` is given. Custom plans of other servers are not accepted here. |
| `template_id` | integer | yes | Operating system image from the catalog (or one of your own images that is ready). |
| `cycle` | string | no | Billing cycle slug: `hourly` (the default) or a prepaid cycle such as `monthly` or `yearly`, as listed in the catalog. |
| `ssh_key_id` | integer | no | One of your saved SSH keys to install on the server. |
| `custom` | object | no |  |
| `custom.cpu` | integer | yes | Virtual CPU cores, within the site limits (1 to 32 by default). |
| `custom.ram_mb` | integer | yes | Memory in MiB: a multiple of 1024 within the site limits (1 to 64 GiB by default). |
| `custom.disk_gb` | integer | yes | System disk in GiB within the site limits (20 to 1000 by default, in steps of 10) and at least the size the image needs. |
| `custom.cpu_type` | string: `A`, `B`, `D` | no | CPU type, required when `zone_id` is a region with several CPU types (its catalog `custom` block lists the allowed cores, memory and disk for each type): `A` Availability, `B` General Purpose, `D` Dedicated. Price it first with Quote a custom size in a region. A region where custom sizes are switched off answers `409 not_supported_in_zone` with `capability` `custom`. Ignored elsewhere. |
| `enable_ipv6` | boolean | no | Put the server on the dual-stack network so it gets a public IPv6 address. Defaults to `true`; always on inside a Private Cloud. |
| `extra_ips` | integer | no | Additional IPv4 addresses, 0 to 3 (default 0), only in regions whose catalog `extras` block is present. Chosen when ordering; they cannot be added or removed later. Each adds its catalog price to every billing cycle. |
| `zone_id` | integer | no | Region to create the server in, from the catalog `zones`. Required (`422 zone_required`) when the site offers several regions and has no default. |
| `network` | string: `shared`, `vpc` | no | `shared` (default) uses the standard shared network. `vpc` places the server in one of your Private Cloud tiers and needs `vpc_tier_id`. |
| `vpc_tier_id` | string | no | Tier of your Private Cloud to join. Required when `network` is `vpc`. |

Example:

```json
{
  "cycle": "monthly",
  "display_name": "Web server 01",
  "enable_ipv6": true,
  "hostname": "web-01",
  "plan_id": 3,
  "ssh_key_id": 7,
  "template_id": 11,
  "zone_id": 1
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm` | Vm | yes |  |
| `vm.id` | string | yes | Server identifier (UUID). Use it in every `/v1/vm/{id}` path. |
| `vm.hostname` | string | yes | Host name chosen at creation: lowercase letters, digits and hyphens. It is unique on the platform and cannot be changed. |
| `vm.display_name` | string | yes | Free-form label shown in dashboards. Change it with Update a VM. |
| `vm.state` | string: `provisioning`, `active`, `locked`, `failed`, `deleting`, `deleted` | yes | Lifecycle state. `provisioning`: being created. `active`: ready to use (see `cs_state` for the power state). `locked`: suspended for lack of funds, expiry or by an administrator (see `lock_reason`). `failed`: creation failed and was refunded. `deleting`: deletion in progress. `deleted`: gone. |
| `vm.cs_state` | string or null | yes | Power state reported by the hypervisor, for example `Running`, `Stopped`, `Starting` or `Stopping`. null until the first status sync after creation. |
| `vm.public_ip` | string or null | yes | Public IPv4 address, once assigned. |
| `vm.private_ip` | string or null | yes | Private IPv4 address inside the platform network, once known. |
| `vm.ipv6` | string or null | yes | Public IPv6 address, when IPv6 is enabled and assigned. |
| `vm.plan` | VmPlanBrief | yes |  |
| `vm.plan.name` | string | yes | Plan name at the time of the order, or the generated name of a custom configuration (for example `Custom 4C/8G/80G`). |
| `vm.plan.cpu` | integer | yes | Virtual CPU cores. |
| `vm.plan.ram_mb` | integer | yes | Memory in MiB. |
| `vm.plan.disk_gb` | integer | yes | System disk in GiB. |
| `vm.plan.is_custom` | boolean | yes | `true` for a custom configuration (own vCPU / RAM / disk) rather than a fixed plan. |
| `vm.template` | VmTemplateBrief | yes |  |
| `vm.template.id` | integer | yes | Image identifier (the `template_id` used at creation). 0 when the image no longer exists. |
| `vm.template.display_name` | string | yes | Human readable image name, for example `Ubuntu 24.04 LTS`. |
| `vm.template.os_family` | string | yes | Operating system family: `linux`, `windows`... |
| `vm.template.os_version` | string or null | yes | Version label, when known. |
| `vm.template.icon` | string or null | yes | Icon name for the image, when known. |
| `vm.template.category` | string: `desktop` | no | Present when the image is a VM Desktop image (Ubuntu Desktop with a remote screen through RustDesk or Remote Desktop). Absent for standard images. |
| `vm.cycle` | string | yes | Billing cycle slug: `hourly` or a prepaid cycle such as `monthly` or `yearly`. See the catalog for the cycles on sale. |
| `vm.paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `vm.billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `vm.hourly_mills` | integer | yes | Hourly price in mills (1 mill = US$0.001), rounded. Use `hourly_uusd` for the exact price. |
| `vm.hourly_uusd` | integer | yes | Exact hourly price in millionths of a US dollar (4704 = US$0.004704 per hour). This is the price the server is billed at, whatever its cycle. |
| `vm.locked_at` | integer or null | yes | When the server was locked, or null (Unix time, seconds, UTC) |
| `vm.lock_reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the server is locked. `no_funds`: the wallet could not pay an hourly charge. `expired`: a prepaid period ended without renewal. `admin`: suspended by an administrator. `abuse`: suspended after an abuse report. |
| `vm.destroy_after` | integer or null | yes | When a locked server will be destroyed automatically if it is not unlocked before. null when no deadline applies (Unix time, seconds, UTC) |
| `vm.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `vm.ready_at` | integer or null | yes | When the server first became ready. null while it is still being created (Unix time, seconds, UTC) |
| `vm.job_running` | boolean | yes | `true` while a background job (start, resize, deletion...) is queued or running on the server. New actions fail with `409 job_running` until it ends. |
| `vm.autoscale_enabled` | boolean | yes | Whether automatic vertical scaling is switched on for this server. |
| `vm.capabilities` | VmCapabilities | no | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `vm.capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `vm.capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `vm.capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `vm.capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `vm.capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `vm.capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `vm.capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `vm.capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `vm.capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `vm.capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `vm.capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `vm.capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `vm.capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `vm.capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `vm.capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `vm.capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `vm.capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `vm.capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `vm.capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `vm.capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `vm.capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `vm.capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `vm.capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `vm.capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `vm.capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `vm.traffic` | VmTraffic or null | no |  |
| `vm.ips` | array of string | no |  |
| `vm.extras` | object | no |  |
| `vm.extras.extra_ips` | integer | yes | Additional IPv4 addresses chosen when the server was ordered (0 to 3). |
| `vm.cycles` | array or null | no |  |
| `vm.provisioning` | VmProvisioning or null | no |  |
| `vm.imported` | boolean | no | `true` for a server that the team assigned to your account (free of charge). Only an administrator can delete it or change its plan or billing cycle; those calls fail with `409 imported_vm_admin_only`. Absent or `false` for every other server. |
| `vm.username` | string | yes | Default administrator account name of the operating system image (for example `ubuntu` or `Administrator`). |
| `vm.ssh_key` | string or null | yes | Name of the SSH key installed on the server, or null when no key was chosen. |
| `vm.cs_vm_id` | string or null | yes | Identifier of the server on the underlying infrastructure. null until deployment has created it. Quote it in support requests. |
| `vm.ha` | boolean | yes | Whether the server is restarted automatically on another host if its host fails. |
| `vm.password_lost` | boolean | yes | `true` when the platform could not obtain the administrator password after the last install or reset. Use Reset password to get a new one. |
| `vm.cycle_cents` | integer | yes | Price of one billing cycle in US cents, as locked in for the current period. 0 for hourly servers. |
| `vm.cycle_started_at` | integer or null | yes | Start of the current billing cycle (Unix time, seconds, UTC) |
| `vm.auto_renew` | boolean | yes | Whether a prepaid server renews automatically from the wallet when the period ends. |
| `vm.cancel_requested` | boolean | yes | `true` when deletion was requested while the server was still being created; the deployment stops at its next step and the order is refunded. |
| `vm.enable_ipv6` | boolean | yes | Whether the server is on the dual-stack (IPv4 + IPv6) network. |
| `vm.autoscale_state` | string | no | State of the automatic scaling rule (for example `idle` or `scaled`). Present only when a rule exists. |
| `vm.autoscale_target_cpu` | integer | no | vCPU count the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.autoscale_target_ram_mb` | integer | no | Memory in MiB the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.zone` | Zone or null | no |  |
| `vm.network` | VmNetwork | no |  |
| `vm.network.type` | string: `shared`, `vpc` | yes | `shared`: the standard shared network. `vpc`: a tier of your own Private Cloud. |
| `vm.network.vpc_id` | string | no | Private Cloud identifier. Present when `type` is `vpc`. |
| `vm.network.vpc_name` | string | no | Private Cloud name. Present when `type` is `vpc`. |
| `vm.network.tier_id` | string | no | Tier identifier. Present when `type` is `vpc`. |
| `vm.network.tier` | string | no | Tier name. Present when `type` is `vpc`. |
| `vm.network.cidr` | string | no | Tier address range. Present when `type` is `vpc`. |
| `vm.network.mbps` | integer | no | Bandwidth of the Private Cloud in Mbit/s. Present when `type` is `vpc`. |
| `vm.network.unmetered` | boolean | no | Whether traffic inside the Private Cloud plan is unmetered. Present when `type` is `vpc`. |
| `vm.live` | object | no |  |
| `vm.live.cs_state` | string or null | yes | Power state read from the hypervisor. |
| `vm.live.nic` | string or null | yes | Private IPv4 address. |
| `vm.live.ip` | string or null | yes | Public IPv4 address. |
| `vm.live.ipv6` | string or null | yes | Public IPv6 address. |
| `vm.live.synced_at` | integer or null | yes | When the data was read (Unix time, seconds, UTC) |
| `vm.lock_note` | string or null | no | Note left by an administrator when the server was locked. |
| `vm.failed_reason` | string or null | no | Short reason when `state` is `failed`. |
| `vm.credentials_once` | string or null | no | Token the web panel uses to show the initial password a single time. It cannot be redeemed with an API key; the password itself is e-mailed to the account holder. |

Example:

```json
{
  "vm": {
    "auto_renew": true,
    "autoscale_enabled": false,
    "billed_until": null,
    "cancel_requested": false,
    "capabilities": {
      "autoscale": true,
      "backup": true,
      "bandwidth": true,
      "byoip": true,
      "change_ip": true,
      "console": "vnc",
      "ddos_shield": true,
      "firewall": true,
      "hypervisor": true,
      "ipv6": true,
      "iso": true,
      "metrics": true,
      "metrics_mem_disk": true,
      "nics": true,
      "port_forward": true,
      "private_ip": true,
      "reinstall": true,
      "reset_password": true,
      "resize_cpu_ram": true,
      "resize_disk_grow": true,
      "resize_live": true,
      "snapshot": true,
      "ssh_key_reset": true,
      "volumes": true,
      "vpc": true
    },
    "created_at": 1792368000,
    "cs_state": null,
    "cs_vm_id": null,
    "cycle": "monthly",
    "cycle_cents": 343,
    "cycle_started_at": 1792368000,
    "destroy_after": null,
    "display_name": "Web server 01",
    "enable_ipv6": true,
    "ha": true,
    "hostname": "web-01",
    "hourly_mills": 5,
    "hourly_uusd": 4704,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": null,
    "job_running": true,
    "lock_reason": null,
    "locked_at": null,
    "network": {
      "type": "shared"
    },
    "paid_until": 1794960000,
    "password_lost": false,
    "plan": {
      "cpu": 2,
      "disk_gb": 60,
      "is_custom": false,
      "name": "Standard 2/4",
      "ram_mb": 4096
    },
    "private_ip": null,
    "public_ip": null,
    "ready_at": null,
    "ssh_key": "laptop",
    "state": "provisioning",
    "template": {
      "display_name": "Ubuntu 24.04 LTS",
      "icon": "ubuntu",
      "id": 11,
      "os_family": "linux",
      "os_version": "24.04"
    },
    "traffic": null,
    "username": "ubuntu",
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 400 | `bad_input` | The order is not valid. `detail` says why: unknown or unavailable plan, image or billing cycle, a `custom` size outside the site limits or below the image's minimum disk, an SSH key that is not yours, or an image larger than the plan's disk. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot pay the first charge or the site's minimum balance. The error carries `need_cents` (what the wallet must hold) and `balance_cents` (what it holds now). Top up and retry. |
| 403 | `email_unverified` | The e-mail address of the account is not verified yet. |
| 403 | `too_many_vms` | A new account may run only a few servers until a first payment of at least US$10 has completed. |
| 403 | `quota_exceeded` | The order exceeds the account's resource or server-count limits. The error carries `reason`, `used`, `requested`, `limit`, `need_more_cents` and the `next` tier that would allow it. |
| 403 | `feature_disabled` | The site does not sell custom configurations. |
| 403 | `limit_reached` | The site has reached its maximum number of servers. |
| 403 | `vpc_disabled` | Private Cloud is not available on this site. |
| 404 | `vpc_tier_not_found` | `vpc_tier_id` does not exist, is not yours, or is not active. |
| 404 | `zone_not_found` | `zone_id` does not exist or is not visible to your site. |
| 409 | `vpc_full` | The Private Cloud has reached its maximum number of servers. |
| 409 | `hostname_taken` | The host name is not available. Choose another one. |
| 409 | `zone_not_ready` | The region cannot take new servers at the moment: it is not open for sale to your account yet, it has reached its capacity limit, or the chosen plan is temporarily not available there. The error carries the `zone_id`; pick another region or retry later. |
| 409 | `not_supported_in_zone` | `network` is `vpc` but the chosen region does not offer Private Cloud networking. The error carries `capability` (`vpc`). Nothing is charged; order in the default network or in another region. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | A field is missing or invalid: `plan_id` and `template_id` (or `custom` and `template_id`), `network`, `vpc_tier_id`. The error names the offending `field`. |
| 422 | `invalid_hostname` | The host name is not 1 to 63 characters of lowercase letters, digits and hyphens, or it starts or ends with a hyphen. |
| 422 | `extras_not_available` | `extra_ips` was sent for a plan, billing cycle or site that does not sell it (only prepaid servers in regions whose catalog has an `extras` block). |
| 422 | `image_requirements` | The plan or `custom` size is below the minimum of the chosen image (`template_id`): Desktop and Windows images need more memory, disk and cores than a Server image. The error carries `min` (`cpu`, `ram_mb`, `disk_gb`); nothing is charged. The minimums are listed as `min` on each catalog template. |
| 422 | `cycle_not_available_for_image` | The image carries an operating-system license fee (Windows) and is sold with the `monthly` cycle only. The error carries the allowed `cycles`; nothing is charged. The catalog lists them as `cycles` on each template. |
| 422 | `zone_required` | The site offers several regions and none is the default: send `zone_id`. The error carries the `zones` to choose from. |
| 422 | `plan_zone_mismatch` | The plan is not sold in the selected region. |
| 422 | `template_unavailable_in_zone` | The image is not available in the selected region. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `cycle_not_available_in_zone` | The billing cycle is not sold in the server's region (for example long prepaid cycles in some regions). The error carries `cycles`, the cycle slugs the region sells; they are also listed as `cycles` on the catalog `zones`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vpc_locked` | The Private Cloud is locked. Top up to unlock it. |
| 423 | `sales_disabled` | New servers cannot be ordered at the moment. |
| 423 | `site_unavailable` | The site is not accepting new orders. |
| 501 | `feature_disabled` | Custom configurations are not available on this platform at the moment (`feature` is `custom_plan`). |
| 503 | `quota_unavailable` | The account's limits could not be verified. Retry in a moment. |
| 503 | `provider_unavailable` | The service provider is temporarily not accepting new orders. Retry later. |
| 503 | `tenant_unavailable` | The account is temporarily unavailable. Retry in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"monthly","display_name":"Web server 01","enable_ipv6":true,"hostname":"web-01","plan_id":3,"ssh_key_id":7,"template_id":11,"zone_id":1}'
```

---

#### Regions this VM can be cloned to

`GET /v1/vm/{id}/clone-options`

Lists the regions where this server can be cloned: those that sell the same size as the server. Each region carries the price of the new server (hourly rate and monthly equivalent). Servers that cannot be cloned answer `409 not_supported_in_zone`.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm clone options`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Region identifier; pass it as `zone_id` to Clone a VM. |
| `zones[].name` | string | yes | Region name. |
| `zones[].slug` | string | yes | Region slug. |
| `zones[].hourly_uusd` | integer | yes | Hourly price of the new server in millionths of a US dollar. |
| `zones[].monthly_cents` | integer | yes | Monthly equivalent in US cents. |

Example:

```json
{
  "zones": [
    {
      "hourly_uusd": 5500,
      "id": 3,
      "monthly_cents": 402,
      "name": "Singapore",
      "slug": "sg-singapore"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not yours. |
| 409 | `not_supported_in_zone` | Cloning is not available for this server (`capability` is `clone`, or `clone_with_disks` when the server has extra data disks). |
| 409 | `vm_not_active` | The server is not in the `active` state. The error carries the current `state`. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/clone-options" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Clone a VM (new server, charges the wallet)

`POST /v1/vm/{id}/clone`

Creates a copy of this server as a **new server that is ordered and charged like any other**: the first charge is taken from your wallet in the same request at the current price of the same plan in the chosen region, quotas apply, and nothing is charged if the request fails. The copy gets the disk contents of the original, a new IP address and a new administrator password (e-mailed when it is ready). The original is not changed. The call answers at once with the new server in the `provisioning` state; a failed copy is refunded automatically. Use Clone options to see the regions you can choose.

**Required scope:** `vm:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:create` | CLI: `vm clone` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `hostname` | string | yes | Host name of the new server: 1 to 63 characters, lowercase letters, digits and hyphens. It must be unique on the whole platform. |
| `display_name` | string | no | Label for dashboards, at most 100 characters. Defaults to the host name. |
| `zone_id` | integer | yes | Region of the copy, from Clone options. |
| `cycle` | string | no | Billing cycle slug, `hourly` by default. |
| `ssh_key_id` | integer | no | One of your saved SSH keys to install on the copy. |

Example:

```json
{
  "hostname": "web-01-copy",
  "zone_id": 3
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm` | Vm | yes |  |
| `vm.id` | string | yes | Server identifier (UUID). Use it in every `/v1/vm/{id}` path. |
| `vm.hostname` | string | yes | Host name chosen at creation: lowercase letters, digits and hyphens. It is unique on the platform and cannot be changed. |
| `vm.display_name` | string | yes | Free-form label shown in dashboards. Change it with Update a VM. |
| `vm.state` | string: `provisioning`, `active`, `locked`, `failed`, `deleting`, `deleted` | yes | Lifecycle state. `provisioning`: being created. `active`: ready to use (see `cs_state` for the power state). `locked`: suspended for lack of funds, expiry or by an administrator (see `lock_reason`). `failed`: creation failed and was refunded. `deleting`: deletion in progress. `deleted`: gone. |
| `vm.cs_state` | string or null | yes | Power state reported by the hypervisor, for example `Running`, `Stopped`, `Starting` or `Stopping`. null until the first status sync after creation. |
| `vm.public_ip` | string or null | yes | Public IPv4 address, once assigned. |
| `vm.private_ip` | string or null | yes | Private IPv4 address inside the platform network, once known. |
| `vm.ipv6` | string or null | yes | Public IPv6 address, when IPv6 is enabled and assigned. |
| `vm.plan` | VmPlanBrief | yes |  |
| `vm.plan.name` | string | yes | Plan name at the time of the order, or the generated name of a custom configuration (for example `Custom 4C/8G/80G`). |
| `vm.plan.cpu` | integer | yes | Virtual CPU cores. |
| `vm.plan.ram_mb` | integer | yes | Memory in MiB. |
| `vm.plan.disk_gb` | integer | yes | System disk in GiB. |
| `vm.plan.is_custom` | boolean | yes | `true` for a custom configuration (own vCPU / RAM / disk) rather than a fixed plan. |
| `vm.template` | VmTemplateBrief | yes |  |
| `vm.template.id` | integer | yes | Image identifier (the `template_id` used at creation). 0 when the image no longer exists. |
| `vm.template.display_name` | string | yes | Human readable image name, for example `Ubuntu 24.04 LTS`. |
| `vm.template.os_family` | string | yes | Operating system family: `linux`, `windows`... |
| `vm.template.os_version` | string or null | yes | Version label, when known. |
| `vm.template.icon` | string or null | yes | Icon name for the image, when known. |
| `vm.template.category` | string: `desktop` | no | Present when the image is a VM Desktop image (Ubuntu Desktop with a remote screen through RustDesk or Remote Desktop). Absent for standard images. |
| `vm.cycle` | string | yes | Billing cycle slug: `hourly` or a prepaid cycle such as `monthly` or `yearly`. See the catalog for the cycles on sale. |
| `vm.paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `vm.billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `vm.hourly_mills` | integer | yes | Hourly price in mills (1 mill = US$0.001), rounded. Use `hourly_uusd` for the exact price. |
| `vm.hourly_uusd` | integer | yes | Exact hourly price in millionths of a US dollar (4704 = US$0.004704 per hour). This is the price the server is billed at, whatever its cycle. |
| `vm.locked_at` | integer or null | yes | When the server was locked, or null (Unix time, seconds, UTC) |
| `vm.lock_reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the server is locked. `no_funds`: the wallet could not pay an hourly charge. `expired`: a prepaid period ended without renewal. `admin`: suspended by an administrator. `abuse`: suspended after an abuse report. |
| `vm.destroy_after` | integer or null | yes | When a locked server will be destroyed automatically if it is not unlocked before. null when no deadline applies (Unix time, seconds, UTC) |
| `vm.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `vm.ready_at` | integer or null | yes | When the server first became ready. null while it is still being created (Unix time, seconds, UTC) |
| `vm.job_running` | boolean | yes | `true` while a background job (start, resize, deletion...) is queued or running on the server. New actions fail with `409 job_running` until it ends. |
| `vm.autoscale_enabled` | boolean | yes | Whether automatic vertical scaling is switched on for this server. |
| `vm.capabilities` | VmCapabilities | no | What the server's region supports. Every flag is `true` (and `console` is `vnc`) for servers in the platform's standard regions. A call that needs a flag that is `false` fails with `409 not_supported_in_zone`. |
| `vm.capabilities.resize_live` | boolean | yes | The CPU and memory can be changed while the server runs (Scale). When `false`, changing the plan stops and restarts the server. |
| `vm.capabilities.resize_cpu_ram` | boolean | yes | The plan (vCPU and memory) can be changed. |
| `vm.capabilities.resize_disk_grow` | boolean | yes | The system disk can be enlarged when the plan changes. |
| `vm.capabilities.snapshot` | boolean | yes | Snapshots, snapshot schedules and creating an image from the server. |
| `vm.capabilities.reinstall` | boolean | yes | The operating system can be reinstalled or replaced. |
| `vm.capabilities.reset_password` | boolean | yes | The administrator password can be reset. |
| `vm.capabilities.ipv6` | boolean | yes | IPv6 can be switched on and off. |
| `vm.capabilities.firewall` | boolean | yes | Firewall rules can be managed. |
| `vm.capabilities.port_forward` | boolean | yes | Port forwarding rules can be managed. |
| `vm.capabilities.change_ip` | boolean | yes | The public IPv4 address can be replaced. |
| `vm.capabilities.backup` | boolean | yes | Backups and backup schedules. |
| `vm.capabilities.volumes` | boolean | yes | Data volumes can be attached. |
| `vm.capabilities.iso` | boolean | yes | An ISO image can be attached to boot from. |
| `vm.capabilities.autoscale` | boolean | yes | Automatic vertical scaling. |
| `vm.capabilities.ddos_shield` | boolean | yes | The server sits behind the platform's DDoS Shield. `false` in regions served by other infrastructure. |
| `vm.capabilities.metrics` | boolean | yes | CPU and network charts are available. |
| `vm.capabilities.bandwidth` | boolean | yes | The monthly bandwidth meter and quota apply. |
| `vm.capabilities.vpc` | boolean | yes | The server can join a Private Cloud network. |
| `vm.capabilities.private_ip` | boolean | yes | The server has a private IPv4 address inside the platform network (`private_ip`). |
| `vm.capabilities.hypervisor` | boolean | yes | The hypervisor type is known and shown for the server. |
| `vm.capabilities.nics` | boolean | yes | The network interfaces can be listed. When `false`, use `public_ip` and `ipv6` of the server. |
| `vm.capabilities.ssh_key_reset` | boolean | yes | Another SSH key can be installed after creation. |
| `vm.capabilities.byoip` | boolean | yes | A bring-your-own IP range can be attached to the server. |
| `vm.capabilities.metrics_mem_disk` | boolean | yes | Memory and disk charts are available in addition to CPU and network. |
| `vm.capabilities.console` | string: `vnc`, `ssh`, `none` | yes | Console offered for this server: `vnc` graphical console ([Open the console](#operation/vm_console)), `ssh` web terminal only ([Get an SSH ticket](#operation/vm_ssh_token)), or `none`. |
| `vm.traffic` | VmTraffic or null | no |  |
| `vm.ips` | array of string | no |  |
| `vm.extras` | object | no |  |
| `vm.extras.extra_ips` | integer | yes | Additional IPv4 addresses chosen when the server was ordered (0 to 3). |
| `vm.cycles` | array or null | no |  |
| `vm.provisioning` | VmProvisioning or null | no |  |
| `vm.imported` | boolean | no | `true` for a server that the team assigned to your account (free of charge). Only an administrator can delete it or change its plan or billing cycle; those calls fail with `409 imported_vm_admin_only`. Absent or `false` for every other server. |
| `vm.username` | string | yes | Default administrator account name of the operating system image (for example `ubuntu` or `Administrator`). |
| `vm.ssh_key` | string or null | yes | Name of the SSH key installed on the server, or null when no key was chosen. |
| `vm.cs_vm_id` | string or null | yes | Identifier of the server on the underlying infrastructure. null until deployment has created it. Quote it in support requests. |
| `vm.ha` | boolean | yes | Whether the server is restarted automatically on another host if its host fails. |
| `vm.password_lost` | boolean | yes | `true` when the platform could not obtain the administrator password after the last install or reset. Use Reset password to get a new one. |
| `vm.cycle_cents` | integer | yes | Price of one billing cycle in US cents, as locked in for the current period. 0 for hourly servers. |
| `vm.cycle_started_at` | integer or null | yes | Start of the current billing cycle (Unix time, seconds, UTC) |
| `vm.auto_renew` | boolean | yes | Whether a prepaid server renews automatically from the wallet when the period ends. |
| `vm.cancel_requested` | boolean | yes | `true` when deletion was requested while the server was still being created; the deployment stops at its next step and the order is refunded. |
| `vm.enable_ipv6` | boolean | yes | Whether the server is on the dual-stack (IPv4 + IPv6) network. |
| `vm.autoscale_state` | string | no | State of the automatic scaling rule (for example `idle` or `scaled`). Present only when a rule exists. |
| `vm.autoscale_target_cpu` | integer | no | vCPU count the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.autoscale_target_ram_mb` | integer | no | Memory in MiB the automatic scaling rule is currently aiming for. Present only when a rule exists. |
| `vm.zone` | Zone or null | no |  |
| `vm.network` | VmNetwork | no |  |
| `vm.network.type` | string: `shared`, `vpc` | yes | `shared`: the standard shared network. `vpc`: a tier of your own Private Cloud. |
| `vm.network.vpc_id` | string | no | Private Cloud identifier. Present when `type` is `vpc`. |
| `vm.network.vpc_name` | string | no | Private Cloud name. Present when `type` is `vpc`. |
| `vm.network.tier_id` | string | no | Tier identifier. Present when `type` is `vpc`. |
| `vm.network.tier` | string | no | Tier name. Present when `type` is `vpc`. |
| `vm.network.cidr` | string | no | Tier address range. Present when `type` is `vpc`. |
| `vm.network.mbps` | integer | no | Bandwidth of the Private Cloud in Mbit/s. Present when `type` is `vpc`. |
| `vm.network.unmetered` | boolean | no | Whether traffic inside the Private Cloud plan is unmetered. Present when `type` is `vpc`. |
| `vm.live` | object | no |  |
| `vm.live.cs_state` | string or null | yes | Power state read from the hypervisor. |
| `vm.live.nic` | string or null | yes | Private IPv4 address. |
| `vm.live.ip` | string or null | yes | Public IPv4 address. |
| `vm.live.ipv6` | string or null | yes | Public IPv6 address. |
| `vm.live.synced_at` | integer or null | yes | When the data was read (Unix time, seconds, UTC) |
| `vm.lock_note` | string or null | no | Note left by an administrator when the server was locked. |
| `vm.failed_reason` | string or null | no | Short reason when `state` is `failed`. |
| `vm.credentials_once` | string or null | no | Token the web panel uses to show the initial password a single time. It cannot be redeemed with an API key; the password itself is e-mailed to the account holder. |

Example:

```json
{
  "vm": {
    "auto_renew": true,
    "autoscale_enabled": false,
    "billed_until": null,
    "cancel_requested": false,
    "capabilities": {
      "autoscale": true,
      "backup": true,
      "bandwidth": true,
      "byoip": true,
      "change_ip": true,
      "console": "vnc",
      "ddos_shield": true,
      "firewall": true,
      "hypervisor": true,
      "ipv6": true,
      "iso": true,
      "metrics": true,
      "metrics_mem_disk": true,
      "nics": true,
      "port_forward": true,
      "private_ip": true,
      "reinstall": true,
      "reset_password": true,
      "resize_cpu_ram": true,
      "resize_disk_grow": true,
      "resize_live": true,
      "snapshot": true,
      "ssh_key_reset": true,
      "volumes": true,
      "vpc": true
    },
    "created_at": 1792368000,
    "cs_state": null,
    "cs_vm_id": null,
    "cycle": "monthly",
    "cycle_cents": 343,
    "cycle_started_at": 1792368000,
    "destroy_after": null,
    "display_name": "Web server 01",
    "enable_ipv6": true,
    "ha": true,
    "hostname": "web-01",
    "hourly_mills": 5,
    "hourly_uusd": 4704,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": null,
    "job_running": true,
    "lock_reason": null,
    "locked_at": null,
    "network": {
      "type": "shared"
    },
    "paid_until": 1794960000,
    "password_lost": false,
    "plan": {
      "cpu": 2,
      "disk_gb": 60,
      "is_custom": false,
      "name": "Standard 2/4",
      "ram_mb": 4096
    },
    "private_ip": null,
    "public_ip": null,
    "ready_at": null,
    "ssh_key": "laptop",
    "state": "provisioning",
    "template": {
      "display_name": "Ubuntu 24.04 LTS",
      "icon": "ubuntu",
      "id": 11,
      "os_family": "linux",
      "os_version": "24.04"
    },
    "traffic": null,
    "username": "ubuntu",
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot pay the first charge or the site's minimum balance. |
| 403 | `quota_exceeded` | The order exceeds the account's resource or server-count limits. |
| 404 | `not_found` | The server does not exist or is not yours. |
| 409 | `not_supported_in_zone` | Cloning is not available for this server. |
| 409 | `vm_not_active` | The server is not in the `active` state. The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `zone_id` is missing or is not one of the regions in Clone options. The error names the offending `field`. |
| 422 | `invalid_hostname` | The host name is not 1 to 63 characters of lowercase letters, digits and hyphens. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. |
| 429 | `rate_limited` | Too many clone requests; retry in a minute. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/clone" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"hostname":"web-01-copy","zone_id":3}'
```

---

#### Change plan (prorated)

`POST /v1/vm/{id}/change-plan`

Moves the server to another fixed plan of the same region. The server is stopped, resized and started again, so expect a short downtime (`requires_stop` in Get plan options says whether the change needs it). The disk can stay the same or grow, never shrink.

Money: prepaid servers are charged (or credited) the prorated price difference for the rest of the paid period immediately; the response carries `charged_cents` or `refunded_cents`, never both. Hourly servers are billed at the new hourly price from the next hour on; moving to a dearer plan prepays the first hour at the new price. If the resize job fails, the money is returned automatically. Hourly servers can be resized at most once an hour (`429 change_cooldown`).

The server must have no VM snapshots. Use Get plan quote first to show the price. For servers on a custom configuration use Change custom configuration.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm change-plan` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan_id` | integer | yes | Plan to move to, from the catalog or from Get plan options. |
| `live` | boolean | no | Reserved for restart-free changes, which are not supported yet. `true` is refused with `409 live_unavailable`; omit it or send `false`. |

Example:

```json
{
  "plan_id": 4
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the resize job. Follow it with List a VM's jobs. |
| `charged_cents` | integer | no | Amount charged to the wallet in US cents (0 when nothing is due now). Absent when `refunded_cents` is present. |
| `refunded_cents` | integer | no | Amount credited back to the wallet in US cents. Absent when `charged_cents` is present. |

Example:

```json
{
  "charged_cents": 288,
  "job_id": 4813
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 400 | `bad_input` | The change is not allowed. `detail` says why: the disk would shrink, the server runs a custom configuration (`custom_switch_unsupported`), or the plan is unavailable. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot pay the difference. The error carries `need_cents` and `balance_cents`. |
| 403 | `quota_exceeded` | The new size exceeds the account's resource limits. The error carries `reason`, `used`, `requested`, `limit` and `need_more_cents`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 409 | `same_plan` | The server already has this plan. |
| 409 | `resize_license` | The server runs a licensed operating system (for example Windows) and the license cannot be carried over to the chosen plan at the moment, or the chosen plan carries a license the server does not have. Nothing is changed or charged; choose another plan or contact support. |
| 409 | `imported_vm_admin_only` | The server was provisioned for you by the team: only an administrator can change its plan. |
| 409 | `live_unavailable` | `live: true` was sent; restart-free plan changes are not supported yet. |
| 409 | `plan_other_zone` | The plan belongs to another region. A server cannot move between regions. |
| 409 | `has_snapshots` | The server still has VM snapshots. Delete them first. The error carries the `count`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `plan_id` is missing, unknown, not on sale, a custom configuration, or not visible to your site. The error names the offending `field`. |
| 422 | `image_requirements` | The chosen plan is below the minimum of the operating system installed on the server (Windows needs more memory, disk and cores). The error carries the `min` (`cpu`, `ram_mb`, `disk_gb`); nothing is charged; pick a bigger plan. Plans below the minimum are left out of Get plan options. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |
| 429 | `change_cooldown` | This hourly server was already resized during the last hour. Retry later. |
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |
| 503 | `quota_unavailable` | The account's limits could not be verified. Retry in a moment. |
| 503 | `provider_unavailable` | The service provider is temporarily not accepting changes that cost money. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/change-plan" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":4}'
```

---

#### Custom resize

`POST /v1/vm/{id}/change-custom`

Resizes a server that runs a custom configuration: change its vCPU count, memory and disk. CPU and memory can go up or down; the disk can only grow, in steps of the site's disk step. Only the values you change are checked against the site limits. The server is stopped, resized and started again, so expect a short downtime.

Money works as in Change plan: prepaid servers are charged or credited the prorated difference immediately (`charged_cents` or `refunded_cents`, never both), hourly servers pay the new hourly price from the next hour, with the first hour prepaid when the price goes up. Hourly servers can be resized at most once an hour. Only available where custom configurations are sold, and the server must have no VM snapshots.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm change-custom` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cpu` | integer | yes | New virtual CPU cores. |
| `ram_mb` | integer | yes | New memory in MiB: a multiple of 1024. |
| `disk_gb` | integer | yes | New system disk in GiB: the current size or larger, growing in steps of the site's disk step. |

Example:

```json
{
  "cpu": 4,
  "disk_gb": 90,
  "ram_mb": 8192
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the resize job. Follow it with List a VM's jobs. |
| `charged_cents` | integer | no | Amount charged to the wallet in US cents (0 when nothing is due now). Absent when `refunded_cents` is present. |
| `refunded_cents` | integer | no | Amount credited back to the wallet in US cents. Absent when `charged_cents` is present. |

Example:

```json
{
  "charged_cents": 142,
  "job_id": 4814
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 400 | `bad_input` | The configuration is not allowed. `detail` says why: it equals the current one, a value is outside the site limits or step, or Windows needs more memory. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot pay the difference. The error carries `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | Custom configurations are not sold on this site. |
| 403 | `quota_exceeded` | The new size exceeds the account's resource limits. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not `active` yet (for example still `provisioning`, or already being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish (see List a VM's jobs) and retry. |
| 409 | `has_snapshots` | The server still has VM snapshots. Delete them first. The error carries the `count`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `cpu`, `ram_mb` or `disk_gb` is missing or not an integer. |
| 422 | `custom_only` | The server runs a fixed plan. Use Change plan instead. |
| 422 | `disk_shrink` | `disk_gb` is smaller than the current disk. The error carries the current `disk_gb`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). The error carries `reason`, `destroy_after` and `locked_at`. Top up the wallet or contact support, then retry. |
| 429 | `change_cooldown` | This hourly server was already resized during the last hour. Retry later. |
| 502 | `cloudstack_error` | The infrastructure did not answer. Retry in a few seconds. |
| 503 | `quota_unavailable` | The account's limits could not be verified. Retry in a moment. |
| 503 | `provider_unavailable` | The service provider is temporarily not accepting changes that cost money. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/change-custom" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cpu":4,"disk_gb":90,"ram_mb":8192}'
```

---

#### Delete the VM (data is lost)

`DELETE /v1/vm/{id}`

Permanently deletes the server. This cannot be undone: the system disk, data disks, backups and VM snapshots of the server are destroyed and its public addresses are released. Call Get delete preview first and show the user what will be lost.

The call returns at once: the server moves to `deleting` and the `job_id` job removes it within a few minutes. For prepaid servers the unused part of the paid period is credited to the wallet when the job completes; `refund_cents` is the estimate. Hourly servers are not refunded for the hour already started. A server that is still `provisioning` can be cancelled this way and is refunded in full. Locked servers cannot be deleted until they are unlocked.

To guard against mistakes you must send the server's host name as `confirm_hostname`.

**Required scope:** `vm:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:destroy` | CLI: `vm delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm_hostname` | string | yes | The host name of the server being deleted, exactly as returned by Get a VM. |

Example:

```json
{
  "confirm_hostname": "web-01"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the deletion job. Follow it with List a VM's jobs. |
| `refund_cents` | integer | yes | Estimated refund in US cents. The real refund is credited when the job completes. |

Example:

```json
{
  "job_id": 4815,
  "refund_cents": 297
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 400 | `bad_input` | The server cannot be deleted in its current state, or a deletion is already in progress (`detail` says which). |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is already being deleted or is gone. The error carries the current `state`. |
| 409 | `job_running` | Another background job is queued or running on this server. Wait for it to finish and retry. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `confirm_mismatch` | `confirm_hostname` is missing or does not match the server's host name. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (see `lock_reason` on the server). Settle the balance or contact support first. The error carries `reason`, `destroy_after` and `locked_at`. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm_hostname":"web-01"}'
```

---

#### Current price of the VM (hourly, cycle, renewal)

`GET /v1/vm/{id}/price`

Returns the price this server is billed at right now and the price its next renewal will cost. Prices are exact integers: `hourly_uusd` is in millionths of a US dollar and the `*_cents` fields are in US cents. A prepaid server keeps the price it paid for until the period ends, so after the site lowers its list price `renewal_cents` can be lower than `cycle_cents`.

Nothing is charged. Use [Quote a plan change](#operation/vm_change_quote) and [Quote a billing-cycle change](#operation/vm_cycle_quote) to price a change.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm price`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `is_custom` | boolean | yes | True when the server uses a custom size instead of a fixed plan. |
| `hourly_uusd` | integer | yes | Exact price per hour the server is billed at, in millionths of a US dollar (4704 = US$0.004704). |
| `hourly` | string | yes | The same price as a decimal string, for display, e.g. `$0.004704`. |
| `monthly_cents` | integer | yes | The hourly price for a 730-hour month, in US cents. |
| `cycle` | string | yes | Billing cycle slug: `hourly`, or a prepaid cycle such as `monthly` or `yearly`. |
| `cycle_cents` | integer | yes | Price of one period of the current cycle as it was paid, in US cents. 0 for hourly servers. |
| `renewal_cents` | integer | yes | What the next renewal of one period would cost at today's prices, in US cents. 0 for hourly servers. |
| `renewal_hourly_uusd` | integer | yes | Hourly price that will apply after the next renewal, in millionths of a US dollar. |
| `renewal_hourly` | string | yes | The same price as a decimal string. |
| `paid_until` | integer or null | yes | End of the period already paid for. null for hourly servers (Unix time, seconds, UTC) |
| `billed_until` | integer or null | yes | End of the hour already billed. null for prepaid servers (Unix time, seconds, UTC) |
| `cycles` | object | yes | Full price of one period of each prepaid billing cycle for this server, in US cents, keyed by cycle slug (for example `{"monthly": 480, "yearly": 5184}`). Use these numbers rather than deriving them from the hourly price: in international regions the hourly price carries an hourly surcharge that monthly and longer cycles do not. |

Example:

```json
{
  "billed_until": null,
  "cycle": "monthly",
  "cycle_cents": 343,
  "cycles": {
    "monthly": 343,
    "yearly": 3705
  },
  "hourly": "$0.004704",
  "hourly_uusd": 4704,
  "is_custom": false,
  "monthly_cents": 343,
  "paid_until": 1795600000,
  "renewal_cents": 343,
  "renewal_hourly": "$0.004704",
  "renewal_hourly_uusd": 4704
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/price" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a plan change or custom resize

`GET /v1/vm/{id}/change-quote`

Previews what changing the server's plan or custom size would cost, without changing anything. Pass either `plan_id` (a fixed plan from the catalog) or all three of `cpu`, `ram_mb` and `disk_gb` (a custom size). The arithmetic is the one the change itself uses, so `amount_due_cents` is what would be taken from the wallet and `refund_cents` what would be returned for the unused part of the current period.

Check `allowed` before offering the change: it is false when the change cannot be made right now, and `reason` says why (`vm_locked`, `vm_not_active`, `job_running`, `disk_shrink`, `feature_disabled` or `custom_switch_unsupported`). `same` is true when the target equals the current size. For hourly servers the new price applies from the next billing hour; moving to a dearer size charges one hour at the new price up front.

Pass `scale=1` to price a live resize through the Scaling endpoints instead: it also allows moving from a fixed plan to a custom size, and for hourly servers `amount_due_cents` is the one hour charged up front.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm change-quote`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `plan_id` | integer | no | Fixed plan to move to, from the catalog. When given, `cpu`, `ram_mb` and `disk_gb` are ignored. |
| `cpu` | integer | no | Custom size: vCPU cores. Send together with `ram_mb` and `disk_gb`. |
| `ram_mb` | integer | no | Custom size: memory in MiB. Send together with `cpu` and `disk_gb`. |
| `disk_gb` | integer | no | Custom size: system disk in GiB; it can only grow. Send together with `cpu` and `ram_mb`. |
| `cycle` | string | no | Billing cycle slug to price the target for. Defaults to the server's current cycle, which gives the real amount of a change; another cycle is for information only. |
| `scale` | boolean | no | Send `1` or `true` to price a live resize (Scaling endpoints) instead of a plan change. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `kind` | string: `plan`, `custom` | yes | `plan` for a fixed plan, `custom` for a custom size. |
| `from` | object | yes | The server as it is now. |
| `from.plan_id` | integer | yes | Identifier of the current plan. |
| `from.name` | string | yes | Plan name, or a generated label such as `4 vCPU / 8 GB / 80 GB` for a custom size. |
| `from.cpu` | integer | yes | Virtual CPU cores. |
| `from.ram_mb` | integer | yes | Memory in MiB. |
| `from.disk_gb` | integer | yes | System disk in GiB. |
| `from.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `from.hourly` | string | yes | Price per hour as a decimal string. |
| `from.monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `from.cents` | integer | yes | Price of one period of the quoted billing cycle in US cents (0 for hourly servers). |
| `to` | object | yes | The target of the change. |
| `to.plan_id` | integer or null | yes | Identifier of the target plan. null for a custom size. |
| `to.name` | string | yes | Plan name, or a generated label such as `4 vCPU / 8 GB / 80 GB` for a custom size. |
| `to.cpu` | integer | yes | Virtual CPU cores. |
| `to.ram_mb` | integer | yes | Memory in MiB. |
| `to.disk_gb` | integer | yes | System disk in GiB. |
| `to.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `to.hourly` | string | yes | Price per hour as a decimal string. |
| `to.monthly_cents` | integer | yes | Price for a 30-day month (730 hours) in US cents. |
| `to.cents` | integer | yes | Price of one period of the quoted billing cycle in US cents (0 for hourly servers). |
| `cycle` | string | yes | Billing cycle the quote is for. |
| `months` | integer | yes | Months in that cycle (0 = hourly). |
| `remaining_hours` | integer | yes | Hours left in the current prepaid period. 0 for hourly servers. |
| `unused_cents` | integer | yes | Value of the unused part of the current period, in US cents. |
| `amount_due_cents` | integer | yes | Amount that would be charged to the wallet, in US cents. 0 when nothing is due or a refund applies. |
| `refund_cents` | integer | yes | Amount that would be returned to the wallet, in US cents. 0 when nothing is refunded. |
| `immediate` | boolean | yes | Whether the change takes effect right away. Always true. |
| `allowed` | boolean | yes | Whether the change can be made now. |
| `reason` | string or null: `vm_locked`, `vm_not_active`, `job_running`, `disk_shrink`, `feature_disabled`, `custom_switch_unsupported` | yes | Why `allowed` is false. null when it is allowed, or when the target equals the current size. |
| `disk_shrink` | boolean | yes | True when the target disk is smaller than the current one. Disks cannot shrink. |
| `same` | boolean | yes | True when the target equals the current plan or size. |
| `balance_cents` | integer | yes | Wallet balance in US cents. |
| `hourly_note` | string or null | yes | For hourly servers, a sentence explaining when the new price applies. null for prepaid servers. |

Example:

```json
{
  "allowed": true,
  "amount_due_cents": 240,
  "balance_cents": 2500,
  "cycle": "monthly",
  "disk_shrink": false,
  "from": {
    "cents": 343,
    "cpu": 2,
    "disk_gb": 60,
    "hourly": "$0.004704",
    "hourly_uusd": 4704,
    "monthly_cents": 343,
    "name": "Standard 2/4",
    "plan_id": 3,
    "ram_mb": 4096
  },
  "hourly_note": null,
  "immediate": true,
  "kind": "plan",
  "months": 1,
  "reason": null,
  "refund_cents": 0,
  "remaining_hours": 512,
  "same": false,
  "to": {
    "cents": 687,
    "cpu": 4,
    "disk_gb": 80,
    "hourly": "$0.009408",
    "hourly_uusd": 9408,
    "monthly_cents": 687,
    "name": "Standard 4/8",
    "plan_id": 4,
    "ram_mb": 8192
  },
  "unused_cents": 240
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The custom size is outside the site limits, or `cycle` is not a known billing cycle. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `plan_other_zone` | The plan is sold in a different region. A server cannot move between regions; order a new server there instead. |
| 422 | `invalid_argument` | Neither a positive `plan_id` nor a complete `cpu` + `ram_mb` + `disk_gb` was given, or the plan is not available for this server. The error carries `field`. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/change-quote" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a billing-cycle change

`GET /v1/vm/{id}/cycle-quote`

Previews switching the server to another billing cycle, without changing anything. The unused part of the current prepaid period is refunded and the first period of the new cycle is charged, so the result is either `net_due_cents` (to pay) or `net_refund_cents` (to receive), never both. Prices are today's prices for the server.

It works on a server in any state, but `allowed` is false unless the server is `active` and has no operation running. `sufficient` tells whether the wallet covers `net_due_cents`. Make the change with [Change the billing cycle](#operation/vm_change_cycle).

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm cycle-quote`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `cycle` | string | yes | Slug of the cycle to switch to, from the `cycles` of the catalog (for example `monthly`, `yearly`, `2y`, `3y`, or `hourly`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `from_cycle` | string | yes | The server's current cycle. |
| `to_cycle` | string | yes | The cycle that was quoted. |
| `used_hours` | integer | yes | Hours of the current period already used, rounded up. |
| `refund_cents` | integer | yes | Refund for the unused part of the current period, in US cents. 0 for hourly servers. |
| `new_cents` | integer | yes | Price of the first period of the new cycle, in US cents. 0 when switching to hourly. |
| `net_due_cents` | integer | yes | Amount to pay: `new_cents` minus `refund_cents`, never below zero. |
| `net_refund_cents` | integer | yes | Amount returned to the wallet when the refund exceeds the new price, in US cents. |
| `paid_until_current` | integer or null | yes | End of the period currently paid for. null for hourly servers (Unix time, seconds, UTC) |
| `paid_until_new` | integer or null | yes | End of the paid period after the switch. null when switching to hourly (Unix time, seconds, UTC) |
| `to_name` | string | yes | Display name of the new cycle. |
| `to_months` | integer | yes | Months in the new cycle (0 = hourly). |
| `to_discount_pct` | number | yes | Discount of the new cycle in percent. |
| `balance_cents` | integer | yes | Wallet balance in US cents. |
| `allowed` | boolean | yes | Whether the switch can be made now. |
| `sufficient` | boolean | yes | Whether the wallet balance covers `net_due_cents`. |
| `scheduled` | boolean | yes | true when the switch would be scheduled for the end of the paid period instead of made now (prepaid → hourly in international regions; nothing is refunded). |
| `effective_at` | integer or null | yes | When a scheduled switch takes effect. null when the switch is immediate (Unix time, seconds, UTC) |
| `bandwidth` | object or null | yes | International regions only: bandwidth of the target cycle — `{per_gb: true, usd_per_gb}` for hourly, `{unlimited: true}` for monthly or longer. null elsewhere |
| `next_charge_at` | integer or null | yes | International regions, hourly → prepaid with auto-renew on: when the next period is charged from the wallet (8 PM Vietnam time on the last day of the paid period; nothing for the next period is charged at the switch). null otherwise (Unix time, seconds, UTC) |
| `next_charge_cents` | integer or null | yes | Amount of that next automatic charge, in US cents. null when `next_charge_at` is null. |

Example:

```json
{
  "allowed": true,
  "balance_cents": 5000,
  "bandwidth": null,
  "effective_at": null,
  "from_cycle": "monthly",
  "net_due_cents": 3418,
  "net_refund_cents": 0,
  "new_cents": 3705,
  "next_charge_at": null,
  "next_charge_cents": null,
  "paid_until_current": 1795600000,
  "paid_until_new": 1827100000,
  "refund_cents": 287,
  "scheduled": false,
  "sufficient": true,
  "to_cycle": "yearly",
  "to_discount_pct": 10.0,
  "to_months": 12,
  "to_name": "1 year",
  "used_hours": 120
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `same_cycle` | The server is already on this billing cycle. |
| 422 | `invalid_argument` | `cycle` is missing, longer than 20 characters, or not an enabled billing cycle. The error carries `field` = `cycle`. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `cycle_not_available_in_zone` | The billing cycle is not sold in the server's region (for example long prepaid cycles in some regions). The error carries `cycles`, the cycle slugs the region sells; they are also listed as `cycles` on the catalog `zones`. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/cycle-quote?cycle=<cycle>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Screenshot of the running VM

`GET /v1/vm/{id}/screenshot`

Takes a picture of the server's screen (what its console shows) as a PNG data URL. It always answers 200: when no picture can be taken the body is `{available: false, reason}` instead of an error, so you can poll it safely. `reason` is `vm_not_running` (the server is not powered on), `vm_locked`, `capture_failed` (try again shortly) or `not_configured` (screenshots are not offered on this site).

The picture is scaled to the requested width and cached for about 15 seconds. At most 10 new captures per minute are allowed per client address; beyond that the call fails with `429 rate_limited`. Taking a screenshot is recorded in the server's event log, at most once per hour.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm screenshot`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `w` | integer | no | Width of the picture in pixels: 340, 680 or 1024. Any other value gives 680. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `available` | boolean | yes | Whether a picture was taken. |
| `reason` | string: `not_configured`, `vm_locked`, `vm_not_running`, `capture_failed` | no | Why there is no picture. Present only when `available` is false. |
| `image` | string | no | The picture as a `data:image/png;base64,...` URL. Present only when `available` is true. |
| `width` | integer | no | Width of the returned picture in pixels. |
| `height` | integer | no | Height of the returned picture in pixels. |
| `source_width` | integer | no | Width of the screen before scaling. |
| `source_height` | integer | no | Height of the screen before scaling. |
| `taken_at` | integer | no | When the picture was taken (Unix time, seconds, UTC) |

Example:

```json
{
  "available": true,
  "height": 384,
  "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVQAAAC0CAIAAABY",
  "source_height": 720,
  "source_width": 1280,
  "taken_at": 1795100000,
  "width": 680
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 429 | `rate_limited` | More than 10 uncached captures in a minute from the same client address. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/screenshot" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Disk used/total measured inside the VM

`GET /v1/vm/{id}/fsinfo`

Returns how full the server's main disk is, measured from inside the server (root filesystem, or the `C:` drive on Windows). The three disk values are null when the server is not running, is locked, has no guest agent installed, or the measurement is not available on this site, so treat null as "unknown", not as an error. The result is cached for about 60 seconds; at most 30 uncached measurements per minute are allowed per client address.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm fsinfo`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `disk_pct` | number or null | yes | Used share of the disk in percent, one decimal. |
| `disk_used_gb` | number or null | yes | Used space in GiB, one decimal. |
| `disk_total_gb` | number or null | yes | Total size in GiB, one decimal. |
| `at` | integer | yes | When the answer was produced (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1795100000,
  "disk_pct": 37.5,
  "disk_total_gb": 60.0,
  "disk_used_gb": 22.5
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 429 | `rate_limited` | More than 30 uncached measurements in a minute from the same client address. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/fsinfo" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Renew a prepaid VM (charges the wallet)

`POST /v1/vm/{id}/renew`

Renews a prepaid server for one or more periods of its billing cycle. The price of all periods (the price of one period, times `periods`; a site price cut since the last renewal is applied) is taken from the wallet immediately and a paid invoice is created; `paid_until` moves forward from the current end date, or from now if the server has already expired. The wallet is checked first, so a failed renewal charges nothing.

It does not create a job: the new date is in the response. Total prepaid time is capped at 36 months, so `periods` can be at most 12 for a monthly cycle, 3 for a yearly one and 1 for the 2-year and 3-year cycles. Hourly servers have nothing to renew (`409 hourly_no_renew`); switch them to a prepaid cycle with [Change the billing cycle](#operation/vm_change_cycle). The body is optional and defaults to one period. At most 10 renewals per minute are accepted per client address.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm renew` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `periods` | integer | no | Number of billing periods to renew, at least 1. The upper limit depends on the cycle (see above) and is returned as `max` in the error when exceeded. |

Example:

```json
{
  "periods": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `charged_cents` | integer | yes | Amount taken from the wallet, in US cents. |
| `paid_until` | integer | yes | New end of the paid period (Unix time, seconds, UTC) |
| `invoice_id` | integer | yes | Identifier of the invoice created for the renewal. See the Billing endpoints. |
| `periods` | integer | yes | Number of periods renewed. |
| `months` | integer | yes | Months added in total. |

Example:

```json
{
  "charged_cents": 343,
  "invoice_id": 1042,
  "months": 1,
  "paid_until": 1798200000,
  "periods": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or `periods` is not an integer. The error carries a `detail`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance does not cover the renewal. The error carries `need_cents` and `balance_cents`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `hourly_no_renew` | The server is billed by the hour and has no period to renew. |
| 409 | `renewal_in_progress` | Another renewal of this server was processed in the same second. Nothing was charged; read the new `paid_until` before renewing again. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is still provisioning, has failed or is being deleted). The error carries the current `state`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `periods` is below 1 or above the maximum for the cycle. The error carries `field` = `periods` and `max`. |
| 422 | `cycle_not_available_in_zone` | The billing cycle is not sold in the server's region (for example long prepaid cycles in some regions). The error carries `cycles`, the cycle slugs the region sells; they are also listed as `cycles` on the catalog `zones`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 429 | `rate_limited` | More than 10 renewals in a minute from the same client address. |
| 503 | `provider_unavailable` | The site cannot accept new charges at the moment. Nothing was charged; retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"periods":1}'
```

---

#### Change the billing cycle (prorated)

`POST /v1/vm/{id}/change-cycle`

Moves the server to another billing cycle, for example from hourly to monthly or from monthly to yearly. The unused part of a current prepaid period is refunded to the wallet and the first period of the new cycle is charged, both in one transaction: if the wallet cannot cover the difference nothing changes (`402 insufficient_funds`). Switching to `hourly` refunds the unused part and starts billing by the hour. Exception — servers in regions with calendar-month billing (international regions): switching a prepaid server to `hourly` is not immediate and refunds nothing; it is scheduled for the end of the paid period (`next_cycle` + `effective_at`) and sending the current cycle again cancels the schedule. Hourly servers there pay bandwidth per GB, monthly or longer cycles have unlimited bandwidth. Preview the amounts with [Quote a billing-cycle change](#operation/vm_cycle_quote).

The change is immediate and does not create a job. The invoices for the refund and the charge appear under Billing.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm change-cycle` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cycle` | string | yes | Slug of the new billing cycle, from the `cycles` of the catalog, e.g. `monthly`, `yearly`, `2y`, `3y` or `hourly`. It must differ from the current cycle. |

Example:

```json
{
  "cycle": "yearly"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `charged_cents` | integer | yes | Amount charged for the first period of the new cycle, in US cents. 0 when switching to hourly. |
| `refunded_cents` | integer | yes | Amount refunded for the unused part of the previous cycle, in US cents. |
| `paid_until` | integer or null | yes | End of the period now paid for. null when the server is now billed by the hour (Unix time, seconds, UTC) |
| `cycle` | string | yes | The cycle the server is on now. |
| `next_cycle` | string or null | yes | Cycle scheduled for the end of the paid period (`hourly`), or null when the change was immediate or a schedule was cancelled |
| `effective_at` | integer or null | yes | When the scheduled cycle takes effect (end of the paid period). null when nothing is scheduled (Unix time, seconds, UTC) |

Example:

```json
{
  "charged_cents": 3705,
  "cycle": "yearly",
  "effective_at": null,
  "next_cycle": null,
  "paid_until": 1827100000,
  "refunded_cents": 287
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The change could not be made, for example two changes arrived in the same second. The error carries a `detail`; retry. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the new cycle after the refund. The error carries `need_cents` and `balance_cents`. Nothing was changed. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `same_cycle` | The server is already on this billing cycle. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is still provisioning, has failed or is being deleted). The error carries the current `state`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `cycle` is missing, unknown or disabled. The error carries `field` = `cycle`. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `cycle_not_available_in_zone` | The billing cycle is not sold in the server's region (for example long prepaid cycles in some regions). The error carries `cycles`, the cycle slugs the region sells; they are also listed as `cycles` on the catalog `zones`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 503 | `provider_unavailable` | The site cannot accept new charges at the moment. Nothing was charged; retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/change-cycle" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"yearly"}'
```

---

#### Reinstall the OS (WIPES the disk)

`POST /v1/vm/{id}/reinstall`

**Erases the server's system disk** and installs the operating system again, either the one it already runs or, when `template_id` is given, a different image from the catalog. Everything on the system disk is lost and cannot be recovered; additional data volumes are not touched. The server keeps its plan, IP address and billing, and nothing is charged or refunded.

The call returns as soon as the job is queued (`job_id`); follow it with [List VM jobs](#operation/vm_jobs). While it runs the server is restarted and unreachable. When the installation finishes a new administrator password is sent to the account's e-mail address; if none could be produced, use Reset password. A server that still has snapshots cannot be reinstalled (`409 has_snapshots`): delete them first.

**Required scope:** `vm:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:destroy` | CLI: `vm reinstall` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `template_id` | integer | no | Image to install, from the catalog `templates`. Omit it, or send the image the server already uses, to reinstall the same operating system. |

Example:

```json
{
  "template_id": 11
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the operation. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1903
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or `template_id` is not an integer. The error carries a `detail`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `has_snapshots` | The server still has snapshots. The error carries their `count`. Delete them, then retry. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is still provisioning, has failed or is being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`reinstall`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `template_id` is not an image you can install on this server. The error carries `field` = `template_id`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 502 | `cloudstack_error` | The server's snapshots could not be checked, so nothing was started. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/reinstall" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"template_id":11}'
```

---

#### Change the public IP (cooldown between changes)

`POST /v1/vm/{id}/change-ip`

Gives the server a new public IPv4 address and releases the old one. Firewall rules of the old address are copied to the new one. The old address is not reused for a few days, so you cannot cycle through addresses. Expect a short loss of connectivity while the address is switched; update DNS records and allow-lists that point at the old address.

Only one change is allowed per cooldown window (24 hours by default, set by the site); inside it the call fails with `429 ip_change_cooldown` and `retry_after_hours`. The call returns as soon as the job is queued (`job_id`); follow it with [List VM jobs](#operation/vm_jobs). The new address shows in [Get a VM](#operation/vm_get) when the job is done. The body is ignored.

**Required scope:** `vm:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:write` | CLI: `vm change-ip` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the operation. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1904
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is still provisioning, has failed or is being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`change_ip`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 429 | `ip_change_cooldown` | The address was changed too recently. The error carries `retry_after_hours`, the whole hours left in the cooldown window. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/change-ip" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Enable/disable IPv6 (dual-stack or IPv4 only)

`POST /v1/vm/{id}/toggle-ipv6`

Switches the server between dual-stack (IPv4 and IPv6) and IPv4 only. The server is moved to the other network, which interrupts its public connectivity for a few minutes; it may be restarted at the end, and its public IPv4 address can change. Firewall rules are kept. If the server is already in the requested mode the job finishes without changing anything, but still counts for the cooldown. A server inside a Private Cloud always has IPv6 and cannot be switched (`409 vpc_managed`).

Only one switch is allowed per cooldown window (60 minutes by default, set by the site); inside it the call fails with `429 ipv6_toggle_cooldown`. A server that still has snapshots cannot be switched (`409 has_snapshots`). The call returns as soon as the job is queued (`job_id`); follow it with [List VM jobs](#operation/vm_jobs). The result shows in the server's `enable_ipv6` and `ipv6` fields.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm toggle-ipv6`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `enable` | boolean | no | `true` to enable IPv6 (dual-stack), `false` for IPv4 only. When omitted the current mode is flipped. |

Example:

```json
{
  "enable": true
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the operation. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1905
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or `enable` is not a boolean. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `has_snapshots` | The server still has snapshots. The error carries their `count`. Delete them, then retry. |
| 409 | `vpc_managed` | The server is in a Private Cloud, where IPv6 is always on. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is still provisioning, has failed or is being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`ipv6`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 429 | `ipv6_toggle_cooldown` | The server was switched too recently. The error carries `retry_after` (seconds) and `retry_after_minutes` until the next switch is allowed. |
| 502 | `cloudstack_error` | The server's snapshots could not be checked, so nothing was started. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/toggle-ipv6" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enable":true}'
```

---

### VM Networking

Firewall rules and port forwarding rules of a virtual server. Changes are applied in the background: the write operations answer immediately with a `job_id`, which you follow with [List VM jobs](#operation/vm_jobs). Rules are read live from the network and cached for about 20 seconds, so a list can lag slightly behind a change you have just made.

#### Firewall rules

`GET /v1/vm/{id}/firewall`

Lists the inbound firewall rules of the server: IPv4 rules on its public address and, when IPv6 is enabled for the server, its IPv6 rules. Each rule lets one protocol and port range in from one source range. The result is cached for about 20 seconds.

`pending_job` is true while a rule you added or deleted is still being applied. A server that is still being provisioned has no public address yet and answers `409 vm_not_ready`.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm firewall list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of FirewallRule | yes |  |
| `items[].id` | string | yes | Rule identifier. Pass it to [Delete a firewall rule](#operation/vm_firewall_delete). |
| `items[].protocol` | string or null | yes | `tcp`, `udp` or `icmp`. |
| `items[].start_port` | integer or null | yes | First port of the range. Null for `icmp`. |
| `items[].end_port` | integer or null | yes | Last port of the range; equal to `start_port` for a single port. Null for `icmp`. |
| `items[].cidr_list` | string or null | yes | Source addresses the rule lets in, as a CIDR block such as `203.0.113.0/24`. `0.0.0.0/0` (IPv4) or `::/0` (IPv6) means everywhere. |
| `items[].state` | string or null | yes | Rule state: `Active` once applied, or `Add` / `Revoke` while a change is still being applied. |
| `items[].icmp_type` | integer or null | yes | ICMP type, only for `icmp` rules. |
| `items[].icmp_code` | integer or null | yes | ICMP code, only for `icmp` rules. |
| `items[].family` | string: `ipv4`, `ipv6` | yes | Address family the rule applies to. |
| `public_ip` | string or null | yes | Public IPv4 address the IPv4 rules apply to. |
| `max_rules` | integer | yes | Maximum number of rules per address family on one server. |
| `pending_job` | boolean | yes | True while a rule change you requested is still queued or running. |
| `at` | integer | yes | Time the rules were read (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792400000,
  "items": [
    {
      "cidr_list": "0.0.0.0/0",
      "end_port": 22,
      "family": "ipv4",
      "icmp_code": null,
      "icmp_type": null,
      "id": "6f1f8c0a-2d57-4b2e-9c1c-5a8f3e7d1b42",
      "protocol": "tcp",
      "start_port": 22,
      "state": "Active"
    },
    {
      "cidr_list": "203.0.113.0/24",
      "end_port": null,
      "family": "ipv4",
      "icmp_code": -1,
      "icmp_type": -1,
      "id": "b2d7a1e4-93c0-4f5a-8a76-0e1c4d2f9a35",
      "protocol": "icmp",
      "start_port": null,
      "state": "Active"
    }
  ],
  "max_rules": 50,
  "pending_job": false,
  "public_ip": "203.0.113.10"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`firewall`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 502 | `cloudstack_error` | The rules could not be read from the network. Retry in a few moments. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/firewall" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Port forwarding rules

`GET /v1/vm/{id}/port-forwarding`

Lists the port forwarding rules of the server's public address. Servers normally use a dedicated public address that is mapped 1:1 to the server (static NAT): every port already reaches the server, `static_nat` is true and `items` is empty. Control which traffic is allowed with [firewall rules](#operation/vm_firewall_list) instead. The result is cached for about 20 seconds.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm port-forward list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `static_nat` | boolean | yes | True when the public address is mapped 1:1 to the server, in which case port forwarding rules cannot be added. |
| `items` | array of PortForwardRule | yes |  |
| `items[].id` | string | yes | Rule identifier. Pass it to [Delete a port forwarding rule](#operation/vm_port_forward_delete). |
| `items[].protocol` | string or null | yes | `tcp` or `udp`. |
| `items[].public_start` | integer or null | yes | First public port of the range. |
| `items[].public_end` | integer or null | yes | Last public port of the range. |
| `items[].private_start` | integer or null | yes | First server port the traffic is sent to. |
| `items[].private_end` | integer or null | yes | Last server port the traffic is sent to. |
| `items[].vm_guest_ip` | string or null | yes | Private address of the server the traffic is forwarded to. |
| `items[].state` | string or null | yes | Rule state: `Active` once applied, or `Add` / `Revoke` while a change is still being applied. |
| `public_ip` | string or null | yes | Public IPv4 address of the server. |
| `private_ip` | string or null | yes | Private address of the server. |
| `at` | integer | yes | Time the rules were read (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792400000,
  "items": [],
  "private_ip": "10.1.2.34",
  "public_ip": "203.0.113.10",
  "static_nat": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`port_forward`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 502 | `cloudstack_error` | The rules could not be read from the network. Retry in a few moments. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/port-forwarding" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add a firewall rule

`POST /v1/vm/{id}/firewall`

Adds an inbound rule that lets one protocol and port range reach the server from one source range. The call returns as soon as the change is queued (`job_id`); the rule appears in [List firewall rules](#operation/vm_firewall_list) with state `Active` once the job is done.

For `tcp` and `udp` give `start_port` (and `end_port` for a range). `icmp` rules take no ports. `cidr_list` takes one CIDR block or one address (a single address becomes `/32`, or `/128` for IPv6) and defaults to everywhere. With `family` set to `ipv6` the rule applies to the server's IPv6 address, which must have been enabled for the server first. A server can have at most 50 rules per address family.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm firewall add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `protocol` | string: `tcp`, `udp`, `icmp` | yes | Protocol the rule applies to. Case-insensitive. |
| `start_port` | integer | no | First port, 1 to 65535. Required for `tcp` and `udp`; ignored for `icmp`. |
| `end_port` | integer | no | Last port of the range, not lower than `start_port`. Defaults to `start_port`. |
| `cidr_list` | string | no | Source address range as one CIDR block or one address, for example `203.0.113.0/24`. Defaults to `0.0.0.0/0` (`::/0` for IPv6). `cidr` is accepted as an alias. |
| `family` | string: `ipv4`, `ipv6` | no | Address family. Defaults to `ipv4`. |

Example:

```json
{
  "cidr_list": "203.0.113.0/24",
  "protocol": "tcp",
  "start_port": 443
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that applies the change. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1842
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or has a field of the wrong type. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `too_many_rules` | The server already has the maximum number of rules (`max_rules`, 50). |
| 409 | `vm_ipv6_disabled` | `family` is `ipv6` but IPv6 is not enabled for this server. |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `vpc_managed` | The server belongs to a Private Cloud, whose traffic rules are managed through the Private Cloud network ACL instead. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`firewall`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_protocol` | `protocol` is not `tcp`, `udp` or `icmp`. |
| 422 | `invalid_cidr` | `cidr_list` is not a valid CIDR block or address for the chosen family. |
| 422 | `invalid_port` | A port is outside 1 to 65535, missing for `tcp`/`udp`, or `start_port` is higher than `end_port`. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 502 | `cloudstack_error` | The network could not be reached or answered with an error. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/firewall" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidr_list":"203.0.113.0/24","protocol":"tcp","start_port":443}'
```

---

#### Delete a firewall rule

`DELETE /v1/vm/{id}/firewall/{rule_id}`

Removes one firewall rule of the server, IPv4 or IPv6. The call returns as soon as the removal is queued (`job_id`). Only rules that belong to this server can be removed; any other `rule_id` answers `404`.

Get the `rule_id` from [List firewall rules](#operation/vm_firewall_list).

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm firewall delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `rule_id` | string | yes | Rule identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that applies the change. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1843
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist, is not yours, or has no rule with this identifier. |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `vpc_managed` | The server belongs to a Private Cloud, whose traffic rules are managed through the Private Cloud network ACL instead. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`firewall`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | `rule_id` is not a valid rule identifier (lowercase hexadecimal digits and hyphens, at most 64 characters). |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 502 | `cloudstack_error` | The network could not be reached or answered with an error. Retry in a few moments. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/firewall/<rule_id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add a port-forwarding rule

`POST /v1/vm/{id}/port-forwarding`

Forwards a public port (or port range) to a port of the server. The public and private ranges must have the same length. The call returns as soon as the change is queued (`job_id`).

When the public address is mapped 1:1 to the server (`static_nat` is true in [List port forwarding rules](#operation/vm_port_forward_list)) every port already reaches the server and the call fails with `409 static_nat_enabled`. A server can have at most 50 rules.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm port-forward add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `protocol` | string: `tcp`, `udp` | yes | Protocol to forward. Case-insensitive. |
| `public_start` | integer | yes | First public port, 1 to 65535. |
| `public_end` | integer | no | Last public port. Defaults to `public_start`. A value outside 1 to 65535 is ignored. |
| `private_start` | integer | yes | First server port, 1 to 65535. |
| `private_end` | integer | no | Last server port. Defaults to `private_start`. A value outside 1 to 65535 is ignored. |

Example:

```json
{
  "private_start": 80,
  "protocol": "tcp",
  "public_start": 8080
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that applies the change. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1844
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or has a field of the wrong type. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `static_nat_enabled` | The public address is mapped 1:1 to the server, so port forwarding is not needed and cannot be added. |
| 409 | `too_many_rules` | The server already has the maximum number of rules (`max_rules`, 50). |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `vpc_managed` | The server belongs to a Private Cloud, whose traffic rules are managed through the Private Cloud network ACL instead. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`port_forward`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_protocol` | `protocol` is not `tcp` or `udp`. |
| 422 | `invalid_port` | A start port is missing or outside 1 to 65535, an end port is lower than its start port, or the two ranges differ in length. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 502 | `cloudstack_error` | The network could not be reached or answered with an error. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/port-forwarding" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"private_start":80,"protocol":"tcp","public_start":8080}'
```

---

#### Delete a port-forwarding rule

`DELETE /v1/vm/{id}/port-forwarding/{rule_id}`

Removes one port forwarding rule of the server. The call returns as soon as the removal is queued (`job_id`). Get the `rule_id` from [List port forwarding rules](#operation/vm_port_forward_list).

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm port-forward delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `rule_id` | string | yes | Rule identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that applies the change. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1845
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist, is not yours, or has no port forwarding rule with this identifier. |
| 409 | `vm_not_ready` | The server has no public address yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `vpc_managed` | The server belongs to a Private Cloud, whose traffic rules are managed through the Private Cloud network ACL instead. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`port_forward`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | `rule_id` is not a valid rule identifier (lowercase hexadecimal digits and hyphens, at most 64 characters). |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 502 | `cloudstack_error` | The network could not be reached or answered with an error. Retry in a few moments. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/port-forwarding/<rule_id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Snapshots

Point-in-time snapshots of a whole virtual server. Each server can hold a limited number of snapshots (`meta.limit`, 3 by default). Taking or deleting a snapshot runs in the background: the write operations answer immediately with a `job_id`, which you follow with [List VM jobs](#operation/vm_jobs). While a server has snapshots, changing its plan, reinstalling it or resizing its disk is refused with `409 has_snapshots`, so delete them first. Snapshots can be switched off for a site; every operation then answers `501 feature_disabled`.

#### List snapshots

`GET /v1/vm/{id}/snapshots`

Lists the snapshots of the server, with how many more you may take. `meta.can_create` is true only when the limit is not reached, no snapshot job is queued or running, and the server is active and not locked. The result is cached for about 20 seconds.

`pending_job` is true while a snapshot is being taken, deleted or restored.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm snapshot list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Snapshot | yes |  |
| `items[].id` | string | yes | Snapshot identifier. Pass it to [Delete a snapshot](#operation/vm_snapshot_delete). |
| `items[].name` | string or null | yes | Name of the snapshot. |
| `items[].description` | string or null | yes | Description given when the snapshot was taken. |
| `items[].state` | string or null | yes | Snapshot state, for example `Ready` when it can be used, or `Creating` while it is being taken. |
| `items[].type` | string or null | yes | Snapshot type as reported by the platform; `Disk` for the disk-only snapshots taken here. |
| `items[].current` | boolean | yes | True for the snapshot the server's present state descends from. |
| `items[].created` | string or null | yes | Creation time as the platform reports it, for example `2026-10-19T08:00:00+0000`. |
| `items[].created_at` | integer or null | yes | Creation time (Unix time, seconds, UTC) |
| `items[].physicalsize` | integer or null | yes | Space the snapshot occupies, in bytes. |
| `items[].virtualsize` | integer or null | yes | Provisioned size of the snapshotted disks, in bytes. |
| `meta` | object | yes |  |
| `meta.count` | integer | yes | Number of snapshots the server has. |
| `meta.limit` | integer | yes | Maximum number of snapshots per server. |
| `meta.remaining` | integer | yes | How many more snapshots you can take (`limit` minus `count`, never below zero). |
| `meta.can_create` | boolean | yes | Whether [Create a snapshot](#operation/vm_snapshot_create) would be accepted right now. |
| `pending_job` | boolean | yes | True while a snapshot job (create, delete or restore) is queued or running. |

Example:

```json
{
  "items": [
    {
      "created": "2026-10-18T21:14:07+0000",
      "created_at": 1792358047,
      "current": true,
      "description": "Before the 24.04 upgrade",
      "id": "0c5d1e7a-6b3f-4a9e-8d21-7f4b2c9e1a60",
      "name": "before-upgrade",
      "physicalsize": 2147483648,
      "state": "Ready",
      "type": "Disk",
      "virtualsize": 42949672960
    }
  ],
  "meta": {
    "can_create": true,
    "count": 1,
    "limit": 3,
    "remaining": 2
  },
  "pending_job": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_ready` | The server does not exist on the platform yet because it is still being provisioned. The error carries the current `state`. |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |
| 502 | `cloudstack_error` | The existing snapshots could not be read. Retry in a few moments. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/snapshots" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a snapshot

`POST /v1/vm/{id}/snapshots`

Takes a snapshot of the whole server. The call returns as soon as the job is queued (`job_id`); the snapshot shows up in [List snapshots](#operation/vm_snapshot_list) with state `Creating` and becomes `Ready` when the job is done. Taking a snapshot can take a minute or more depending on the disk size.

Both fields are optional. `name` keeps only letters, digits, spaces, `-`, `_` and `.` (at most 60 characters); when empty it defaults to the server's hostname plus the current UTC time. Once the server holds `meta.limit` snapshots the call fails with `409 snapshot_limit`.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm snapshot create`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | Snapshot name. Characters other than letters, digits, space, `-`, `_` and `.` are dropped; at most 60 characters are kept. |
| `description` | string | no | Free-text description, at most 200 characters; control characters are dropped. |

Example:

```json
{
  "description": "Before the 24.04 upgrade",
  "name": "before-upgrade"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1901
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or has a field of the wrong type. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `snapshot_limit` | The server already has the maximum number of snapshots. The error carries the `limit`. Delete one first. |
| 409 | `vm_not_ready` | The server does not exist on the platform yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`snapshot`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |
| 502 | `cloudstack_error` | The existing snapshots could not be read. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/snapshots" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description":"Before the 24.04 upgrade","name":"before-upgrade"}'
```

---

#### Delete a snapshot

`DELETE /v1/vm/{id}/snapshots/{sid}`

Deletes one snapshot of the server. The call returns as soon as the deletion is queued (`job_id`). A snapshot that does not belong to this server answers `404`.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm snapshot delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `sid` | string | yes | Snapshot identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1902
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist, is not yours, or has no snapshot with this identifier. |
| 409 | `vm_not_ready` | The server does not exist on the platform yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`snapshot`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | `sid` is not a valid snapshot identifier (lowercase hexadecimal digits and hyphens, at most 64 characters). The error carries `field` = `snapshot_id`. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |
| 502 | `cloudstack_error` | The existing snapshots could not be read. Retry in a few moments. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/snapshots/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Snapshots of all VMs in the account (paged, sortable)

`GET /v1/snapshots`

Lists the snapshots of all your servers in one paged list, newest first by default. Snapshots of deleted servers are not shown. To list or manage the snapshots of one server use the per-server operations. The list is cached for about 20 seconds, so a snapshot you just took or deleted can take a moment to appear or disappear.

`meta.limit` is the number of snapshots one server may hold.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `snapshot list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created`, `size`, `vm`, `state`, `name` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `order` | string: `asc`, `desc` | no | Alias of `dir`, used only when `dir` is absent. |
| `vm_id` | string | no | Only list snapshots of this server (UUID). A server that is not yours gives an empty list. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AccountSnapshot | yes |  |
| `items[].id` | string | yes | Snapshot identifier. Pass it as `sid` to restore or delete the snapshot. |
| `items[].name` | string | yes | Name of the snapshot. |
| `items[].description` | string | yes | Description given when the snapshot was taken. Empty if none. |
| `items[].state` | string | yes | Snapshot state, for example `Ready` when it can be used, or `Creating` while it is being taken. |
| `items[].type` | string | yes | Snapshot type as reported by the platform; `Disk` for the disk-only snapshots taken here. |
| `items[].current` | boolean | yes | True for the snapshot the server's present state descends from. |
| `items[].size` | integer or null | yes | Space the snapshot occupies, in bytes. null when the platform does not report it. |
| `items[].created` | string | yes | Creation time as the platform reports it, for example `2026-10-18T21:14:07+0000`. |
| `items[].created_at` | integer or null | yes | Creation time (Unix time, seconds, UTC) |
| `items[].source` | string: `manual`, `schedule` | yes | `schedule` for snapshots taken by an automatic schedule, `manual` for those you took yourself. |
| `items[].vm_id` | string | yes | Identifier (UUID) of the server the snapshot belongs to. |
| `items[].hostname` | string | yes | Host name of the server. |
| `items[].vm_name` | string | yes | Display name of the server, or its host name when it has none. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string: `created`, `size`, `vm`, `state`, `name` | yes | The sort field applied. An unknown `sort` falls back to `created`. |
| `dir` | string: `asc`, `desc` | yes | The sort direction applied. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Number of snapshots matching the filters. |
| `meta.limit` | integer | yes | Maximum number of snapshots one server may hold. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "created": "2026-10-18T21:14:07+0000",
      "created_at": 1792358047,
      "current": true,
      "description": "Before the 24.04 upgrade",
      "hostname": "web-1",
      "id": "0c5d1e7a-6b3f-4a9e-8d21-7f4b2c9e1a60",
      "name": "before-upgrade",
      "size": 2147483648,
      "source": "manual",
      "state": "Ready",
      "type": "Disk",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_name": "Web server"
    }
  ],
  "meta": {
    "limit": 3,
    "total": 1
  },
  "page": 1,
  "per_page": 20,
  "sort": "created",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |
| 502 | `cloudstack_error` | The snapshots could not be read. Retry in a few moments. |

**Example request**

```bash
curl "https://api.onie.net/v1/snapshots" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Automatic snapshot schedules of all VMs (paged)

`GET /v1/snapshot-policies`

Lists the automatic snapshot schedules of all your servers in one paged list. To see the schedules of one server, or to add or remove one, use the per-server operations.

`meta.max_per_vm` is how many schedules one server may have and `meta.keep_max` the largest `keep` allowed.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `snapshot schedule list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `vm`, `keep`, `enabled`, `next_run_at`, `last_run_at` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `order` | string: `asc`, `desc` | no | Alias of `dir`, used only when `dir` is absent. |
| `vm_id` | string | no | Only list schedules of this server (UUID). A server that is not yours gives an empty list. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AccountSnapshotSchedule | yes |  |
| `items[].id` | integer | yes | Schedule identifier. Pass it as `pid` to delete the schedule. |
| `items[].vm_id` | string | yes | Identifier (UUID) of the server the schedule belongs to. |
| `items[].cron` | string | yes | The schedule in text form: `daily HH:MM`, or `weekly D HH:MM` where D is 1 (Monday) to 7 (Sunday). Times are UTC. |
| `items[].kind` | string or null: `daily`, `weekly` | yes | How often the schedule runs. |
| `items[].dow` | integer or null | yes | Day of the week, 1 (Monday) to 7 (Sunday). null for daily schedules. |
| `items[].hour` | integer or null | yes | Hour of the day, 0 to 23 (UTC). |
| `items[].minute` | integer or null | yes | Minute of the hour, 0 to 59. |
| `items[].keep` | integer | yes | How many automatic snapshots of this schedule to keep; the oldest is deleted before a new one is taken. |
| `items[].enabled` | boolean | yes | Whether the schedule is active. |
| `items[].last_run_at` | integer or null | yes | When the schedule last ran. null if it has not run yet (Unix time, seconds, UTC) |
| `items[].next_run_at` | integer | yes | When the schedule runs next (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Why the last run did not produce a snapshot, when it failed. null otherwise. The text is for people and may change. |
| `items[].created_at` | integer | yes | When the schedule was created (Unix time, seconds, UTC) |
| `items[].hostname` | string | yes | Host name of the server. |
| `items[].vm_name` | string | yes | Display name of the server, or its host name when it has none. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string: `created_at`, `vm`, `keep`, `enabled`, `next_run_at`, `last_run_at` | yes | The sort field applied. An unknown `sort` falls back to `created_at`. |
| `dir` | string: `asc`, `desc` | yes | The sort direction applied. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Number of schedules matching the filters. |
| `meta.max_per_vm` | integer | yes | Maximum number of schedules one server may have. |
| `meta.keep_max` | integer | yes | Largest allowed `keep`: the number of snapshots one server may hold. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "created_at": 1795100000,
      "cron": "weekly 1 03:30",
      "dow": 1,
      "enabled": true,
      "hostname": "web-1",
      "hour": 3,
      "id": 17,
      "keep": 2,
      "kind": "weekly",
      "last_error": null,
      "last_run_at": null,
      "minute": 30,
      "next_run_at": 1795663800,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_name": "Web server"
    }
  ],
  "meta": {
    "keep_max": 3,
    "max_per_vm": 2,
    "total": 1
  },
  "page": 1,
  "per_page": 20,
  "sort": "created_at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |

**Example request**

```bash
curl "https://api.onie.net/v1/snapshot-policies" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Automatic snapshot schedules of one VM

`GET /v1/vm/{id}/snapshot-policies`

Lists the automatic snapshot schedules of one server, oldest first, with the limits that apply. At each due time the server takes a snapshot; before that the oldest automatic snapshots beyond `keep` are deleted. A run is skipped, and the reason recorded in `last_error`, when the server cannot take a snapshot or already holds the maximum number of snapshots. Add a schedule with [Add a snapshot schedule](#operation/vm_snapshot_schedule_add).

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm snapshot schedule list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of SnapshotSchedule | yes |  |
| `items[].id` | integer | yes | Schedule identifier. Pass it as `pid` to delete the schedule. |
| `items[].vm_id` | string | yes | Identifier (UUID) of the server the schedule belongs to. |
| `items[].cron` | string | yes | The schedule in text form: `daily HH:MM`, or `weekly D HH:MM` where D is 1 (Monday) to 7 (Sunday). Times are UTC. |
| `items[].kind` | string or null: `daily`, `weekly` | yes | How often the schedule runs. |
| `items[].dow` | integer or null | yes | Day of the week, 1 (Monday) to 7 (Sunday). null for daily schedules. |
| `items[].hour` | integer or null | yes | Hour of the day, 0 to 23 (UTC). |
| `items[].minute` | integer or null | yes | Minute of the hour, 0 to 59. |
| `items[].keep` | integer | yes | How many automatic snapshots of this schedule to keep; the oldest is deleted before a new one is taken. |
| `items[].enabled` | boolean | yes | Whether the schedule is active. |
| `items[].last_run_at` | integer or null | yes | When the schedule last ran. null if it has not run yet (Unix time, seconds, UTC) |
| `items[].next_run_at` | integer | yes | When the schedule runs next (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Why the last run did not produce a snapshot, when it failed. null otherwise. The text is for people and may change. |
| `items[].created_at` | integer | yes | When the schedule was created (Unix time, seconds, UTC) |
| `max` | integer | yes | Maximum number of schedules one server may have. |
| `keep_max` | integer | yes | Largest allowed `keep`: the number of snapshots one server may hold. |

Example:

```json
{
  "items": [
    {
      "created_at": 1795100000,
      "cron": "weekly 1 03:30",
      "dow": 1,
      "enabled": true,
      "hour": 3,
      "id": 17,
      "keep": 2,
      "kind": "weekly",
      "last_error": null,
      "last_run_at": null,
      "minute": 30,
      "next_run_at": 1795663800,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "keep_max": 3,
  "max": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/snapshot-policies" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add an automatic snapshot schedule (daily/weekly)

`POST /v1/vm/{id}/snapshot-policies`

Adds an automatic snapshot schedule to a server and answers 201 with the new schedule. Describe the time either with `kind`, `hour`, `minute` (and `dow` for weekly), or with a single `cron` string such as `daily 03:00` or `weekly 1 03:30`; when `cron` is present the other time fields are ignored. All times are UTC. A `kind` other than `weekly` means daily.

A server may have a limited number of schedules (`max` in [List snapshot schedules of a VM](#operation/vm_snapshot_schedule_list)), and `keep` cannot exceed the number of snapshots a server may hold. Adding a schedule does not take a snapshot now; use the snapshot create operation for that. Works on a server in any state except a locked one.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm snapshot schedule add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `kind` | string: `daily`, `weekly` | no | How often to run. Default `daily`. |
| `hour` | integer | no | Hour of the day (UTC). Required unless `cron` is given. |
| `minute` | integer | no | Minute of the hour. Required unless `cron` is given. |
| `dow` | integer | no | Day of the week for weekly schedules: 1 (Monday) to 7 (Sunday). |
| `keep` | integer | no | How many automatic snapshots to keep, from 1 to the site maximum (`keep_max`). Default 3, or the maximum if that is lower. |
| `cron` | string | no | The whole schedule as text: `daily HH:MM` or `weekly D HH:MM`. Overrides `kind`, `hour`, `minute` and `dow`. |

Example:

```json
{
  "dow": 1,
  "hour": 3,
  "keep": 2,
  "kind": "weekly",
  "minute": 30
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `item` | SnapshotSchedule | yes |  |
| `item.id` | integer | yes | Schedule identifier. Pass it as `pid` to delete the schedule. |
| `item.vm_id` | string | yes | Identifier (UUID) of the server the schedule belongs to. |
| `item.cron` | string | yes | The schedule in text form: `daily HH:MM`, or `weekly D HH:MM` where D is 1 (Monday) to 7 (Sunday). Times are UTC. |
| `item.kind` | string or null: `daily`, `weekly` | yes | How often the schedule runs. |
| `item.dow` | integer or null | yes | Day of the week, 1 (Monday) to 7 (Sunday). null for daily schedules. |
| `item.hour` | integer or null | yes | Hour of the day, 0 to 23 (UTC). |
| `item.minute` | integer or null | yes | Minute of the hour, 0 to 59. |
| `item.keep` | integer | yes | How many automatic snapshots of this schedule to keep; the oldest is deleted before a new one is taken. |
| `item.enabled` | boolean | yes | Whether the schedule is active. |
| `item.last_run_at` | integer or null | yes | When the schedule last ran. null if it has not run yet (Unix time, seconds, UTC) |
| `item.next_run_at` | integer | yes | When the schedule runs next (Unix time, seconds, UTC) |
| `item.last_error` | string or null | yes | Why the last run did not produce a snapshot, when it failed. null otherwise. The text is for people and may change. |
| `item.created_at` | integer | yes | When the schedule was created (Unix time, seconds, UTC) |

Example:

```json
{
  "item": {
    "created_at": 1795100000,
    "cron": "weekly 1 03:30",
    "dow": 1,
    "enabled": true,
    "hour": 3,
    "id": 17,
    "keep": 2,
    "kind": "weekly",
    "last_error": null,
    "last_run_at": null,
    "minute": 30,
    "next_run_at": 1795663800,
    "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON, or a field has the wrong type or is out of the 0-255 range. The error carries a `detail`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `schedule_limit` | The server already has the maximum number of schedules. The error carries the `limit`. Delete one first. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`snapshot`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | The time is not valid (`field` = `cron`), or `keep` is outside 1 to the site maximum (`field` = `keep`, with `min` and `max`). |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/snapshot-policies" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dow":1,"hour":3,"keep":2,"kind":"weekly","minute":30}'
```

---

#### Delete an automatic snapshot schedule

`DELETE /v1/vm/{id}/snapshot-policies/{pid}`

Deletes an automatic snapshot schedule. Snapshots it already took are kept; delete them separately if you no longer need them. A schedule that does not exist, or belongs to another server or account, answers 404.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm snapshot schedule delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `pid` | string | yes | Snapshot schedule identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not yours, or it has no schedule with this identifier. |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/snapshot-policies/<pid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Restore the VM to a snapshot (stops, overwrites the disk, restarts)

`POST /v1/vm/{id}/snapshots/{sid}/restore`

**Overwrites the server's disk with a snapshot.** The server is stopped, its disk goes back to the state it had when the snapshot was taken, and the server is started again. Everything written since the snapshot was taken is lost and cannot be recovered. Use a backup or take a fresh snapshot first if you may need the current state.

The call returns as soon as the job is queued (`job_id`); follow it with [List VM jobs](#operation/vm_jobs). While the job runs the server is unreachable. The body is ignored.

**Required scope:** `vm:restore`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:restore` | CLI: `vm snapshot restore` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `sid` | string | yes | Snapshot identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that carries out the operation. Follow it with [List VM jobs](#operation/vm_jobs). |

Example:

```json
{
  "job_id": 1906
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not yours, or it has no snapshot with this identifier. |
| 409 | `vm_not_ready` | The server does not exist on the platform yet because it is still being provisioned. The error carries the current `state`. |
| 409 | `vm_not_active` | The server is not in the `active` state (for example it is provisioning, failed or being deleted). The error carries the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish, then retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`snapshot`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `sid` is not a valid snapshot identifier (lowercase hexadecimal digits and hyphens, at most 64 characters). The error carries `field` = `snapshot_id`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 501 | `feature_disabled` | Snapshots are not available on this site. The error carries `feature` = `snapshots`. |
| 502 | `cloudstack_error` | The server's snapshots could not be read. Retry in a few moments. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/snapshots/<sid>/restore" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

### Console and AI Agent

One-time tickets for the graphical (VNC) console and the SSH web terminal, shareable terminal links, and the AI SSH agent that runs commands on a server for you. Tickets and share tokens are secrets: anyone who holds one can open the console until it expires, so never log them or put them in a URL you share publicly.

#### Get a one-time VNC console ticket

`GET /v1/vm/{id}/console`

Issues a one-time link to the graphical (VNC) console of a running server. Open `url` in a browser, or embed it in a page, within `expires_in` seconds (60). The link works for one console session; asking again issues a new one. Requests are limited to 10 per minute per client address.

The server must be active and running. For a text terminal use [Get an SSH ticket](#operation/vm_ssh_token) instead.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm console`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `url` | string | yes | Console address to open in a browser. It contains the one-time ticket, so treat it as a secret. |
| `expires_in` | integer | yes | Seconds the ticket stays valid (60). |

Example:

```json
{
  "expires_in": 60,
  "url": "https://console.example.com/c/4b8e2f6a1d3c9e7f5a0b2c4d6e8f1a3b5c7d9e0f"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not in the `active` state. The error carries the current `state`. |
| 409 | `vm_not_running` | The server is not running, so there is nothing to connect to. The error carries `cs_state`, the power state the platform reports. |
| 409 | `console_ssh_only` | The server's region offers no graphical console (`capabilities.console` is `ssh`). The error carries `kind` = `ssh`: use [Get an SSH ticket](#operation/vm_ssh_token) for a terminal instead. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/console" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get a one-time SSH WebSocket token

`POST /v1/vm/{id}/ssh-token`

Issues a one-time ticket for the SSH web terminal of a running Linux server. Open a WebSocket to `websocket_url` with the ticket as the `token` query parameter (`<websocket_url>?token=<token>`) within `expires_in` seconds (300). The ticket can be used for one connection only; reconnecting needs a new ticket. Over the socket, send JSON text frames such as `{"type":"input","data":"ls\n"}`, `{"type":"resize","cols":120,"rows":30}` and, when the gateway asks for credentials (`auth_required`), `{"type":"auth","username":"...","password":"..."}`; output arrives as `{"type":"output","data":"..."}` frames.

The server must be active, running and have an address. Requests are limited to 20 per minute per client address. `has_credentials` tells you whether a saved password or key will be used automatically; if not, the gateway asks for the password.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm ssh-token`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `token` | string | yes | One-time ticket. A secret: it opens a terminal on the server. |
| `expires_in` | integer | yes | Seconds the ticket stays valid (300). |
| `websocket_url` | string | yes | WebSocket address of the terminal gateway. |
| `default_username` | string | yes | Login name the terminal proposes for this server. |
| `port` | integer | yes | SSH port of the server. |
| `vm_id` | string | yes | Identifier of the server. |
| `vm_name` | string | yes | Display name of the server. |
| `ip_address` | string | yes | Address the terminal connects to. |
| `has_credentials` | boolean | yes | True when the gateway can log in without asking for a password. |

Example:

```json
{
  "default_username": "ubuntu",
  "expires_in": 300,
  "has_credentials": true,
  "ip_address": "203.0.113.10",
  "port": 22,
  "token": "ofw_ssh_9f3c1b7a5d2e4f60718293a4b5c6d7e8",
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "vm_name": "web-1",
  "websocket_url": "wss://cloud.example.com/ssh-ws"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not in the `active` state. The error carries the current `state`. |
| 409 | `vm_not_running` | The server is not running. The error carries `cs_state`, the power state the platform reports. |
| 409 | `vm_not_ready` | The server has no address to connect to yet. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/ssh-token" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### AI SSH Agent status and history

`GET /v1/vm/{id}/ai-agent/status`

Returns whether the AI agent is enabled, the model it uses, and the most recent conversation you had with it about this server (up to the last 40 messages, oldest first). `session_id` is null and `messages` is empty when there is no conversation yet. Use `session_id` in [Run the AI agent](#operation/vm_ai_agent_run) to continue the conversation.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm ai-agent status`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the AI agent is switched on for this site. When false, [Run the AI agent](#operation/vm_ai_agent_run) fails with `503 feature_disabled`. |
| `provider` | string | yes | Name of the AI service in use. |
| `model` | string | yes | Name of the model in use. |
| `session_id` | string or null | yes | Identifier of the latest conversation for this server; null when there is none. |
| `messages` | array of AiAgentMessage | yes |  |
| `messages[].id` | integer | yes | Message identifier. Increases with time. |
| `messages[].role` | string: `user`, `assistant` | yes | Who wrote the message. |
| `messages[].content` | string | yes | Message text. |
| `messages[].meta` | object or null | yes |  |
| `messages[].meta.model` | string | no | Model that produced the answer. |
| `messages[].meta.steps` | array of AiAgentStep | no |  |
| `messages[].meta.awaiting_confirm` | boolean | no | True when the answer ended with a command waiting for your confirmation. |
| `messages[].created_at` | integer | yes | Time the message was stored (Unix time, seconds, UTC) |

Example:

```json
{
  "enabled": true,
  "messages": [
    {
      "content": "How much disk space is left?",
      "created_at": 1792399000,
      "id": 101,
      "meta": null,
      "role": "user"
    },
    {
      "content": "The root disk is 38% full.",
      "created_at": 1792399012,
      "id": 102,
      "meta": {
        "model": "example-model-1",
        "steps": [
          {
            "command": "df -h /",
            "duration_ms": 412,
            "error": "",
            "exit_code": 0,
            "id": "call_1",
            "reason": "Check free disk space",
            "status": "done",
            "stderr": "",
            "stdout": "Filesystem Size Used Avail Use% Mounted on\n/dev/vda1 40G 15G 25G 38% /\n",
            "timed_out": false
          }
        ]
      },
      "role": "assistant"
    }
  ],
  "model": "example-model-1",
  "provider": "AI Assistant",
  "session_id": "ais_9b1d4c0a7e3f5a21c6d8"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/ai-agent/status" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Start a new AI SSH Agent session

`POST /v1/vm/{id}/ai-agent/clear`

Starts a new, empty AI agent conversation for this server. The earlier conversation is kept but is no longer the one [Get AI agent status](#operation/vm_ai_agent_status) returns, so the agent forgets the previous context. Pass the returned `session_id` to [Run the AI agent](#operation/vm_ai_agent_run), or omit `session_id` there to start a fresh conversation automatically. No body is needed.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm ai-agent clear`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |
| `session_id` | string | yes | Identifier of the new conversation. |

Example:

```json
{
  "ok": true,
  "session_id": "ais_5d2e8a1c7b3f9046e1a2"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/ai-agent/clear" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Run AI SSH Agent (SSE stream)

`POST /v1/vm/{id}/ai-agent`

Sends a message to the AI agent, which can run shell commands on the server over SSH to answer. The response is a stream of server-sent events (`text/event-stream`): each `data:` line is one JSON object (see the schema), separated by a blank line. The `X-AI-Session-Id` response header carries the conversation identifier.

A typical stream is `hello`, then `assistant_turn` (the agent's text), then one of two paths:

- **Needs your approval** (the default): `tool_request` with the proposed `command`, then `done` with `awaiting_confirm: true`. Show the command to the user and, if approved, call this operation again with the same `session_id` and `confirmed_cmd` set to that exact command. The server runs it as given, without re-checking it, so only send commands the user approved.
- **Runs by itself** (`auto_execute: true`, the command is on the read-only allowlist (checking status, reading logs/configuration, network diagnostics), and is not flagged as risky): `tool_start`, `tool_result` (output and exit code), then the agent continues with more `assistant_turn` / `tool_*` events, up to 10 steps, and ends with `done`. All commands that modify the server (installing packages, editing files, restarting services) stop at `tool_request` with `auto_blocked: true` and `read_only: false`; commands that look dangerous (deleting or overwriting files, changing accounts or keys, piping downloads into a shell, shutting down or rebooting) also include a `risk_reason`.

An `error` event ends the stream early. The server must be active and running. Limits: 20 requests per minute per account, 2 conversations streaming at once, and a daily quota of AI calls per account (300 by default, resets at 00:00 UTC); when exceeded the call fails with `429 rate_limited` (the daily case carries `limit`, `used` and `retry_after`).

```
data: {"type":"hello","session_id":"ais_9b1d4c0a7e3f5a21c6d8"}

data: {"type":"assistant_turn","content":"I will check the free disk space.","model":"example-model-1"}

data: {"type":"tool_request","id":"call_1","command":"df -h /","reason":"Check free disk space","risk_reason":null,"auto_blocked":false,"read_only":true}

data: {"type":"done","session_id":"ais_9b1d4c0a7e3f5a21c6d8","model":"example-model-1","awaiting_confirm":true}
```

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm ai-agent run`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `messages` | array of object | no | The conversation so far; the last 20 messages are used and the last `user` message is the one to answer. Required unless `confirmed_cmd` is sent. |
| `messages[].role` | string: `user`, `assistant` | yes | Author of the message. Other roles are ignored. |
| `messages[].content` | string | yes | Message text; at most 12000 characters are used. |
| `session_id` | string | no | Conversation to continue, as returned by an earlier call or by [Get AI agent status](#operation/vm_ai_agent_status). Omit it, or send an unknown value, to start a new conversation. |
| `vm_context` | object | no |  |
| `vm_context.os` | string | no | Operating system name, to help the agent pick the right commands. Defaults to `Linux`. |
| `auto_execute` | boolean | no | Run read-only commands automatically instead of asking first. Defaults to `false`. Commands that modify the server always wait for confirmation. |
| `confirmed_cmd` | string | no | A command the user approved after a `tool_request`. It is executed first, and its output is given to the agent. When present, `messages` is not stored as a new user message. |

Example:

```json
{
  "auto_execute": false,
  "messages": [
    {
      "content": "How much disk space is left?",
      "role": "user"
    }
  ],
  "session_id": "ais_9b1d4c0a7e3f5a21c6d8",
  "vm_context": {
    "os": "Ubuntu 24.04"
  }
}
```

**Response 200** - Success.

Content type: `text/event-stream`

| Field | Type | Always present | Description |
|---|---|---|---|
| `type` | string: `hello`, `assistant_turn`, `tool_request`, `tool_start`, `tool_result`, `step_skipped`, `error`, `done` | yes | Kind of event; it decides which other fields are present. `step_skipped` only comes from [Send to the AI agent](#operation/agent_session_send) when a pending command is declined. |
| `session_id` | string | no | Conversation identifier. In `hello` and `done`. |
| `content` | string | no | Text of the assistant's answer. In `assistant_turn`. |
| `model` | string | no | Model that produced the answer. In `assistant_turn` and `done`. |
| `id` | string | no | Identifier of the step. In `tool_request`, `tool_start`, `tool_result` and `step_skipped`. |
| `command` | string | no | The shell command. In `tool_request`, `tool_start` and `tool_result`. |
| `reason` | string or null | no | Why the command was chosen. In `tool_request` and `tool_start`. |
| `risk_reason` | string or null | no | Why the command needs confirmation; null when it is not risky. In `tool_request`. |
| `risk_code` | string or null | no | Stable code of the risk (`destructive`, `files`, `exfil`, `raw_net`, `auth`, `obfuscated`, `remote_script`, `power_fw`, `pivot`, `other`); null when not risky. In `tool_request`. |
| `auto_blocked` | boolean | no | True when the command is held back for confirmation because it is risky or not read-only, whatever `auto_execute` says. In `tool_request`. |
| `read_only` | boolean | no | True when the command is on the allowlist of read-only commands permitted for automatic execution (checking status, reading logs and configuration, network diagnostics). In `tool_request`. |
| `ok` | boolean | no | True when the command ran and the connection to the server worked. In `tool_result`. |
| `stdout` | string | no | Standard output of the command. In `tool_result`. |
| `stderr` | string | no | Standard error of the command. In `tool_result`. |
| `exit_code` | integer | no | Exit code of the command; -1 when it could not be run. In `tool_result`. |
| `timed_out` | boolean | no | True when the command was stopped because it ran too long. In `tool_result`. |
| `duration_ms` | integer | no | Run time in milliseconds. In `tool_result`. |
| `error` | string | no | Error text when the command could not be run; empty otherwise. In `tool_result`. |
| `message` | string | no | Human-readable description of the problem. In `error`. |
| `code` | string | no | Machine-readable code, for example `rate_limited` when the daily quota ran out mid-stream. In `error`, when available. |
| `awaiting_confirm` | boolean | no | True when the stream stopped at a command that needs your confirmation. In `done`. |

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_running` | The server is not active and running, so the agent cannot connect to it. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |
| 503 | `feature_disabled` | The AI agent is switched off for this site. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/ai-agent" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_execute":false,"messages":[{"content":"How much disk space is left?","role":"user"}],"session_id":"ais_9b1d4c0a7e3f5a21c6d8","vm_context":{"os":"Ubuntu 24.04"}}'
```

---

#### VMs usable by the AI SSH Agent + daily quota

`GET /v1/chat/agent/vms`

Lists your servers (VMs first, at most 500, by name; then your Bare Metal servers) with whether the AI SSH agent can work on each one right now. `kind` tells them apart: `vm` or `dedicated` (a Bare Metal server, identified by `ds_…`). A server is `ready` when it is active, running, not locked, runs Linux and has an address; a Bare Metal server must also have an active subscription and no operating system install in progress. Otherwise `reason` says why: `locked` (billing or admin lock), `not_active` (still being created or being deleted), `stopped`, `windows` (the agent needs a Linux shell), `no_ip`, `suspended` (Bare Metal subscription suspended), `installing` (Bare Metal operating system install in progress), `impersonated` (Bare Metal server seen in a session a reseller opened on your behalf; the agent cannot run there) or `unavailable` (managed by another provider for now). Bare Metal servers are only listed on the main site (not on reseller sites) and, when you use an API key, only with the `dedicated:console` scope; in a session a reseller opened on your behalf they are listed but never ready. `last_session_at` is the time of your latest conversation with the agent on that server. The response also carries whether the agent is switched on, the model it uses and your daily quota.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `agent vms`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].kind` | string: `vm`, `dedicated` | yes | `vm` for a virtual machine, `dedicated` for a Bare Metal server. |
| `items[].id` | string | yes | Server identifier (VM UUID, or `ds_…` for a Bare Metal server). |
| `items[].name` | string | yes | Display name. |
| `items[].hostname` | string or null | yes | Hostname; for a Bare Metal server, the one reported by its operating system (null until known). |
| `items[].public_ip` | string or null | yes | Public IPv4 address. |
| `items[].os` | string or null | yes | Operating system image name. |
| `items[].zone` | object or null | yes | Location of the server (`id`, `slug`, `name`, `name_en`, `country`, `city`). Null for a Bare Metal server. |
| `items[].state` | string | yes | Lifecycle state (`active`, `locked`, `provisioning`…). |
| `items[].cs_state` | string or null | yes | Power state reported by the platform (`Running`, `Stopped`…). Null for a Bare Metal server. |
| `items[].power_state` | string or null | no | Bare Metal servers only: power state (`On`, `Off`…). |
| `items[].ready` | boolean | yes | True when the agent can work on the server now. |
| `items[].reason` | string or null: `locked`, `not_active`, `stopped`, `windows`, `no_ip`, `suspended`, `installing`, `unavailable`, `impersonated` | yes | Why the server is not ready; null when it is. |
| `items[].last_session_at` | integer or null | yes | Time of the latest agent conversation on this server (Unix time, seconds, UTC) |
| `enabled` | boolean | yes | Whether the AI agent is switched on for this site. |
| `model` | string | yes | Model in use. |
| `quota` | AiAgentQuota | yes | Daily AI SSH agent quota of the account. |
| `quota.limit` | integer | yes | AI calls allowed per account per day. |
| `quota.used` | integer | yes | AI calls used today. |
| `quota.reset_at` | integer | yes | Time the quota resets (00:00 UTC) (Unix time, seconds, UTC) |

Example:

```json
{
  "enabled": true,
  "items": [
    {
      "cs_state": "Running",
      "hostname": "web-1",
      "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "kind": "vm",
      "last_session_at": 1792399012,
      "name": "web-1",
      "os": "Ubuntu 24.04",
      "public_ip": "203.0.113.10",
      "ready": true,
      "reason": null,
      "state": "active",
      "zone": {
        "city": "Hanoi",
        "country": "VN",
        "id": 1,
        "name": "Hanoi 1",
        "name_en": "Hanoi 1",
        "slug": "hn1"
      }
    },
    {
      "cs_state": null,
      "hostname": "bm-1",
      "id": "ds_3f6c1d0e8a52b57a",
      "kind": "dedicated",
      "last_session_at": null,
      "name": "bm-1",
      "os": "Ubuntu Server 24.04 LTS",
      "power_state": "On",
      "public_ip": "203.0.113.50",
      "ready": true,
      "reason": null,
      "state": "active",
      "zone": null
    }
  ],
  "model": "example-model-1",
  "quota": {
    "limit": 300,
    "reset_at": 1792454400,
    "used": 12
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/chat/agent/vms" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Check the agent SSH login (fixed command)

`POST /v1/chat/agent/vms/{id}/connect`

Checks that the agent can log in to the server over SSH, using the saved credentials (for a Bare Metal server, the login of its current operating system install unless you saved another one in its SSH tab) or the platform's operations key — you never send or receive a password. The platform runs a fixed, read-only command (login name, hostname, kernel and OS name) and does not use your AI quota. `connected: false` comes with `error_code`: `auth_failed` (log in once in the SSH console so the password is saved), `timeout`, `unreachable` (SSH not listening or blocked by a firewall) or `proxy_unavailable`. Limited to 10 checks per minute per account. The result is remembered for 60 seconds (300 seconds after a failure) so that opening the page repeatedly does not log in again and again (a wrong saved password could get the gateway banned by fail2ban); pass `force=1` to check again now. No body is needed.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `agent connect`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Server identifier: a VM UUID, or the identifier of a Bare Metal server (`ds_…`). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `force` | boolean | no | Check again now instead of returning the remembered result. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `connected` | boolean | yes | True when the SSH login worked. |
| `vm_id` | string | yes | Server identifier. |
| `kind` | string: `vm`, `dedicated` | yes | `vm` or `dedicated` (Bare Metal). |
| `ip` | string or null | yes | Address the agent connects to. It is always read on the server side (the VM's public address, or the Bare Metal server's current public address on port 22); you cannot choose it. |
| `username` | string or null | yes | Login name on the server; null when not connected. |
| `hostname` | string or null | yes | Hostname reported by the server; null when not connected. |
| `kernel` | string or null | yes | Kernel reported by the server; null when not connected. |
| `os` | string or null | yes | Operating system name (from the server when connected, otherwise the image name). |
| `latency_ms` | integer | yes | How long the check took, in milliseconds. |
| `error_code` | string or null: `auth_failed`, `timeout`, `unreachable`, `proxy_unavailable` | yes | Why the check failed; null when connected. |

Example:

```json
{
  "connected": true,
  "error_code": null,
  "hostname": "web-1",
  "ip": "203.0.113.10",
  "kernel": "Linux 6.8.0-45-generic",
  "kind": "vm",
  "latency_ms": 640,
  "os": "Ubuntu 24.04.1 LTS",
  "username": "root",
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | Bare Metal servers cannot be used from a session a reseller opened on your behalf. |
| 403 | `scope_required` | Bare Metal servers need the `dedicated:console` scope on an API key. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_running` | The server is not active and running. |
| 409 | `vm_not_agent_ready` | The server cannot be used by the agent (Windows, or no address). |
| 409 | `dedicated_ssh_unsupported` | Bare Metal: the operating system is not Linux. |
| 409 | `dedicated_installing` | Bare Metal: an operating system install is in progress. |
| 409 | `dedicated_powered_off` | Bare Metal: the server is powered off. |
| 409 | `dedicated_no_ip` | Bare Metal: the server has no usable public address. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. |
| 423 | `dedicated_server_locked` | Bare Metal: the server is locked. |
| 423 | `dedicated_suspended` | Bare Metal: the subscription is suspended. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/chat/agent/vms/<id>/connect" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List AI SSH Agent conversations

`GET /v1/chat/agent/sessions`

Lists your AI agent conversations that have at least one message, most recently active first. Filter by server with `vm_id`, and search titles and server names with `q`.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `agent session list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | no | Only conversations about this server. |
| `q` | string | no | Text to look for in the title or the server name. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `updated_at`, `created_at`, `title`, `vm`, `message_count`, `commands` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AiAgentSession | yes |  |
| `items[].id` | string | yes | Conversation identifier (`ais_…`). |
| `items[].kind` | string: `vm`, `dedicated` | yes | What the conversation works on: a virtual machine (`vm`) or a Bare Metal server (`dedicated`). |
| `items[].vm_id` | string | yes | Server the conversation works on (VM UUID, or `ds_…` for a Bare Metal server). A conversation always stays bound to this server. |
| `items[].vm_name` | string or null | yes | Display name of the server; null when the server no longer belongs to you (deleted or transferred). Such a VM conversation can still be read but not continued. A Bare Metal conversation is only listed while you still rent that server. |
| `items[].title` | string | yes | Title of the conversation. Defaults to the first request, at most 80 characters. |
| `items[].model` | string or null | yes | Model used by the latest answer. |
| `items[].message_count` | integer | yes | Number of stored messages. |
| `items[].ai_calls` | integer | yes | AI calls this conversation used; each one counts against your daily quota. |
| `items[].commands` | integer | yes | Shell commands run on the server in this conversation. |
| `items[].awaiting_confirm` | boolean | yes | True when the latest answer ended with a command waiting for your confirmation. |
| `items[].created_at` | integer | yes | Time the conversation was created (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Time of the latest activity (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "ai_calls": 2,
      "awaiting_confirm": false,
      "commands": 1,
      "created_at": 1792399000,
      "id": "ais_9b1d4c0a7e3f5a21c6d8",
      "kind": "vm",
      "message_count": 2,
      "model": "example-model-1",
      "title": "How much disk space is left?",
      "updated_at": 1792399012,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_name": "web-1"
    }
  ],
  "page": 1,
  "per_page": 30,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/chat/agent/sessions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Start an AI SSH Agent conversation for a VM

`POST /v1/chat/agent/sessions`

Starts a new, empty conversation with the AI agent about one of your servers (a VM, or a Bare Metal server by its `ds_…` identifier). The conversation stays bound to that server. It is listed once it has a message; send one with [Send to the AI agent](#operation/agent_session_send). Limited to 30 per minute per account.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `agent session create`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | yes | Server the agent will work on: a VM UUID, or the `ds_…` identifier of a Bare Metal server. |
| `title` | string | no | Title, at most 80 characters. Defaults to the first request you send. |

Example:

```json
{
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Conversation identifier (`ais_…`). |
| `kind` | string: `vm`, `dedicated` | yes | What the conversation works on: a virtual machine (`vm`) or a Bare Metal server (`dedicated`). |
| `vm_id` | string | yes | Server the conversation works on (VM UUID, or `ds_…` for a Bare Metal server). A conversation always stays bound to this server. |
| `vm_name` | string or null | yes | Display name of the server; null when the server no longer belongs to you (deleted or transferred). Such a VM conversation can still be read but not continued. A Bare Metal conversation is only listed while you still rent that server. |
| `title` | string | yes | Title of the conversation. Defaults to the first request, at most 80 characters. |
| `model` | string or null | yes | Model used by the latest answer. |
| `message_count` | integer | yes | Number of stored messages. |
| `ai_calls` | integer | yes | AI calls this conversation used; each one counts against your daily quota. |
| `commands` | integer | yes | Shell commands run on the server in this conversation. |
| `awaiting_confirm` | boolean | yes | True when the latest answer ended with a command waiting for your confirmation. |
| `created_at` | integer | yes | Time the conversation was created (Unix time, seconds, UTC) |
| `updated_at` | integer | yes | Time of the latest activity (Unix time, seconds, UTC) |

Example:

```json
{
  "ai_calls": 0,
  "awaiting_confirm": false,
  "commands": 0,
  "created_at": 1792400000,
  "id": "ais_5d2e8a1c7b3f9046e1a2",
  "kind": "vm",
  "message_count": 0,
  "model": "example-model-1",
  "title": "New chat",
  "updated_at": 1792400000,
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "vm_name": "web-1"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | Bare Metal servers cannot be used from a session a reseller opened on your behalf. |
| 403 | `scope_required` | Bare Metal servers need the `dedicated:console` scope on an API key. |
| 404 | `not_found` | The server does not exist, or it belongs to another account. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/chat/agent/sessions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

#### Get an AI SSH Agent conversation with messages

`GET /v1/chat/agent/sessions/{sid}`

Returns one conversation with its latest 100 messages, oldest first. Command output is stored cut to 16000 characters (stderr 8000). Limited to 120 requests per minute per account. Each answer lists the commands the agent proposed or ran in `meta.steps`; a step with `status: pending` waits for your decision (see [Send to the AI agent](#operation/agent_session_send)). `running` is true while an answer is being produced.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `agent session get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `sid` | string | yes | AI agent conversation identifier (`ais_…`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `session` | AiAgentSession | yes | One AI SSH agent conversation. |
| `session.id` | string | yes | Conversation identifier (`ais_…`). |
| `session.kind` | string: `vm`, `dedicated` | yes | What the conversation works on: a virtual machine (`vm`) or a Bare Metal server (`dedicated`). |
| `session.vm_id` | string | yes | Server the conversation works on (VM UUID, or `ds_…` for a Bare Metal server). A conversation always stays bound to this server. |
| `session.vm_name` | string or null | yes | Display name of the server; null when the server no longer belongs to you (deleted or transferred). Such a VM conversation can still be read but not continued. A Bare Metal conversation is only listed while you still rent that server. |
| `session.title` | string | yes | Title of the conversation. Defaults to the first request, at most 80 characters. |
| `session.model` | string or null | yes | Model used by the latest answer. |
| `session.message_count` | integer | yes | Number of stored messages. |
| `session.ai_calls` | integer | yes | AI calls this conversation used; each one counts against your daily quota. |
| `session.commands` | integer | yes | Shell commands run on the server in this conversation. |
| `session.awaiting_confirm` | boolean | yes | True when the latest answer ended with a command waiting for your confirmation. |
| `session.created_at` | integer | yes | Time the conversation was created (Unix time, seconds, UTC) |
| `session.updated_at` | integer | yes | Time of the latest activity (Unix time, seconds, UTC) |
| `messages` | array of AiAgentMessage | yes |  |
| `messages[].id` | integer | yes | Message identifier. Increases with time. |
| `messages[].role` | string: `user`, `assistant` | yes | Who wrote the message. |
| `messages[].content` | string | yes | Message text. |
| `messages[].meta` | object or null | yes |  |
| `messages[].meta.model` | string | no | Model that produced the answer. |
| `messages[].meta.steps` | array of AiAgentStep | no |  |
| `messages[].meta.awaiting_confirm` | boolean | no | True when the answer ended with a command waiting for your confirmation. |
| `messages[].created_at` | integer | yes | Time the message was stored (Unix time, seconds, UTC) |
| `running` | boolean | yes | True while the agent is answering in this conversation. |

Example:

```json
{
  "messages": [
    {
      "content": "How much disk space is left?",
      "created_at": 1792399000,
      "id": 101,
      "meta": null,
      "role": "user"
    },
    {
      "content": "I will check the free disk space.",
      "created_at": 1792399012,
      "id": 102,
      "meta": {
        "awaiting_confirm": true,
        "model": "example-model-1",
        "steps": [
          {
            "command": "df -h /",
            "id": "call_1",
            "reason": "Check free disk space",
            "status": "pending"
          }
        ]
      },
      "role": "assistant"
    }
  ],
  "running": false,
  "session": {
    "ai_calls": 1,
    "awaiting_confirm": true,
    "commands": 0,
    "created_at": 1792399000,
    "id": "ais_9b1d4c0a7e3f5a21c6d8",
    "kind": "vm",
    "message_count": 2,
    "model": "example-model-1",
    "title": "Disk",
    "updated_at": 1792399012,
    "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "vm_name": "web-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | A Bare Metal conversation cannot be used from a session a reseller opened on your behalf. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/chat/agent/sessions/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rename an AI SSH Agent conversation

`PATCH /v1/chat/agent/sessions/{sid}`

Renames a conversation. Control characters are removed and the title is cut to 80 characters; an empty title fails with `422 invalid_argument`.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `agent session rename`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `sid` | string | yes | AI agent conversation identifier (`ais_…`). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | New title, 1 to 80 characters. |

Example:

```json
{
  "title": "Nginx setup"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Conversation identifier (`ais_…`). |
| `kind` | string: `vm`, `dedicated` | yes | What the conversation works on: a virtual machine (`vm`) or a Bare Metal server (`dedicated`). |
| `vm_id` | string | yes | Server the conversation works on (VM UUID, or `ds_…` for a Bare Metal server). A conversation always stays bound to this server. |
| `vm_name` | string or null | yes | Display name of the server; null when the server no longer belongs to you (deleted or transferred). Such a VM conversation can still be read but not continued. A Bare Metal conversation is only listed while you still rent that server. |
| `title` | string | yes | Title of the conversation. Defaults to the first request, at most 80 characters. |
| `model` | string or null | yes | Model used by the latest answer. |
| `message_count` | integer | yes | Number of stored messages. |
| `ai_calls` | integer | yes | AI calls this conversation used; each one counts against your daily quota. |
| `commands` | integer | yes | Shell commands run on the server in this conversation. |
| `awaiting_confirm` | boolean | yes | True when the latest answer ended with a command waiting for your confirmation. |
| `created_at` | integer | yes | Time the conversation was created (Unix time, seconds, UTC) |
| `updated_at` | integer | yes | Time of the latest activity (Unix time, seconds, UTC) |

Example:

```json
{
  "ai_calls": 1,
  "awaiting_confirm": false,
  "commands": 0,
  "created_at": 1792399000,
  "id": "ais_9b1d4c0a7e3f5a21c6d8",
  "kind": "vm",
  "message_count": 2,
  "model": "example-model-1",
  "title": "Nginx setup",
  "updated_at": 1792399012,
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "vm_name": "web-1"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | A Bare Metal conversation cannot be used from a session a reseller opened on your behalf. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/chat/agent/sessions/<sid>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Nginx setup"}'
```

---

#### Delete an AI SSH Agent conversation (with its command history)

`DELETE /v1/chat/agent/sessions/{sid}`

Deletes a conversation and all its messages, including the record of the commands it ran — so it needs the same `vm:console` scope that runs commands. This cannot be undone. A conversation that is answering right now cannot be deleted (`409 session_busy`).

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `agent session delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `sid` | string | yes | AI agent conversation identifier (`ais_…`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | A Bare Metal conversation cannot be used from a session a reseller opened on your behalf. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `session_busy` | The agent is answering in this conversation right now. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/chat/agent/sessions/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Send to the AI SSH Agent / confirm a command (SSE stream)

`POST /v1/chat/agent/sessions/{sid}/messages`

Sends a request to the AI agent in a conversation, or answers a command that waits for your confirmation. The agent works on the conversation's server over SSH and the conversation history is taken from the server side, so you only send the new message. The response is a stream of server-sent events (`text/event-stream`), the same events as [Run the AI agent](#operation/vm_ai_agent_run), plus `step_skipped`.

Send exactly one of:

- `content`: your request (at most 4000 characters).
- `confirm`: `{"step_id": "…", "action": "run"}` runs the command of that pending step exactly as it was proposed (you cannot change it), then the agent continues; `"action": "skip"` declines it. Only a pending step of the latest answer can be confirmed; otherwise the call fails with `409 step_not_pending`. Declining (`skip`) works even when the server is stopped or locked.

With `auto_execute: true` the agent only runs read-only commands by itself (checking status, reading logs/configuration, network diagnostics), up to 10 steps per request; all commands that modify the server stop for confirmation (`tool_request` has `read_only: false`); commands that look dangerous (deleting or overwriting files, changing accounts or keys, piping downloads into a shell, shutting down or rebooting, connecting to other machines) also carry `risk_code` (`destructive`, `files`, `exfil`, `raw_net`, `auth`, `obfuscated`, `remote_script`, `power_fw`, `pivot`) next to the human-readable `risk_reason`. The pivot check is a warning, not an isolation boundary: the agent can only ever reach this server, but commands it runs there can open connections like any shell. One request at a time per conversation (`409 session_busy`), 2 streaming conversations per account, 20 requests per minute and a daily AI call quota per account (`429 rate_limited`; the quota is shared by VMs and Bare Metal servers). The server must be active and running.

**Bare Metal servers** use the same operation. Their eligibility is checked again on every request and before every command the agent runs (subscription active, server not locked, no operating system install in progress, Linux, powered on, public address valid), including for conversations created earlier; the Bare Metal errors listed below carry the reason. Commands that shut down, reboot, delete data or repartition disks always wait for your confirmation. Output is cleaned of the server's password before it is stored or shown to the AI.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `agent session send`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `sid` | string | yes | AI agent conversation identifier (`ais_…`). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `content` | string | no | Your request to the agent. |
| `confirm` | object | no |  |
| `confirm.step_id` | string | yes | Identifier of the pending step (from `tool_request` or `meta.steps`). |
| `confirm.action` | string: `run`, `skip` | yes | `run` executes the proposed command, `skip` declines it. |
| `auto_execute` | boolean | no | Run read-only commands without asking. Defaults to `false`. |

Example:

```json
{
  "auto_execute": false,
  "content": "How much disk space is left?"
}
```

**Response 200** - Success.

Content type: `text/event-stream`

| Field | Type | Always present | Description |
|---|---|---|---|
| `type` | string: `hello`, `assistant_turn`, `tool_request`, `tool_start`, `tool_result`, `step_skipped`, `error`, `done` | yes | Kind of event; it decides which other fields are present. `step_skipped` only comes from [Send to the AI agent](#operation/agent_session_send) when a pending command is declined. |
| `session_id` | string | no | Conversation identifier. In `hello` and `done`. |
| `content` | string | no | Text of the assistant's answer. In `assistant_turn`. |
| `model` | string | no | Model that produced the answer. In `assistant_turn` and `done`. |
| `id` | string | no | Identifier of the step. In `tool_request`, `tool_start`, `tool_result` and `step_skipped`. |
| `command` | string | no | The shell command. In `tool_request`, `tool_start` and `tool_result`. |
| `reason` | string or null | no | Why the command was chosen. In `tool_request` and `tool_start`. |
| `risk_reason` | string or null | no | Why the command needs confirmation; null when it is not risky. In `tool_request`. |
| `risk_code` | string or null | no | Stable code of the risk (`destructive`, `files`, `exfil`, `raw_net`, `auth`, `obfuscated`, `remote_script`, `power_fw`, `pivot`, `other`); null when not risky. In `tool_request`. |
| `auto_blocked` | boolean | no | True when the command is held back for confirmation because it is risky or not read-only, whatever `auto_execute` says. In `tool_request`. |
| `read_only` | boolean | no | True when the command is on the allowlist of read-only commands permitted for automatic execution (checking status, reading logs and configuration, network diagnostics). In `tool_request`. |
| `ok` | boolean | no | True when the command ran and the connection to the server worked. In `tool_result`. |
| `stdout` | string | no | Standard output of the command. In `tool_result`. |
| `stderr` | string | no | Standard error of the command. In `tool_result`. |
| `exit_code` | integer | no | Exit code of the command; -1 when it could not be run. In `tool_result`. |
| `timed_out` | boolean | no | True when the command was stopped because it ran too long. In `tool_result`. |
| `duration_ms` | integer | no | Run time in milliseconds. In `tool_result`. |
| `error` | string | no | Error text when the command could not be run; empty otherwise. In `tool_result`. |
| `message` | string | no | Human-readable description of the problem. In `error`. |
| `code` | string | no | Machine-readable code, for example `rate_limited` when the daily quota ran out mid-stream. In `error`, when available. |
| `awaiting_confirm` | boolean | no | True when the stream stopped at a command that needs your confirmation. In `done`. |

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | Bare Metal conversations cannot be used from a session a reseller opened on your behalf. |
| 403 | `scope_required` | Bare Metal conversations need the `dedicated:console` scope on an API key. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_running` | The server is not active and running. |
| 409 | `vm_not_agent_ready` | The server cannot be used by the agent (Windows, or no address). |
| 409 | `dedicated_ssh_unsupported` | Bare Metal: the operating system is not Linux. |
| 409 | `dedicated_installing` | Bare Metal: an operating system install is in progress. |
| 409 | `dedicated_powered_off` | Bare Metal: the server is powered off. |
| 409 | `dedicated_no_ip` | Bare Metal: the server has no usable public address. |
| 409 | `session_busy` | The agent is already answering in this conversation. |
| 409 | `step_not_pending` | The step is not waiting for confirmation (already run, skipped, or a newer answer exists). |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason`, `destroy_after` and `locked_at`. |
| 423 | `dedicated_server_locked` | Bare Metal: the server is locked. |
| 423 | `dedicated_suspended` | Bare Metal: the subscription is suspended. |
| 503 | `feature_disabled` | The AI agent is switched off for this site. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/chat/agent/sessions/<sid>/messages" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_execute":false,"content":"How much disk space is left?"}'
```

---

#### List active SSH session share links

`GET /v1/vm/{id}/console-shares`

Lists the share links of the server that are still active (not revoked and not expired), newest first, at most 20. A share link lets someone else open the server's SSH terminal without an account. Each link carries its `token` and `websocket_url` only when the caller may use the terminal, which is the case for a signed-in session and for keys with the `vm:console` scope; keys with only `vm:read` see the links without tokens.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm console-share list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `shares` | array of ConsoleShare | yes |  |
| `shares[].id` | string | yes | Share link identifier. Pass it to [Revoke a share link](#operation/vm_console_share_revoke). |
| `shares[].mode` | string: `ro`, `rw` | yes | `ro` lets the viewer watch only; `rw` lets the viewer type into the terminal. |
| `shares[].variant` | string: `shared`, `isolated` | yes | `shared` attaches the viewer to the same terminal session you use; `isolated` gives the viewer a separate session. |
| `shares[].label` | string or null | yes | Label you gave the link. |
| `shares[].expires_at` | integer | yes | Time the link stops working (Unix time, seconds, UTC) |
| `shares[].created_at` | integer | yes | Time the link was created (Unix time, seconds, UTC) |
| `shares[].token` | string | no | Secret token of the link. Only returned when the caller may use the terminal (a signed-in session, or a key with the `vm:console` scope); a key with only `vm:read` sees the link without its token. |
| `shares[].websocket_url` | string | no | WebSocket address to connect to together with the token. Returned together with `token`. |

Example:

```json
{
  "shares": [
    {
      "created_at": 1792400000,
      "expires_at": 1792403600,
      "id": "shr_7a3e9c1b5d2f4e60",
      "label": "Support session",
      "mode": "ro",
      "token": "ofw_shr_2c4e6a8b0d1f3957a1b3c5d7e9f02468",
      "variant": "shared",
      "websocket_url": "wss://cloud.example.com/ssh-ws"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/console-shares" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create an SSH session share link

`POST /v1/vm/{id}/console-shares`

Creates a share link for the server's SSH terminal. The viewer connects to the returned `websocket_url` with `?mode=share&token=<token>` appended, with no account or password. Anyone holding the token can use the link until it expires or you revoke it with [Revoke a share link](#operation/vm_console_share_revoke), so share it only with people you trust, and use `ro` unless the viewer must type.

Send a JSON body (`{}` is enough). Unknown `mode` or `variant` values fall back to `ro` and `shared`; `ttl_minutes` is clamped to 15 through 1440 (default 60). A server can have at most 5 active links. The link is created even if the server is not running; it only works while the server is.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm console-share create`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `mode` | string: `ro`, `rw` | no | `ro` (default): the viewer can only watch. `rw`: the viewer can also type. |
| `variant` | string: `shared`, `isolated` | no | `shared` (default): the viewer joins the terminal session you use. `isolated`: the viewer gets a separate session. |
| `ttl_minutes` | integer | no | Lifetime of the link in minutes, 15 to 1440. Defaults to 60. |
| `label` | string | no | Free-text label to recognise the link, at most 80 characters. |

Example:

```json
{
  "label": "Support session",
  "mode": "ro",
  "ttl_minutes": 60,
  "variant": "shared"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Share link identifier. Pass it to [Revoke a share link](#operation/vm_console_share_revoke). |
| `token` | string | yes | Secret token of the link. |
| `mode` | string: `ro`, `rw` | yes | Access mode granted. |
| `variant` | string: `shared`, `isolated` | yes | Session variant. |
| `tmux_session` | string | yes | Name of the terminal multiplexer session the link attaches to. |
| `label` | string or null | yes | Label you gave the link. |
| `expires_at` | integer | yes | Time the link stops working (Unix time, seconds, UTC) |
| `created_at` | integer | yes | Time the link was created (Unix time, seconds, UTC) |
| `websocket_url` | string | yes | WebSocket address to connect to together with the token. |

Example:

```json
{
  "created_at": 1792400000,
  "expires_at": 1792403600,
  "id": "shr_7a3e9c1b5d2f4e60",
  "label": "Support session",
  "mode": "ro",
  "tmux_session": "term-1042-3f6c1d0e",
  "token": "ofw_shr_2c4e6a8b0d1f3957a1b3c5d7e9f02468",
  "variant": "shared",
  "websocket_url": "wss://cloud.example.com/ssh-ws"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `limit_reached` | The server already has 5 active share links. Revoke one first. |
| 423 | `vm_locked` | The server is locked, for example because the wallet ran out of funds. The error carries `reason` (`no_funds`, `expired`, `admin` or `abuse`), `destroy_after` and `locked_at` (Unix time). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/console-shares" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"Support session","mode":"ro","ttl_minutes":60,"variant":"shared"}'
```

---

#### Revoke an SSH session share link

`DELETE /v1/vm/{id}/console-shares/{sid}`

Revokes a share link immediately: its token stops working for new connections. A link that is unknown, already revoked or belongs to another server answers `404`. Links also stop working on their own when they expire.

**Required scope:** `vm:console`.

Scope: `vm:console` | CLI: `vm console-share revoke` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `sid` | string | yes | Share link identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist, is not yours, or has no active share link with this identifier. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/console-shares/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

### SSH Keys

SSH public keys stored in your account. Only the public half is stored here, so nothing secret is ever returned. Attach a stored key to a server with [Attach an SSH key to the VM](#operation/vm_ssh_key_attach), or choose one when you create a server. An account can store at most 20 keys.

#### List SSH keys

`GET /v1/vm/sshkeys`

Lists the SSH public keys stored in your account, oldest first. The list is not paginated because an account holds at most 20 keys.

**Required scope:** `sshkey:read`.

Scope: `sshkey:read` | CLI: `ssh-key list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of SshKey | yes |  |
| `items[].id` | integer | yes | SSH key identifier. Use it to attach or delete the key. |
| `items[].name` | string | yes | Name you gave the key. |
| `items[].fingerprint` | string | yes | SHA-256 fingerprint of the key in the form `SHA256:<base64>`, the same format `ssh-keygen -l` prints. |
| `items[].public_key` | string | yes | The public key in OpenSSH format: `<type> <base64> [comment]`. |
| `items[].created_at` | integer | yes | Time the key was added (Unix time, seconds, UTC) |
| `items[].type` | string: `ssh-ed25519`, `ssh-rsa` | yes | Key algorithm. |

Example:

```json
{
  "items": [
    {
      "created_at": 1792300000,
      "fingerprint": "SHA256:Qm9ndXNGaW5nZXJwcmludEV4YW1wbGVPbmx5MDEyMzQ",
      "id": 12,
      "name": "laptop",
      "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrJvc3RhcmV4YW1wbGVrZXlvbmx5MDEyMzQ1Njc4OQ laptop",
      "type": "ssh-ed25519"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/vm/sshkeys" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add an SSH key

`POST /v1/vm/sshkeys`

Stores an SSH public key in your account so you can attach it to servers. Paste the contents of the `.pub` file as `public_key`. Only `ssh-ed25519` and `ssh-rsa` keys are accepted; other types (for example `ecdsa-sha2-nistp256`) are rejected. The key is checked structurally, and its fingerprint must be new to your account.

The key is only stored; it is not installed on any server until you attach it. Returns `201` with the stored key.

**Required scope:** `sshkey:write`.

Scope: `sshkey:write` | CLI: `ssh-key add`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Name to recognise the key by, 1 to 60 characters (control characters are removed). |
| `public_key` | string | yes | The public key in OpenSSH format, at most 16 KiB: `ssh-ed25519 AAAA... comment` or `ssh-rsa AAAA... comment`. |

Example:

```json
{
  "name": "laptop",
  "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrJvc3RhcmV4YW1wbGVrZXlvbmx5MDEyMzQ1Njc4OQ laptop"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | SshKey | yes |  |
| `key.id` | integer | yes | SSH key identifier. Use it to attach or delete the key. |
| `key.name` | string | yes | Name you gave the key. |
| `key.fingerprint` | string | yes | SHA-256 fingerprint of the key in the form `SHA256:<base64>`, the same format `ssh-keygen -l` prints. |
| `key.public_key` | string | yes | The public key in OpenSSH format: `<type> <base64> [comment]`. |
| `key.created_at` | integer | yes | Time the key was added (Unix time, seconds, UTC) |
| `key.type` | string: `ssh-ed25519`, `ssh-rsa` | yes | Key algorithm. |

Example:

```json
{
  "key": {
    "created_at": 1792300000,
    "fingerprint": "SHA256:Qm9ndXNGaW5nZXJwcmludEV4YW1wbGVPbmx5MDEyMzQ",
    "id": 12,
    "name": "laptop",
    "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrJvc3RhcmV4YW1wbGVrZXlvbmx5MDEyMzQ1Njc4OQ laptop",
    "type": "ssh-ed25519"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or has a field of the wrong type. The error carries a `detail`. |
| 409 | `invalid_argument` | A key with the same fingerprint is already stored in your account (`detail` = `duplicate_key`). |
| 422 | `invalid_argument` | `name` is missing or empty. The error carries `field` = `name`. |
| 422 | `invalid_key` | `public_key` is not a valid `ssh-ed25519` or `ssh-rsa` key. The error carries a `detail` such as `type`, `base64`, `blob`, `type_mismatch`, `ed25519_len` or `rsa_short`. |
| 422 | `too_many_keys` | Your account already stores the maximum of 20 keys. Delete one first. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/sshkeys" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"laptop","public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOrJvc3RhcmV4YW1wbGVrZXlvbmx5MDEyMzQ1Njc4OQ laptop"}'
```

---

#### Delete an SSH key

`DELETE /v1/vm/sshkeys/{id}`

Deletes a stored SSH key. Servers that already use the key keep working and keep the key installed; only the stored copy is removed, so you can no longer attach it to other servers. Deleting a key that does not exist, or was already deleted, answers `404`.

**Required scope:** `sshkey:write`.

Scope: `sshkey:write` | CLI: `ssh-key delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | SSH key identifier as returned by List SSH keys. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/sshkeys/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Billing

Read-only access to your wallet, invoices, payments, orders and current usage. Money can only be added, and payment methods only be changed, from the dashboard; no API key can do it. Unless a field says otherwise, amounts are integers in US cents (`*_cents`). Prices per hour are given in millionths of a dollar (`*_uusd*`) or thousandths of a dollar (`*_mills*`).

#### Wallet balance

`GET /v1/billing/wallet`

Returns your wallet balance and its transaction history, newest first by default. The wallet is a prepaid balance in US cents: top-ups and refunds add to it, server charges take from it. The balance can be negative after an overdraft or a correction by support.

The top-up limits and the stored-card label are informational; money can only be added from the dashboard.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing wallet`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Entries per page. Values above 100 are clamped to 100. |
| `sort` | string: `at`, `kind`, `delta_cents`, `vm_id`, `id` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `sign` | string: `in`, `out` | no | Only money added (`in`, positive `delta_cents`) or only money spent (`out`, negative). Omit for both. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `balance_cents` | integer | yes | Current wallet balance in US cents. |
| `ledger` | array of WalletEntry | yes |  |
| `ledger[].id` | integer | yes | Entry identifier. Increases with time. |
| `ledger[].account_id` | integer | yes | Your account identifier. |
| `ledger[].delta_cents` | integer | yes | Change of the balance in US cents: positive when money was added, negative when it was spent. |
| `ledger[].kind` | string: `deposit`, `charge`, `refund`, `adjust` | yes | `deposit`: money added. `charge`: money spent. `refund`: money returned. `adjust`: a correction made by support. |
| `ledger[].ref` | string | yes | Unique reference of the transaction, for example `vm:new:<server id>`. Invoices link to it through `ledger_ref`. |
| `ledger[].vm_id` | string or null | yes | Server the entry is about, when it is about one. |
| `ledger[].note` | string or null | yes | Free-text note. |
| `ledger[].actor` | string | yes | Who or what created the entry, for example `customer:<account id>` or `system:<task>`. |
| `ledger[].at` | integer | yes | Time of the entry (Unix time, seconds, UTC) |
| `ledger[].balance_after` | integer or null | yes | Wallet balance in US cents right after this entry. |
| `ledger[].service` | string | yes | Product the entry belongs to, derived from `ref` (for example `vm`, `vpn`, `deposit`, `refund_out`, `other`). |
| `ledger[].invoice_id` | integer or null | yes | Invoice whose `ledger_ref` equals this entry's `ref`, when there is one. |
| `total` | integer | yes | Total number of entries, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied. |
| `sort` | string | yes | The `sort` value you sent, or `id` when you sent none. |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |
| `min_topup_cents` | integer | yes | Smallest top-up the site accepts, in US cents. |
| `max_topup_cents` | integer | yes | Largest top-up the site accepts, in US cents. |
| `topup_fee_gross_up` | boolean | yes | True when the processing fee is added on top of the top-up amount instead of being deducted from it. |
| `card` | string or null | yes | Label of the stored card, for example `Visa ending 4242`; null when none is stored. |
| `autotopup_enabled` | boolean | yes | Whether automatic top-up is switched on. |

Example:

```json
{
  "autotopup_enabled": false,
  "balance_cents": 750,
  "card": null,
  "dir": "desc",
  "ledger": [
    {
      "account_id": 1042,
      "actor": "customer:1042",
      "at": 1792390000,
      "balance_after": 750,
      "delta_cents": -250,
      "id": 2,
      "kind": "charge",
      "note": "New server web-1",
      "ref": "vm:new:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    },
    {
      "account_id": 1042,
      "actor": "system:payment",
      "at": 1792380000,
      "balance_after": 1000,
      "delta_cents": 1000,
      "id": 1,
      "kind": "deposit",
      "note": "Top-up",
      "ref": "dep:stripe:pi_example",
      "vm_id": null
    }
  ],
  "max_topup_cents": 500000,
  "min_topup_cents": 1000,
  "page": 1,
  "per_page": 50,
  "sort": "id",
  "topup_fee_gross_up": false,
  "total": 2
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/wallet" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Billing overview

`GET /v1/billing/summary`

Returns an overview of your spending: balance, what has been charged this month, what is overdue, and how fast running hourly servers burn through the wallet. It also carries the site's top-up limits, fee schedule and exchange rate, which the dashboard uses to render the top-up form; they are informational here.

"This month" is the calendar month in UTC+7. `accruing_cents` counts wallet charges since its start; `outstanding_cents` adds unpaid invoices and any negative balance. The burn rate only counts hourly servers that are running.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing summary`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `balance_cents` | integer | yes | Wallet balance in US cents; negative when you owe money. |
| `pending_topup_cents` | integer | yes | Credit of card and PayPal top-ups that were started but are not completed yet, in US cents. |
| `accruing_cents` | integer | yes | Wallet charges since the start of the current month, in US cents. |
| `outstanding_cents` | integer | yes | Unpaid and overdue invoices plus any negative balance, in US cents. |
| `expenses_cents` | integer | yes | `accruing_cents` plus `outstanding_cents`. |
| `spending_cents` | integer | yes | Money available to spend: the positive part of the balance plus pending top-ups, in US cents. |
| `cycle` | object | yes |  |
| `cycle.ym` | string | yes | Current month as `YYYY-MM` (UTC+7). |
| `cycle.from` | integer | yes | Start of the month (Unix time, seconds, UTC) |
| `cycle.to` | integer | yes | End of the measured period (now) (Unix time, seconds, UTC) |
| `cycle.charges_cents` | integer | yes | Wallet charges within the period, in US cents. |
| `updated_at` | integer | yes | Time the figures were computed (Unix time, seconds, UTC) |
| `burn_mills_per_hour` | integer | yes | What running hourly servers cost per hour, in thousandths of a US dollar. Rounded down; prefer `burn_uusd_per_hour`. |
| `burn_uusd_per_hour` | integer | yes | What running hourly servers cost per hour, in millionths of a US dollar. |
| `fee` | object | yes | Card processing fee: `pct` (percent), `fixed_cents` and `gross_up`. Kept for older clients; see `fees`. |
| `fees` | object | yes | Fee schedule per payment channel (`card`, `alipay`, `paypal`, `usdt`, `sepay`), each with `pct` and `fixed_cents`, plus the top-level `gross_up` flag. The set of channels depends on the site. |
| `min_topup_cents` | integer | yes | Smallest top-up the site accepts, in US cents. |
| `max_topup_cents` | integer | yes | Largest top-up the site accepts, in US cents. |
| `quick_amounts` | array of integer | yes | Suggested top-up amounts in US cents. |
| `promo` | object | yes |  |
| `promo.service_credit_cents` | integer | yes | Total promotional service credit still available, in US cents. Not part of the wallet balance. |
| `promo.service_credits` | array of object | yes |  |
| `promo.service_credits[].id` | integer | yes | Credit pot id. |
| `promo.service_credits[].services` | array of string | yes |  |
| `promo.service_credits[].total_cents` | integer | yes | Amount granted, in US cents. |
| `promo.service_credits[].left_cents` | integer | yes | Amount still available, in US cents. |
| `promo.service_credits[].expires_at` | integer | yes | Unix time the credit expires. |
| `promo.service_credits[].name` | string | yes | Campaign name. |
| `promo.promos` | array of object | yes |  |
| `promo.promos[].id` | integer | yes | Active discount id. |
| `promo.promos[].services` | array of string | yes |  |
| `promo.promos[].percent` | integer | yes | Discount percentage applied to the next eligible charge of the service. |
| `promo.promos[].max_discount_cents` | integer | yes | Discount cap in US cents. |
| `promo.promos[].min_order_cents` | integer | yes | Smallest charge the discount applies to, in US cents (0 = none). |
| `promo.promos[].expires_at` | integer | yes | Unix time the discount expires. |
| `promo.promos[].name` | string | yes | Campaign name. |
| `min_balance_cents` | integer | yes | Minimum balance a site requires to create a server, in US cents. |
| `trial` | object or null | yes | Trial credit of this account — same object as [Get trial credit](#operation/billing_trial_get) (`status`, `amount_cents`, `left_cents`, …). `null` when the account has none to show (not a new customer, or the credit is used up or expired). |
| `paypal_allowed` | boolean | yes | False until the account has a first real top-up through another channel; PayPal is then hidden and refused. |
| `fx` | object | yes |  |
| `fx.usd_vnd` | integer | yes | Exchange rate used to show Vietnamese dong prices, VND per US dollar; 0 when none is set. |
| `fx.source` | string | yes | Where the rate comes from. |
| `fx.vcb_sell` | integer | yes | Reference selling rate, VND per US dollar. |
| `fx.vcb_at` | integer | yes | Time of the reference rate (Unix time, seconds, UTC) |
| `fx.updated_at` | integer | yes | Time the exchange rate was last updated (Unix time, seconds, UTC) |
| `fx.margin_bp` | integer | yes | Margin added to the reference rate, in basis points. |
| `fx.stale` | boolean | yes | True when the rate has not been refreshed recently. |
| `fx.round_step` | integer | yes | Amounts in dong are rounded to a multiple of this. |
| `sepay` | object | yes |  |
| `sepay.min_vnd` | integer | yes | Smallest bank-transfer top-up, in dong. |
| `sepay.max_vnd` | integer | yes | Largest bank-transfer top-up, in dong. |
| `sepay.round_step` | integer | yes | Bank-transfer amounts are rounded to a multiple of this, in dong. |
| `sepay.expire_minutes` | integer | yes | Minutes a bank-transfer top-up request stays open. |
| `quick_amounts_vnd` | array of integer | yes | Suggested bank-transfer top-up amounts in dong. |
| `pending_sepay` | array of object | yes | Bank-transfer top-up requests that are still open (at most 5, newest first). |
| `pending_sepay[].payment_id` | integer | yes | Payment identifier. |
| `pending_sepay[].credit_cents` | integer | yes | Amount that will be added to the wallet, in US cents. |
| `pending_sepay[].amount_vnd` | integer or null | yes | Amount to transfer, in dong. |
| `pending_sepay[].code` | string or null | yes | Transfer reference to write in the bank transfer. |
| `pending_sepay[].expires_at` | integer or null | yes | Time the request expires (Unix time, seconds, UTC) |
| `pending_sepay[].created_at` | integer | yes | Time the request was created (Unix time, seconds, UTC) |

Example:

```json
{
  "accruing_cents": 250,
  "balance_cents": 750,
  "burn_mills_per_hour": 7,
  "burn_uusd_per_hour": 7000,
  "cycle": {
    "charges_cents": 250,
    "from": 1790960400,
    "to": 1792400000,
    "ym": "2026-10"
  },
  "expenses_cents": 250,
  "fee": {
    "fixed_cents": 30,
    "gross_up": false,
    "pct": 2.9
  },
  "fees": {
    "card": {
      "fixed_cents": 30,
      "gross_up": false,
      "owner": 0,
      "pct": 2.9
    },
    "gross_up": false,
    "sepay": {
      "fixed_cents": 0,
      "pct": 0.0
    }
  },
  "fx": {
    "margin_bp": 0,
    "round_step": 1000,
    "source": "reference",
    "stale": false,
    "updated_at": 1792380000,
    "usd_vnd": 26000,
    "vcb_at": 1792380000,
    "vcb_sell": 26050
  },
  "max_topup_cents": 500000,
  "min_balance_cents": 500,
  "min_topup_cents": 1000,
  "outstanding_cents": 0,
  "paypal_allowed": false,
  "pending_sepay": [],
  "pending_topup_cents": 0,
  "promo": {
    "promos": [],
    "service_credit_cents": 50,
    "service_credits": [
      {
        "expires_at": 1793000000,
        "id": 3,
        "left_cents": 50,
        "name": "VPN launch",
        "services": [
          "vpn"
        ],
        "total_cents": 500
      }
    ]
  },
  "quick_amounts": [
    1000,
    2500,
    5000,
    10000,
    20000,
    40000
  ],
  "quick_amounts_vnd": [
    100000,
    200000,
    500000,
    1000000,
    2000000,
    5000000
  ],
  "sepay": {
    "expire_minutes": 120,
    "max_vnd": 200000000,
    "min_vnd": 10000,
    "round_step": 1000
  },
  "spending_cents": 750,
  "trial": {
    "activated_at": null,
    "amount_cents": 10000,
    "claimable": false,
    "code": "TRIAL-7K3M-9QXW",
    "days": 30,
    "enabled": true,
    "expires_at": null,
    "forfeit_cents": 0,
    "left_cents": 0,
    "min_deposit_cents": 1000,
    "orders": [],
    "paypal_allowed": false,
    "services": [
      "vm",
      "vpn4",
      "vpn6"
    ],
    "status": "pending",
    "used_cents": 0
  },
  "updated_at": 1792400000
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/summary" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Trial credit of your account

`GET /v1/billing/trial`

Returns the trial credit of your account. New accounts get one trial credit that starts as `pending` and becomes `active` when the first real top-up of at least `min_deposit_cents` is credited and the email is verified. While `active` it pays, before the wallet, for exactly one Cloud VM billed hourly in a Vietnam zone (a plan whose 30-day (720 h) price is covered by your real top-ups; the credit never pays more per hour than that plan), one VPN / Proxy IPv4 order and one IPv6 Proxy order on the 1-day plan; any other cycle (monthly or longer) and every other service is paid from the wallet — orders are never blocked, they simply do not use the credit. If the top-up that activated it is refunded or disputed, the remaining credit is revoked. It cannot be withdrawn or transferred and expires after `days`. `status` is `none` (not claimed yet), `pending`, `active`, `used_up`, `expired`. Sites run by a reseller always return `enabled: false`.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing trial get`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the trial program is on for this site. |
| `claimable` | boolean | yes | True when the account has no trial credit yet and can still claim one. |
| `status` | string: `none`, `pending`, `active`, `used_up`, `expired` | yes | State of the trial credit. |
| `code` | string | yes | Private identifier of the credit (only when one exists). |
| `amount_cents` | integer | yes | Trial credit granted, in US cents. |
| `days` | integer | yes | Days the credit stays valid after activation. |
| `min_deposit_cents` | integer | yes | Smallest real top-up that activates the credit, in US cents. |
| `services` | array of string: `vm`, `vpn4`, `vpn6` | yes |  |
| `activated_at` | integer or null | yes | Time the credit became active (Unix time, seconds, UTC) |
| `expires_at` | integer or null | yes | Time the credit expires (Unix time, seconds, UTC) |
| `used_cents` | integer | yes | Amount spent from the credit so far, in US cents. |
| `left_cents` | integer | yes | Amount still available, in US cents (0 unless `active`). |
| `forfeit_cents` | integer | yes | Amount that expired unused, in US cents. |
| `orders` | array of object | yes |  |
| `orders[].service` | string | yes | `vm`, `vpn4` or `vpn6`. |
| `orders[].order` | string | yes | Identifier of the order that uses the credit. |
| `paypal_allowed` | boolean | yes | False until the account has a first real top-up through another channel. |

Example:

```json
{
  "activated_at": 1792390000,
  "amount_cents": 10000,
  "claimable": false,
  "code": "TRIAL-7K3M-9QXW",
  "days": 30,
  "enabled": true,
  "expires_at": 1794982000,
  "forfeit_cents": 0,
  "left_cents": 5500,
  "min_deposit_cents": 1000,
  "orders": [
    {
      "order": "0b6a1d52-3c1e-4a7e-9a52-4f2f4d6e8a10",
      "service": "vm"
    }
  ],
  "paypal_allowed": true,
  "services": [
    "vm",
    "vpn4",
    "vpn6"
  ],
  "status": "active",
  "used_cents": 500
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/trial" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Trial program (public)

`GET /v1/public/trial`

Public description of the trial credit program shown on the website: amount, validity, the top-up that activates it and the services it covers. No sign-in needed. Sites run by a reseller return `enabled: false`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `public trial`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the program is on. |
| `amount_cents` | integer | yes | Trial credit, in US cents. |
| `days` | integer | yes | Validity after activation, in days. |
| `min_deposit_cents` | integer | yes | Smallest real top-up that activates it, in US cents. |
| `services` | array of string: `vm`, `vpn4`, `vpn6` | yes |  |
| `fx` | object | yes | Public display exchange rates (same object as `settings.fx` of the public price list) so the amount can be shown in the visitor's currency; amounts stay in US cents. |

Example:

```json
{
  "amount_cents": 10000,
  "days": 30,
  "enabled": true,
  "fx": {
    "usd_vnd": 26210
  },
  "min_deposit_cents": 1000,
  "services": [
    "vm",
    "vpn4",
    "vpn6"
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/public/trial" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List invoices

`GET /v1/billing/invoices`

Lists your invoices: receipts for purchases, renewals, top-ups, refunds and manual invoices. The list also includes invoices issued to the previous owner of a server that was transferred to you; those are marked `previous_owner` and have their buyer details hidden. Use [Get an invoice](#operation/billing_invoice_get) for the line items.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing invoice list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Invoices per page. Values above 100 are clamped to 100. |
| `status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | no | Only invoices with this status. |
| `sort` | string: `created_at`, `number`, `kind`, `status`, `due_at`, `paid_at`, `total_cents`, `vm_id`, `id` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Invoice | yes |  |
| `items[].id` | integer | yes | Invoice identifier. |
| `items[].number` | string or null | yes | Invoice number shown on the document, for example `EX202610-000123`. |
| `items[].account_id` | integer or null | yes | Your account identifier. Null on invoices issued to a previous owner of a server that was transferred to you. |
| `items[].vm_id` | string or null | yes | Server the invoice is about, when it is about one. |
| `items[].kind` | string: `receipt`, `renewal`, `topup`, `manual`, `refund` | yes | `receipt`: a purchase or change paid from the wallet. `renewal`: an automatic renewal. `topup`: a wallet top-up. `manual`: an invoice issued by support. `refund`: a refund. |
| `items[].status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | yes | Payment status. |
| `items[].subtotal_cents` | integer | yes | Sum of the line items, in US cents. |
| `items[].total_cents` | integer | yes | Amount of the invoice, in US cents. |
| `items[].currency` | string | yes | Currency of the amounts. Always `usd`. |
| `items[].due_at` | integer or null | yes | Payment due date (Unix time, seconds, UTC) |
| `items[].paid_at` | integer or null | yes | Time the invoice was paid (Unix time, seconds, UTC) |
| `items[].ledger_ref` | string or null | yes | Reference of the wallet transaction that paid or refunded the invoice; matches `ref` in [Get the wallet](#operation/billing_wallet). |
| `items[].seller_json` | string | yes | Seller details as a JSON-encoded string: `name`, `address`, `tax_id`, `email`. The single-invoice operation also returns it parsed, as `seller`. |
| `items[].buyer_json` | string | yes | Buyer details as a JSON-encoded string: `account_id`, `email`, `name`. The single-invoice operation also returns it parsed, as `buyer`. |
| `items[].note` | string or null | yes | Free-text note on the invoice. Null on invoices issued to a previous owner. |
| `items[].created_at` | integer | yes | Time the invoice was created (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Time the invoice was last changed (Unix time, seconds, UTC) |
| `items[].balance_after` | integer or null | yes | Wallet balance in US cents right after the transaction that paid this invoice; null when the invoice was not paid from the wallet. |
| `items[].previous_owner` | boolean | no | Present and true on invoices issued to a previous owner of a server that was transferred to you. Their buyer details are hidden. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | The `sort` value you sent, or `id` when you sent none. |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "account_id": 1042,
      "balance_after": 750,
      "buyer_json": "{\"account_id\":1042,\"email\":\"user@example.com\",\"name\":\"Example User\"}",
      "created_at": 1792390000,
      "currency": "usd",
      "due_at": null,
      "id": 311,
      "kind": "receipt",
      "ledger_ref": "vm:new:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "note": null,
      "number": "EX202610-000311",
      "paid_at": 1792390000,
      "seller_json": "{\"name\":\"Example Cloud\",\"address\":\"\",\"tax_id\":\"\",\"email\":\"billing@example.com\"}",
      "status": "paid",
      "subtotal_cents": 250,
      "total_cents": 250,
      "updated_at": 1792390000,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "page": 1,
  "per_page": 25,
  "sort": "id",
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/invoices" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one invoice

`GET /v1/billing/invoices/{id}`

Returns one invoice with its line items and the seller and buyer details parsed into objects. An invoice that belongs to another account answers `404`, except invoices issued to the previous owner of a server that was transferred to you, which are returned with the buyer details hidden and `previous_owner` set to true.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing invoice get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Invoice identifier as returned by List invoices. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Invoice identifier. |
| `number` | string or null | yes | Invoice number shown on the document, for example `EX202610-000123`. |
| `account_id` | integer or null | yes | Your account identifier. Null on invoices issued to a previous owner of a server that was transferred to you. |
| `vm_id` | string or null | yes | Server the invoice is about, when it is about one. |
| `kind` | string: `receipt`, `renewal`, `topup`, `manual`, `refund` | yes | `receipt`: a purchase or change paid from the wallet. `renewal`: an automatic renewal. `topup`: a wallet top-up. `manual`: an invoice issued by support. `refund`: a refund. |
| `status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | yes | Payment status. |
| `subtotal_cents` | integer | yes | Sum of the line items, in US cents. |
| `total_cents` | integer | yes | Amount of the invoice, in US cents. |
| `currency` | string | yes | Currency of the amounts. Always `usd`. |
| `due_at` | integer or null | yes | Payment due date (Unix time, seconds, UTC) |
| `paid_at` | integer or null | yes | Time the invoice was paid (Unix time, seconds, UTC) |
| `ledger_ref` | string or null | yes | Reference of the wallet transaction that paid or refunded the invoice; matches `ref` in [Get the wallet](#operation/billing_wallet). |
| `seller_json` | string | yes | Seller details as a JSON-encoded string: `name`, `address`, `tax_id`, `email`. The single-invoice operation also returns it parsed, as `seller`. |
| `buyer_json` | string | yes | Buyer details as a JSON-encoded string: `account_id`, `email`, `name`. The single-invoice operation also returns it parsed, as `buyer`. |
| `note` | string or null | yes | Free-text note on the invoice. Null on invoices issued to a previous owner. |
| `created_at` | integer | yes | Time the invoice was created (Unix time, seconds, UTC) |
| `updated_at` | integer | yes | Time the invoice was last changed (Unix time, seconds, UTC) |
| `previous_owner` | boolean | no | Present and true on invoices issued to a previous owner of a server that was transferred to you. Their buyer details are hidden. |
| `seller` | object or null | yes |  |
| `seller.name` | string | no | Seller name. |
| `seller.address` | string | no | Seller address. |
| `seller.tax_id` | string | no | Seller tax identifier. |
| `seller.email` | string | no | Seller contact e-mail. |
| `seller.processor` | object | no | Payment processor details (`name`, `note`), present when payments are collected by a platform on the seller's behalf. |
| `buyer` | object or null | yes |  |
| `buyer.account_id` | integer | no | Buyer account identifier. |
| `buyer.email` | string | no | Buyer e-mail. |
| `buyer.name` | string | no | Buyer name. |
| `buyer.redacted` | boolean | no | True when the buyer details are hidden because the invoice belongs to a previous owner. |
| `items` | array of InvoiceItem | yes |  |
| `items[].id` | integer | yes | Line item identifier. |
| `items[].invoice_id` | integer | yes | Invoice the line belongs to. |
| `items[].description` | string | yes | What was charged. |
| `items[].qty` | number | yes | Quantity. |
| `items[].unit_cents` | integer | yes | Price of one unit, in US cents. |
| `items[].amount_cents` | integer | yes | Amount of the line, in US cents. |
| `items[].period_from` | integer or null | yes | Start of the period the line covers (Unix time, seconds, UTC) |
| `items[].period_to` | integer or null | yes | End of the period the line covers (Unix time, seconds, UTC) |
| `total` | string | yes | `total_cents` formatted for display in US dollars, for example `$5.00`. |
| `fx_usd_vnd` | integer | yes | Exchange rate (VND per US dollar) recorded when the invoice was issued; 0 when none was recorded. |
| `received_vnd` | integer or null | yes | Amount received in Vietnamese dong, for top-ups paid by bank transfer; null otherwise. |

Example:

```json
{
  "account_id": 1042,
  "buyer": {
    "account_id": 1042,
    "email": "user@example.com",
    "name": "Example User"
  },
  "buyer_json": "{\"account_id\":1042,\"email\":\"user@example.com\",\"name\":\"Example User\"}",
  "created_at": 1792390000,
  "currency": "usd",
  "due_at": null,
  "fx_usd_vnd": 0,
  "id": 311,
  "items": [
    {
      "amount_cents": 250,
      "description": "Server web-1 (1 vCPU, 2 GB RAM, 25 GB disk), first hour",
      "id": 411,
      "invoice_id": 311,
      "period_from": null,
      "period_to": null,
      "qty": 1.0,
      "unit_cents": 250
    }
  ],
  "kind": "receipt",
  "ledger_ref": "vm:new:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "note": null,
  "number": "EX202610-000311",
  "paid_at": 1792390000,
  "received_vnd": null,
  "seller": {
    "address": "",
    "email": "billing@example.com",
    "name": "Example Cloud",
    "tax_id": ""
  },
  "seller_json": "{\"name\":\"Example Cloud\",\"address\":\"\",\"tax_id\":\"\",\"email\":\"billing@example.com\"}",
  "status": "paid",
  "subtotal_cents": 250,
  "total": "$2.50",
  "total_cents": 250,
  "updated_at": 1792390000,
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/billing/invoices/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Payment history

`GET /v1/billing/payments`

Lists the payments made into your wallet: top-ups (started by you or automatic) and refunds, newest first by default. A payment adds to the wallet only once its status is `completed`; `pending` ones are still waiting for the payment channel. To see what was spent, use [Get the wallet](#operation/billing_wallet) or [List orders](#operation/billing_order_list).

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing payment list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Payments per page. Values above 100 are clamped to 100. |
| `status` | string: `pending`, `completed`, `failed`, `refunded`, `disputed`, `canceled` | no | Only payments with this status. |
| `gateway` | string: `stripe`, `paypal`, `binance` | no | Only payments handled by this payment channel. Other values are ignored. |
| `sort` | string: `created_at`, `completed_at`, `amount_cents`, `credit_cents`, `kind`, `status`, `id`, `gateway`, `method` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of PaymentRecord | yes |  |
| `items[].id` | integer | yes | Payment identifier. |
| `items[].kind` | string: `topup`, `autotopup`, `refund` | yes | `topup`: a top-up you started. `autotopup`: an automatic top-up. `refund`: money returned. |
| `items[].status` | string: `pending`, `completed`, `failed`, `refunded`, `disputed`, `canceled` | yes | Payment status. Only `completed` payments add to the wallet. |
| `items[].amount_cents` | integer | yes | Amount charged to the payment method, in US cents. |
| `items[].fee_cents` | integer | yes | Processing fee included in `amount_cents`, in US cents. |
| `items[].credit_cents` | integer | yes | Amount added to the wallet, in US cents. |
| `items[].created_at` | integer | yes | Time the payment was started (Unix time, seconds, UTC) |
| `items[].completed_at` | integer or null | yes | Time the payment completed (Unix time, seconds, UTC) |
| `items[].provider` | string | yes | Payment channel that handled the payment, for example `stripe`, `paypal`, `binance` or `sepay`. |
| `items[].ref` | string | yes | Reference of the payment at the payment channel. |
| `items[].method` | string or null | yes | Payment method within the channel, for example `card` or `alipay`. |
| `items[].meta` | object or null | yes | Channel-specific, non-sensitive details of the payment. Keys depend on the channel. |
| `items[].expires_at` | integer or null | yes | Time a pending payment stops being accepted (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | The `sort` value you sent, or `id` when you sent none. |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "amount_cents": 1030,
      "completed_at": 1792380030,
      "created_at": 1792380000,
      "credit_cents": 1000,
      "expires_at": null,
      "fee_cents": 30,
      "id": 77,
      "kind": "topup",
      "meta": null,
      "method": "card",
      "provider": "stripe",
      "ref": "pi_example",
      "status": "completed"
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "id",
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/payments" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Order history

`GET /v1/billing/orders`

Lists your orders: every invoice that is about a server (purchases, plan and cycle changes, renewals, refunds), newest first by default. Each order carries the first line of its invoice as `description` and a short summary of the server (`vm`, null once the server has been deleted). Top-ups are not orders; see [List payments](#operation/billing_payment_list).

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing order list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Orders per page. Values above 100 are clamped to 100. |
| `status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | no | Only orders with this status. |
| `kind` | string: `receipt`, `renewal`, `topup`, `manual`, `refund` | no | Only orders of this kind. |
| `q` | string | no | Search text, matched against the invoice number, the server identifier and the note. At most 80 characters are used. |
| `sort` | string: `id`, `number`, `created_at`, `paid_at`, `kind`, `status`, `total_cents`, `vm_id` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BillingOrder | yes |  |
| `items[].id` | integer | yes | Order identifier (the identifier of its invoice). |
| `items[].number` | string or null | yes | Invoice number. |
| `items[].kind` | string: `receipt`, `renewal`, `topup`, `manual`, `refund` | yes | Kind of the underlying invoice. |
| `items[].status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | yes | Payment status. |
| `items[].total_cents` | integer | yes | Amount of the order, in US cents. |
| `items[].created_at` | integer | yes | Time the order was created (Unix time, seconds, UTC) |
| `items[].paid_at` | integer or null | yes | Time the order was paid (Unix time, seconds, UTC) |
| `items[].vm_id` | string or null | yes | Server the order is about. |
| `items[].description` | string | yes | Description of the first line item; empty when there is none. |
| `items[].sub` | string or null: `new`, `plan`, `cycle` | yes | For purchases paid from the wallet: `new` (a new server), `plan` (a plan change) or `cycle` (a billing-cycle change). Null for other kinds. |
| `items[].vm` | object or null | yes |  |
| `items[].vm.id` | string | yes | Server identifier. |
| `items[].vm.hostname` | string | yes | Hostname of the server. |
| `items[].vm.display_name` | string | yes | Display name of the server. |
| `items[].vm.cycle` | string | yes | Billing cycle of the server, for example `hourly` or `monthly`. |
| `items[].vm.state` | string | yes | State of the server. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "created_at": 1792390000,
      "description": "Server web-1 (1 vCPU, 2 GB RAM, 25 GB disk), first hour",
      "id": 311,
      "kind": "receipt",
      "number": "EX202610-000311",
      "paid_at": 1792390000,
      "status": "paid",
      "sub": "new",
      "total_cents": 250,
      "vm": {
        "cycle": "hourly",
        "display_name": "web-1",
        "hostname": "web-1",
        "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
        "state": "active"
      },
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "id",
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/orders" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Orders across all services

`GET /v1/orders`

Lists your orders across every service in one place: purchases, renewals, upgrades, add-ons, top-ups, refunds and usage. Orders come from your invoices, from wallet charges that have no invoice, and from metered hourly usage grouped per service and UTC day. Filtering, sorting and paging run on the server over the whole list. Invalid parameters are rejected with 422 and `field` naming the parameter.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `order list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Orders per page, 1 to 100. |
| `service` | string: `vm`, `gpu`, `vpn`, `proxy6`, `dedicated`, `blackfriday`, `s3`, `k8s`, `vpc`, `volume`, `backup`, `images`, `bandwidth`, `ai`, `byoip`, `llc`, `wallet`, `other` | no | Only orders of this product line. |
| `type` | string: `new`, `renew`, `upgrade`, `addon`, `topup`, `refund`, `usage`, `manual` | no | Only orders of this type. |
| `status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | no | Only orders with this status. |
| `q` | string | no | Search text (at most 80 characters), matched against the invoice number, the server identifier and the description. |
| `from` | integer | no | Only orders created at or after this Unix time (seconds). |
| `to` | integer | no | Only orders created at or before this Unix time (seconds). Must not be before `from`. |
| `sort` | string: `created_at`, `paid_at`, `total_cents`, `service`, `type`, `status`, `number` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Order | yes |  |
| `items[].id` | string | yes | Order key, unique within the list: `i<invoice id>` for an invoice, `l<transaction id>` for a wallet charge without an invoice, `u<account>:<service>:<day>` for a day of metered usage. |
| `items[].source` | string: `invoice`, `ledger`, `usage` | yes | Where the order comes from: an invoice, a single wallet charge or refund that has no invoice, or one UTC day of metered (hourly) usage of one service. |
| `items[].invoice_id` | integer or null | yes | Invoice identifier for orders with `source` `invoice`; open it with [Get one invoice](#operation/billing_invoice_get). |
| `items[].number` | string or null | yes | Invoice number, for orders with an invoice. |
| `items[].service` | string: `vm`, `gpu`, `vpn`, `proxy6`, `dedicated`, `blackfriday`, `s3`, `k8s`, `vpc`, `volume`, `backup`, `images`, `bandwidth`, `ai`, `byoip`, `llc`, `wallet`, `other` | yes | Product line the order belongs to, for example `vm` (Instances), `gpu` (GPU Instances), `dedicated` (Bare Metal), `s3` (Object Storage), `volume` (Block Storage), `backup` (Backups), `images` (OS and ISO Images), `bandwidth` (Bandwidth add-on), `ai` (AI Models), `byoip` (Bring Your Own IP and IPv4 subnets), `wallet` (top-ups) or `other`. Product lines that are not sold on this site never appear. |
| `items[].type` | string: `new`, `renew`, `upgrade`, `addon`, `topup`, `refund`, `usage`, `manual` | yes | `new` purchase, `renew` renewal, `upgrade` plan, cycle or bandwidth change, `addon` add-on, `topup` wallet top-up, `refund`, `usage` metered or pay-as-you-go usage, `manual` invoice issued by support. |
| `items[].status` | string: `paid`, `unpaid`, `overdue`, `cancelled`, `refunded` | yes | Payment status. Wallet charges are `paid`, wallet refunds `refunded`. |
| `items[].total_cents` | integer | yes | Amount, in US cents. Always positive; refunds are money returned to your wallet. |
| `items[].created_at` | integer | yes | Time the order was created (for usage: the last charge of that day) (Unix time, seconds, UTC) |
| `items[].paid_at` | integer or null | yes | Time the order was paid (Unix time, seconds, UTC) |
| `items[].vm_id` | string or null | yes | Server the order is about, when it is about one. |
| `items[].description` | string | yes | First line of the invoice, the wallet note, or a usage summary. |
| `items[].count` | integer | yes | Number of wallet charges grouped in this order (1 except for usage). |
| `items[].vm` | object or null | yes |  |
| `items[].vm.id` | string | yes | Server identifier. |
| `items[].vm.hostname` | string | yes | Hostname of the server. |
| `items[].vm.display_name` | string | yes | Display name of the server. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "count": 1,
      "created_at": 1792390000,
      "description": "Server web-1, first hour",
      "id": "i311",
      "invoice_id": 311,
      "number": "EX202610-000311",
      "paid_at": 1792390000,
      "service": "vm",
      "source": "invoice",
      "status": "paid",
      "total_cents": 250,
      "type": "new",
      "vm": {
        "display_name": "web-1",
        "hostname": "web-1",
        "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
      },
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    },
    {
      "count": 24,
      "created_at": 1792450000,
      "description": "Usage (24 charges)",
      "id": "u42:volume:2026-10-21",
      "invoice_id": null,
      "number": null,
      "paid_at": 1792450000,
      "service": "volume",
      "source": "usage",
      "status": "paid",
      "total_cents": 12,
      "type": "usage",
      "vm": null,
      "vm_id": null
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "created_at",
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 422 | `invalid_argument` | A parameter is not valid (unknown `service`, `type`, `status` or `sort`, `dir` not asc/desc, `page`/`per_page` out of range, `from` after `to`, `q` too long); `field` names it. |

**Example request**

```bash
curl "https://api.onie.net/v1/orders" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Current usage

`GET /v1/client/usage`

Returns the resources your account uses right now: the total vCPU, memory and disk of all servers that are active, locked or being provisioned, the number of public addresses and servers, and how many attacks were blocked against your addresses in the last 30 days. `limits` holds the account limits for each resource, or null where there is no limit. The burn rate counts only running hourly servers.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing usage`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vcpu` | integer | yes | Total virtual CPU cores. |
| `ram_gb` | number | yes | Total memory in GiB, rounded to two decimals. |
| `ram_mb` | integer | yes | Total memory in MiB. |
| `disk_gb` | integer | yes | Total system disk in GiB. |
| `ip` | integer | yes | Number of public IPv4 addresses in use. |
| `vm` | integer | yes | Number of servers. |
| `limits` | object | yes |  |
| `limits.vcpu` | integer or null | yes | vCPU limit; null when unlimited. |
| `limits.ram_gb` | number or null | yes | Memory limit in GiB; null when unlimited. |
| `limits.disk_gb` | integer or null | yes | Disk limit in GiB; null when unlimited. |
| `limits.ip` | integer or null | yes | Public address limit; null when unlimited. |
| `limits.vm` | integer or null | yes | Server limit; null when unlimited. |
| `protected` | object | yes |  |
| `protected.vm` | integer | yes | Servers protected against attacks. |
| `protected.ip` | integer | yes | Public addresses protected against attacks. |
| `protected.attacks_30d` | integer | yes | Attacks against your addresses in the last 30 days. |
| `burn_mills_per_hour` | integer | yes | What running hourly servers cost per hour, in thousandths of a US dollar. Rounded down; prefer `burn_uusd_per_hour`. |
| `burn_uusd_per_hour` | integer | yes | What running hourly servers cost per hour, in millionths of a US dollar. |

Example:

```json
{
  "burn_mills_per_hour": 14,
  "burn_uusd_per_hour": 14000,
  "disk_gb": 50,
  "ip": 2,
  "limits": {
    "disk_gb": null,
    "ip": null,
    "ram_gb": null,
    "vcpu": null,
    "vm": null
  },
  "protected": {
    "attacks_30d": 0,
    "ip": 2,
    "vm": 2
  },
  "ram_gb": 4.0,
  "ram_mb": 4096,
  "vcpu": 2,
  "vm": 2
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/client/usage" \
  -H "Authorization: Bearer $API_KEY"
```

---

### DDoS Shield

Inspect and manage the DDoS Shield of your account: protected IPs, blocking rules, attack events, edge traffic, blackholes, web protection and AI analysis, and the agent installed on your own server. Reading needs the `shield:read` scope, changing rules and settings needs `shield:write`, and controlling the agent needs `shield:agent`. Every path contains your tenant identifier, which is shown on the Account page of the dashboard; a key can only reach the tenant of the account that owns it. Protected IPs are managed for you and cannot be added or removed through the API. Rules created by automatic attack mitigation are visible but read-only.

#### DDoS Shield overview

`GET /v1/tenants/{tid}/summary`

Returns the overview shown on the DDoS Shield page of the dashboard: every protected IP with its current inbound and outbound rate, status, number of blocking rules and the attack in progress (if any), plus totals. Rates are measured at the network edge and refresh every few seconds; `spark` and `spark_out` hold up to 30 recent samples per direction for drawing a chart.

`status` is `attack` while an attack event is open, `high` when the inbound packet rate is well above the normal level of the IP, `idle` when no inbound traffic is measured and `ok` otherwise. For details about attacks use [List attack events](#operation/shield_event_list).

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield summary`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `tenant` | object | yes | Your tenant. Only `id` is present when the tenant has no stored settings. |
| `tenant.id` | string | yes | Tenant identifier. |
| `tenant.name` | string | no | Name of the tenant. |
| `tenant.status` | string | no | `active`, or `suspended` when changes to blocking rules are not allowed (reads still work). |
| `tenant.max_targets` | integer | no | Maximum number of protected IPs; 0 means no limit. |
| `targets` | array of object | yes |  |
| `targets[].id` | string | yes | Protected target identifier. |
| `targets[].ip` | string | yes | The protected IP address. |
| `targets[].label` | string | yes | Label of the target; it starts with your tenant identifier. |
| `targets[].kind` | string: `vm`, `baremetal`, `service` | yes | Kind of resource behind the IP. |
| `targets[].enabled` | boolean | yes | Whether protection is switched on for this IP. |
| `targets[].rules` | integer | yes | Number of blocking rules on the IP. |
| `targets[].vm` | object or null | yes | The server that uses this IP as its public address, or null when no server does. |
| `targets[].vm.id` | string | yes | Server identifier. |
| `targets[].vm.hostname` | string | yes | Host name of the server. |
| `targets[].vm.display_name` | string | yes | Display name of the server. |
| `targets[].web` | boolean | yes | Whether web protection is switched on for the IP. |
| `targets[].bps` | number | yes | Current inbound rate in bits per second. |
| `targets[].pps` | number | yes | Current inbound rate in packets per second. |
| `targets[].out_bps` | number | yes | Current outbound rate in bits per second. |
| `targets[].out_pps` | number | yes | Current outbound rate in packets per second. |
| `targets[].status` | string: `ok`, `idle`, `high`, `attack` | yes | Traffic status of the IP. |
| `targets[].spark` | array of number | yes | Recent inbound rate samples in bits per second, oldest first (at most 30). |
| `targets[].spark_out` | array of number | yes | Recent outbound rate samples in bits per second, oldest first (at most 30). |
| `targets[].event` | object or null | yes | The attack in progress on this IP, or null. |
| `targets[].event.label` | string | yes | Description of the attack class (not translated). |
| `targets[].event.started` | integer | yes | When the attack was detected (Unix time, seconds, UTC) |
| `targets[].event.peak_pps` | number | yes | Highest inbound packet rate so far, in packets per second. |
| `targets[].event.severity` | string | yes | `low`, `medium`, `high` or `critical`. |
| `sum_bps` | number | yes | Total inbound rate of all protected IPs, in bits per second. |
| `sum_out_bps` | number | yes | Total outbound rate of all protected IPs, in bits per second. |
| `attacks` | integer | yes | Number of IPs whose status is `attack`. |
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792368030,
  "attacks": 1,
  "sum_bps": 644200000.0,
  "sum_out_bps": 82200000.0,
  "targets": [
    {
      "bps": 4200000.0,
      "enabled": true,
      "event": null,
      "id": "pt-1792000000",
      "ip": "203.0.113.10",
      "kind": "vm",
      "label": "acc-7k3m9x2p/vm:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "out_bps": 81000000.0,
      "out_pps": 11000.0,
      "pps": 900.0,
      "rules": 2,
      "spark": [
        3900000.0,
        4100000.0,
        4200000.0
      ],
      "spark_out": [
        78000000.0,
        80500000.0,
        81000000.0
      ],
      "status": "ok",
      "vm": {
        "display_name": "Web 1",
        "hostname": "web-1",
        "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
      },
      "web": false
    },
    {
      "bps": 640000000.0,
      "enabled": true,
      "event": {
        "label": "SYN flood",
        "peak_pps": 182000,
        "severity": "high",
        "started": 1792368000
      },
      "id": "pt-1792000100",
      "ip": "203.0.113.11",
      "kind": "vm",
      "label": "acc-7k3m9x2p/vm:9b1d4a77-02ce-4f3e-8d15-6a7e2c90f3b4",
      "out_bps": 1200000.0,
      "out_pps": 900.0,
      "pps": 180000.0,
      "rules": 0,
      "spark": [
        4000000.0,
        640000000.0
      ],
      "spark_out": [
        1100000.0,
        1200000.0
      ],
      "status": "attack",
      "vm": null,
      "web": false
    }
  ],
  "tenant": {
    "id": "acc-7k3m9x2p",
    "max_targets": 10,
    "name": "Example Corp",
    "status": "active"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/summary" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### DDoS Shield center: all IPs, traffic, 24-hour attacks

`GET /v1/tenants/{tid}/overview`

Returns everything the DDoS Shield dashboard shows on one page, for ALL IPs of your account together: totals (current rate, protected IPs, attacks in progress, blocking rules, blackholes), one row per IP, the combined edge traffic stacked by IP, the attack events of the last 24 hours and the countries attacks and traffic come from. Only IPs of your own account are included, and every total is the sum of those IPs.

`range` chooses the traffic window: `30m` (default) is the live window sampled every 5 seconds; `6h` and `24h` are stored history with one point per 5 minutes (the highest rate of each 5 minutes), kept across restarts of the edge service; history starts when it was first recorded, so a young account or a new IP may show fewer points than the window. Nothing is kept for longer than 48 hours. `events.peak_bits_24h` is the highest inbound bit rate of the attacks of the last 24 hours, left at 0 (and counted in `events.peak_bits_unsure_24h`) when the measurement is not plausible. Attack countries (`events.attack_cc`, `events.attack_ev`) are only known for attacks detected by an agent installed on your server. `geo.cc` lists the countries inbound traffic comes from, sampled over the last 15 minutes from the busiest IPs; it is refreshed in the background, so `geo.at` is 0 until the first sample is ready. Data is cached for 2 seconds. For the rules of one IP use [List blocking rules](#operation/shield_rule_list); for the attacks of one IP use [List attack events](#operation/shield_event_list).

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield overview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `30m`, `6h`, `24h` | no | Traffic window of `traffic`. Any other value is treated as `30m`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |
| `range` | string: `30m`, `6h`, `24h` | yes | The traffic window that was applied. |
| `tenant` | object | yes | Your tenant. |
| `tenant.id` | string | yes | Tenant identifier. |
| `tenant.name` | string | no | Name of the tenant. |
| `tenant.status` | string | no | `active` or `suspended`. |
| `tenant.max_targets` | integer | no | Maximum number of protected IPs; 0 means no limit. |
| `totals` | object | yes | Sums over the IPs of your account. |
| `totals.ips` | integer | yes | Number of IPs on the account. |
| `totals.protected` | integer | yes | IPs with protection switched on. |
| `totals.attacking` | integer | yes | IPs with an attack in progress. |
| `totals.high` | integer | yes | IPs whose inbound packet rate is well above their normal level. |
| `totals.bps` | number | yes | Total inbound rate, bits per second. |
| `totals.out_bps` | number | yes | Total outbound rate, bits per second. |
| `totals.pps` | number | yes | Total inbound rate, packets per second. |
| `totals.out_pps` | number | yes | Total outbound rate, packets per second. |
| `totals.rules_block` | integer | yes | Blocking rules in force on your IPs. |
| `totals.rules_count` | integer | yes | Count-only rules. |
| `totals.rules_temp` | integer | yes | Blocking rules that expire automatically. |
| `totals.rtbh_active` | integer | yes | Blackholes in force on your IPs. |
| `targets` | array of object | yes | One row per IP, at most 500. |
| `targets[].id` | string | yes | Protected target identifier. |
| `targets[].ip` | string | yes | The protected IP address. |
| `targets[].label` | string | yes | Label of the target; it starts with your tenant identifier. |
| `targets[].kind` | string | yes | Kind of resource behind the IP. |
| `targets[].enabled` | boolean | yes | Whether protection is switched on. |
| `targets[].web` | boolean | yes | Whether web protection is switched on. |
| `targets[].vm` | object or null | yes |  |
| `targets[].vm.id` | string | yes | Server identifier. |
| `targets[].vm.name` | string | yes | Display name of the server. |
| `targets[].status` | string: `ok`, `idle`, `high`, `attack` | yes | Traffic status of the IP. |
| `targets[].bps` | number | yes | Current inbound rate, bits per second. |
| `targets[].pps` | number | yes | Current inbound rate, packets per second. |
| `targets[].out_bps` | number | yes | Current outbound rate, bits per second. |
| `targets[].out_pps` | number | yes | Current outbound rate, packets per second. |
| `targets[].spark` | array of number | yes | Recent inbound samples, oldest first (at most 30). |
| `targets[].spark_out` | array of number | yes | Recent outbound samples, oldest first (at most 30). |
| `targets[].rules` | integer | yes | Number of rules on the IP. |
| `targets[].events24` | integer | yes | Attack events of the IP that started in the last 24 hours. |
| `targets[].event` | object or null | yes |  |
| `targets[].event.id` | string | yes | Event identifier. |
| `targets[].event.label` | string | yes | Description of the attack class (not translated). |
| `targets[].event.started` | integer | yes | When the attack was detected (Unix time, seconds, UTC) |
| `targets[].event.peak_pps` | number | yes | Highest packet rate so far. |
| `targets[].event.severity` | string | yes | `low`, `medium`, `high` or `critical`. |
| `targets_truncated` | boolean | yes | True when the account has more than 500 IPs and `targets` is cut. |
| `traffic` | object | yes | Combined edge traffic of your IPs. |
| `traffic.range` | string: `30m`, `6h`, `24h` | yes | Window. |
| `traffic.step_s` | integer | yes | Seconds between points before any merging: 5 for `30m`, 300 for `6h` and `24h`. |
| `traffic.points` | array of array of number | yes | `[time, in_bps, out_bps, in_pps, out_pps]`, oldest first, at most 360 points; with `6h` and `24h` each value is the highest of its 5-minute bucket. |
| `traffic.by_ip` | array of object | yes | The 5 IPs with the most inbound traffic. |
| `traffic.by_ip[].ip` | string | yes | IP address. |
| `traffic.by_ip[].v` | array of number | yes | Inbound rate aligned with `points`. |
| `traffic.other` | array of number | yes | Inbound rate of all other IPs, aligned with `points`; `by_ip` plus `other` add up to the total. |
| `events` | object | yes | Attacks on your IPs. |
| `events.last24h` | integer | yes | Attacks that started in the last 24 hours (or are still open). |
| `events.active` | integer | yes | Attacks in progress. |
| `events.peak_pps_24h` | integer | yes | Highest packet rate seen in an attack of the last 24 hours. |
| `events.peak_bits_24h` | number | yes | Highest inbound bit rate of an attack of the last 24 hours with a plausible measurement; 0 if none. |
| `events.peak_bits_unsure_24h` | integer | yes | Attacks whose bit rate was left out because the measurement is implausible. |
| `events.by_severity` | object | yes | Attacks per severity. |
| `events.by_kind` | object | yes | Attacks per class. |
| `events.hourly` | array of array of integer | yes | 24 entries, oldest hour first: `[attack count, highest severity rank 0-4]`. |
| `events.list` | array of object | yes | Attacks of the last 24 hours, newest first, at most 200. |
| `events.list[].id` | string | yes | Event identifier. |
| `events.list[].target` | string | yes | The IP that was attacked. |
| `events.list[].kind` | string | yes | Attack class. |
| `events.list[].label` | string | yes | Description of the attack class (not translated). |
| `events.list[].severity` | string | yes | `low`, `medium`, `high` or `critical`. |
| `events.list[].started` | integer | yes | When the attack was detected (Unix time, seconds, UTC) |
| `events.list[].ended` | integer or null | yes | When it ended, null while open (Unix time, seconds, UTC) |
| `events.list[].open` | boolean | yes | True while the attack is in progress. |
| `events.list[].duration_s` | integer | yes | Duration in seconds so far. |
| `events.list[].peak_pps` | number | yes | Highest packet rate. |
| `events.list[].peak_bits` | number | yes | Highest inbound bit rate; unreliable when `peak_ok` is false. |
| `events.list[].peak_ok` | boolean | yes | False when the measurement is implausible and `peak_bits` should not be shown. |
| `events.list[].src` | string: `edge`, `agent` | yes | Where the attack was detected: the network edge or an agent installed on your server. |
| `events.truncated` | boolean | yes | True when `last24h` is larger than the list. |
| `events.attack_cc` | array of object | yes | Countries attacks come from (agent-detected attacks only), most packets first. |
| `events.attack_cc[].cc` | string | yes | Country code. |
| `events.attack_cc[].packets` | integer | yes | Sampled packets. |
| `events.attack_cc[].events` | integer | yes | Attacks involving the country. |
| `events.attack_ev` | array of object | yes | Source countries per attack, newest first, at most 80. |
| `events.attack_ev[].id` | string | yes | Event identifier. |
| `events.attack_ev[].cc` | array of array of number | yes | `[country code, sampled packets]`, at most 6. |
| `events.last` | object or null | yes |  |
| `events.last.id` | string | yes | Event identifier. |
| `events.last.kind` | string | yes | Attack class. |
| `events.last.started` | integer | yes | When it was detected (Unix time, seconds, UTC) |
| `events.last.ended` | integer or null | yes | When it ended, null while open (Unix time, seconds, UTC) |
| `events.last.label` | string | yes | Description (not translated). |
| `events.last.target` | string | yes | The IP. |
| `events.last.severity` | string | yes | Severity. |
| `geo` | object | yes | Countries inbound traffic comes from. |
| `geo.at` | integer | yes | When the sample was taken; 0 until the first one is ready (Unix time, seconds, UTC) |
| `geo.ok` | boolean | yes | False when the traffic analyser could not be reached. |
| `geo.cc` | array of object | yes | Countries inbound traffic comes from, most bytes first (at most 40). |
| `geo.cc[].cc` | string | yes | Country code. |
| `geo.cc[].bytes` | integer | yes | Bytes received from the country in the window. |
| `geo.window_s` | integer | yes | Length of the sampled window in seconds. |
| `geo.ips` | integer | yes | Number of IPs sampled (the busiest). |

Example:

```json
{
  "at": 1792368030,
  "events": {
    "active": 1,
    "attack_cc": [],
    "attack_ev": [],
    "by_kind": {
      "syn_flood": 1
    },
    "by_severity": {
      "high": 1
    },
    "hourly": [
      [
        0,
        0
      ],
      [
        1,
        3
      ]
    ],
    "last": {
      "ended": null,
      "id": "ev-1792368000-20311_11",
      "kind": "syn_flood",
      "label": "SYN flood",
      "severity": "high",
      "started": 1792368000,
      "target": "203.0.113.11"
    },
    "last24h": 1,
    "list": [
      {
        "duration_s": 30,
        "ended": null,
        "id": "ev-1792368000-20311_11",
        "kind": "syn_flood",
        "label": "SYN flood",
        "open": true,
        "peak_bits": 700000000.0,
        "peak_ok": true,
        "peak_pps": 182000,
        "severity": "high",
        "src": "edge",
        "started": 1792368000,
        "target": "203.0.113.11"
      }
    ],
    "peak_bits_24h": 700000000.0,
    "peak_bits_unsure_24h": 0,
    "peak_pps_24h": 182000,
    "truncated": false
  },
  "geo": {
    "at": 1792368000,
    "cc": [
      {
        "bytes": 5120993740,
        "cc": "US"
      }
    ],
    "ips": 1,
    "ok": true,
    "window_s": 900
  },
  "range": "30m",
  "targets": [
    {
      "bps": 640000000.0,
      "enabled": true,
      "event": {
        "id": "ev-1792368000-20311_11",
        "label": "SYN flood",
        "peak_pps": 182000,
        "severity": "high",
        "started": 1792368000
      },
      "events24": 1,
      "id": "pt-1792000100",
      "ip": "203.0.113.11",
      "kind": "vm",
      "label": "acc-7k3m9x2p/vm:9b1d4a77-02ce-4f3e-8d15-6a7e2c90f3b4",
      "out_bps": 1200000.0,
      "out_pps": 900.0,
      "pps": 180000.0,
      "rules": 1,
      "spark": [
        4000000.0,
        640000000.0
      ],
      "spark_out": [
        1100000.0,
        1200000.0
      ],
      "status": "attack",
      "vm": null,
      "web": false
    }
  ],
  "targets_truncated": false,
  "tenant": {
    "id": "acc-7k3m9x2p",
    "max_targets": 10,
    "name": "Example Corp",
    "status": "active"
  },
  "totals": {
    "attacking": 1,
    "bps": 644200000.0,
    "high": 0,
    "ips": 2,
    "out_bps": 82200000.0,
    "out_pps": 11900.0,
    "pps": 180900.0,
    "protected": 2,
    "rtbh_active": 0,
    "rules_block": 2,
    "rules_count": 0,
    "rules_temp": 1
  },
  "traffic": {
    "by_ip": [
      {
        "ip": "203.0.113.11",
        "v": [
          640000000.0
        ]
      }
    ],
    "other": [
      0.0
    ],
    "points": [
      [
        1792368020.0,
        640000000.0,
        1200000.0,
        180000.0,
        900.0
      ]
    ],
    "range": "30m",
    "step_s": 5
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/overview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Protected IPs

`GET /v1/tenants/{tid}/targets`

Returns the IP addresses protected by DDoS Shield on your account, each with its blocking rules, web protection settings and cumulative edge counters. The list is not paginated.

Rules created from an AS number or a country carry the expanded `prefixes`, which can be very long; if you only need rule details use [List blocking rules](#operation/shield_rule_list). `counters.targets` is keyed by IP and counts packets and bytes since the edge started, so subtract two readings to get a rate (or use [Get edge traffic](#operation/shield_traffic)). Protected IPs are managed for you and cannot be added or removed here.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `targets` | array of ShieldTarget | yes |  |
| `targets[].id` | string | yes | Protected target identifier. Use it as `id` in the rule and event operations. |
| `targets[].ip` | string | yes | The protected IP address. An IPv6 target can also be a network such as `2001:db8:1::/48`. |
| `targets[].label` | string | yes | Label of the target. It starts with your tenant identifier, for example `<tenant>/vm:<server id>` for the public IP of a server. |
| `targets[].kind` | string: `vm`, `baremetal`, `service` | yes | Kind of resource behind the IP. |
| `targets[].enabled` | boolean | yes | Whether protection is switched on for this IP. |
| `targets[].created_at` | integer | yes | When the IP was registered for protection (Unix time, seconds, UTC) |
| `targets[].rules` | array of ShieldTargetRule | yes |  |
| `targets[].rules[].id` | string | yes | Rule identifier. |
| `targets[].rules[].kind` | string: `ip`, `cidr`, `ip6`, `cidr6`, `asn`, `country` | yes | What the rule matches: an IPv4 address, an IPv4 network, an IPv6 address, an IPv6 network, an autonomous system or a country. |
| `targets[].rules[].value` | string | yes | The matched value, normalised: an address with its prefix length such as `198.51.100.7/32`, a network such as `203.0.113.0/24`, an AS number such as `AS64500`, or a two-letter country code. |
| `targets[].rules[].prefixes` | array of string | yes | For `asn` and `country` rules, the networks the value expands to (can be thousands). Empty for other kinds. |
| `targets[].rules[].note` | string | yes | Free text note, at most 120 characters. |
| `targets[].rules[].at` | integer | yes | When the rule was created (Unix time, seconds, UTC) |
| `targets[].rules[].mode` | string | yes | Empty string means `block`: matching packets are dropped. `count`: matching packets are only counted. |
| `targets[].rules[].expires` | integer or null | yes | When the rule is removed automatically, or null for a permanent rule (Unix time, seconds, UTC) |
| `targets[].rules[].by` | string: `you`, `portal`, `ips`, `ai`, `auto`, `system` | yes | Who created the rule, from the point of view of your account: `you` (your account, in the dashboard or through the API), `portal` (an integration acting for you), `ips` (intrusion prevention), `ai` (AI analysis), `auto` (automatic mitigation) or `system` (an operator). |
| `targets[].web` | object | yes | Per-source rate limits for the web ports of the IP. |
| `targets[].web.enabled` | boolean | yes | Whether web protection is on. |
| `targets[].web.syn_rate` | integer | yes | Maximum new TCP connections (SYN packets) per second from one source to the web ports; 0 means no limit. |
| `targets[].web.pkt_rate` | integer | yes | Maximum packets per second from one source to the web ports; 0 means no limit. |
| `targets[].web.ports` | array of integer | yes | Web ports covered. Empty means 80 and 443. |
| `targets[].seen_at` | integer | yes | Last time traffic was measured for the IP; 0 if never (Unix time, seconds, UTC) |
| `counters` | object | yes | Edge counters of your protected IPs. |
| `counters.at` | integer | yes | When the counters were read; 0 if no counters are available (Unix time, seconds, UTC) |
| `counters.targets` | object | yes | Counters keyed by the IP address of the target. IPs without counters are absent. |

Example:

```json
{
  "counters": {
    "at": 1792368005,
    "targets": {
      "203.0.113.10": {
        "in": {
          "bytes": 3012451120,
          "packets": 5821733
        },
        "out": {
          "bytes": 5120993740,
          "packets": 4410220
        }
      }
    }
  },
  "targets": [
    {
      "created_at": 1792000000,
      "enabled": true,
      "id": "pt-1792000000",
      "ip": "203.0.113.10",
      "kind": "vm",
      "label": "acc-7k3m9x2p/vm:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "rules": [
        {
          "at": 1792100000,
          "by": "you",
          "expires": null,
          "id": "r-0-1792100000",
          "kind": "ip",
          "mode": "",
          "note": "scanner",
          "prefixes": [],
          "value": "198.51.100.7/32"
        }
      ],
      "seen_at": 1792368000,
      "web": {
        "enabled": false,
        "pkt_rate": 0,
        "ports": [],
        "syn_rate": 0
      }
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rules of one IP

`GET /v1/tenants/{tid}/targets/{id}/rules`

Lists the blocking rules of one protected IP, newest first, with the number of packets and bytes each rule matched and the limits that apply when you add more. `:id` is the target `id` from [List protected IPs](#operation/shield_target_list); the IP address itself is accepted too.

Rules whose `actor` is `you` were created by your account (dashboard or API) and can be deleted with [Delete a blocking rule](#operation/shield_rule_delete); rules created by an integration, intrusion prevention, AI analysis, automatic mitigation or an operator are read-only. `total` counts all rules of the IP, whatever the filters. In `caps`, `max_rules` is 0 when the account uses the default limit (500 rules and 20,000 networks in total).

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield rule list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |
| `id` | string | yes | Protected target identifier, as returned by List protected IPs (for example `pt-1792000000`). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `mode` | string: `block`, `count` | no | Only return rules in this mode. Any other value matches nothing. |
| `q` | string | no | Case-insensitive text; only rules whose value or note contains it are returned. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | IP address of the target. |
| `target_id` | string | yes | Identifier of the target. |
| `rules` | array of ShieldRule | yes |  |
| `rules[].id` | string | yes | Rule identifier. Use it as `rid` to delete the rule. |
| `rules[].kind` | string: `ip`, `cidr`, `ip6`, `cidr6`, `asn`, `country` | yes | What the rule matches: an IPv4 address, an IPv4 network, an IPv6 address, an IPv6 network, an autonomous system or a country. |
| `rules[].value` | string | yes | The matched value, normalised: an address with its prefix length such as `198.51.100.7/32`, a network such as `203.0.113.0/24`, an AS number such as `AS64500`, or a two-letter country code. |
| `rules[].prefixes` | array of string | yes | For `asn` and `country` rules, the networks the value expands to (can be thousands). Empty for other kinds. |
| `rules[].note` | string | yes | Free text note, at most 120 characters. |
| `rules[].at` | integer | yes | When the rule was created (Unix time, seconds, UTC) |
| `rules[].mode` | string: `block`, `count` | yes | `block`: matching packets are dropped. `count`: matching packets are only counted, which lets you test a rule safely. |
| `rules[].expires` | integer or null | yes | When the rule is removed automatically, or null for a permanent rule (Unix time, seconds, UTC) |
| `rules[].target_id` | string | yes | Protected target the rule belongs to. |
| `rules[].ip` | string | yes | IP address of that target. |
| `rules[].label` | string | yes | Label of that target. |
| `rules[].hits` | object | yes | Traffic that matched the rule since it was installed (cumulative). |
| `rules[].hits.packets` | integer | yes | Packets that matched the rule. |
| `rules[].hits.bytes` | integer | yes | Bytes that matched the rule. |
| `rules[].source` | string: `portal`, `ips`, `ai`, `auto`, `admin` | yes | Kind of creator: `portal` is a customer account or an integration acting for it (dashboard or API); `ips` is automatic intrusion prevention; `ai` is the AI analysis; `auto` is automatic mitigation; `admin` is an operator. |
| `rules[].readonly` | boolean | yes | True when you cannot delete the rule: only rules created by your own account (`actor` is `you`) can be deleted. |
| `rules[].actor` | string: `you`, `portal`, `ips`, `ai`, `auto`, `system` | yes | Who created the rule, from the point of view of your account: `you` (your account, in the dashboard or through the API), `portal` (an integration acting for you), `ips`, `ai`, `auto`, or `system` (an operator). |
| `total` | integer | yes | Number of rules on the IP, ignoring `mode` and `q`. |
| `at` | integer | yes | When the hit counters were read; 0 if no counters are available (Unix time, seconds, UTC) |
| `caps` | object | yes | Limits that apply to Add a blocking rule. |
| `caps.per_call` | integer | yes | Most values accepted in one Add call. |
| `caps.max_rules` | integer | yes | Maximum number of rules for the whole account; 0 means the default limit applies. |
| `caps.used_rules` | integer | yes | Rules currently used by the whole account (all IPs). |
| `caps.ttl_min` | integer | yes | Shortest allowed `ttl_min` in minutes. |
| `caps.ttl_max` | integer | yes | Longest allowed `ttl_min` in minutes. |
| `ttl_presets` | array of integer | yes | Durations in minutes offered by the dashboard (0 = permanent). |

Example:

```json
{
  "at": 1792368005,
  "caps": {
    "max_rules": 0,
    "per_call": 50,
    "ttl_max": 43200,
    "ttl_min": 5,
    "used_rules": 1
  },
  "ip": "203.0.113.10",
  "rules": [
    {
      "actor": "you",
      "at": 1792100000,
      "expires": null,
      "hits": {
        "bytes": 98560,
        "packets": 1520
      },
      "id": "r-0-1792100000",
      "ip": "203.0.113.10",
      "kind": "ip",
      "label": "acc-7k3m9x2p/vm:3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "mode": "block",
      "note": "scanner",
      "prefixes": [],
      "readonly": false,
      "source": "portal",
      "target_id": "pt-1792000000",
      "value": "198.51.100.7/32"
    }
  ],
  "target_id": "pt-1792000000",
  "total": 1,
  "ttl_presets": [
    0,
    30,
    60,
    360,
    1440,
    10080
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rules" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attack events of one IP

`GET /v1/tenants/{tid}/targets/{id}/events`

Lists the attacks detected on one protected IP in the chosen period, newest first, and the attack in progress (`open`) if there is one. `:id` is the target `id`; the IP address itself is accepted too. Events from before the IP was assigned to your account are not shown.

By default events are brief: the raw `samples` are left out and `peak_bits`, `duration_s` and `open` are added. Pass `brief=0` to get the full event with its samples. Only the most recent 300 events of the whole system are searched, so a very old event can be missing from a long range.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield event list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |
| `id` | string | yes | Protected target identifier, as returned by List protected IPs (for example `pt-1792000000`). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d` | no | Only return events that started within this period. Any other value is treated as `30d`. |
| `brief` | integer | no | `1` returns brief events (no `samples`); `0` returns full events. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | IP address of the target. |
| `range` | string | yes | The `range` value of the request, or `30d` when none was given. |
| `events` | array of ShieldAttackEvent | yes |  |
| `events[].id` | string | yes | Event identifier. |
| `events[].target` | string | yes | The attacked IP address. |
| `events[].kind` | string | yes | Attack class: `syn_flood`, `packet_flood`, `volumetric`, `udp_amplification`, `traffic_spike` or `unknown`. Events reported by an agent installed on a server can carry other values. |
| `events[].label` | string | yes | Short description of the attack class. The text is not translated and is currently provided in Vietnamese only; use `kind` in code. |
| `events[].started` | integer | yes | When the attack was detected (Unix time, seconds, UTC) |
| `events[].ended` | integer or null | yes | When the attack ended, or null while it is still going on (Unix time, seconds, UTC) |
| `events[].peak_pps` | number | yes | Highest inbound rate seen during the event, in packets per second. |
| `events[].peak_bps` | number | yes | Highest inbound rate seen during the event, in BYTES per second despite the name. Multiply by 8 for bits per second, or read `peak_bits`. |
| `events[].avg_packet` | number | no | Average packet size in bytes when the attack was detected. |
| `events[].baseline_pps` | number | no | Normal inbound packet rate of the IP before the attack, in packets per second. |
| `events[].severity` | string: `low`, `medium`, `high`, `critical` | yes | Severity of the attack, derived from its peak packet and bit rate: `medium` from 20,000 packets/s or 200 Mbit/s, `high` from 100,000 packets/s or 1 Gbit/s, `critical` from 500,000 packets/s or several Gbit/s. |
| `events[].has_sample` | boolean | no | True when a packet sample was captured for the event. |
| `events[].reopened` | integer | no | How many times the event was reopened after a short pause. Absent if never. |
| `events[].source` | string | no | `agent` when the event was reported by an agent installed on a server; absent for events detected at the network edge. |
| `events[].peak_bits` | number | no | Highest inbound rate in bits per second. Only present when `brief=1`. |
| `events[].duration_s` | integer | no | Duration in seconds (up to now while the event is open). Only present when `brief=1`. |
| `events[].open` | boolean | no | True while the attack is still going on. Only present when `brief=1`. |
| `events[].samples` | array of array of number | no | Only present when `brief=0`. Up to 40 samples taken during the attack, each `[unix_time, inbound_packets_per_s, inbound_bytes_per_s, outbound_packets_per_s, outbound_bytes_per_s]`. |
| `open` | ShieldAttackEvent or null | yes |  |
| `at` | integer | yes | When the event list was last updated; 0 if no events exist (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792368000,
  "events": [
    {
      "avg_packet": 64,
      "baseline_pps": 900,
      "duration_s": 420,
      "ended": 1792300420,
      "has_sample": true,
      "id": "ev-1792300000-203011310",
      "kind": "syn_flood",
      "label": "SYN flood",
      "open": false,
      "peak_bits": 92160000.0,
      "peak_bps": 11520000,
      "peak_pps": 180000,
      "severity": "high",
      "started": 1792300000,
      "target": "203.0.113.10"
    }
  ],
  "ip": "203.0.113.10",
  "open": null,
  "range": "30d"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Edge traffic

`GET /v1/tenants/{tid}/traffic`

Returns, for each protected IP, the cumulative edge counters and the learned traffic baseline. `counters` holds packets and bytes per direction since the edge started (`in` is traffic toward your IP, `out` is traffic from it). `baseline` holds the normal inbound packet rate (`baseline_pps`), its standard deviation (`sigma`) and up to 60 recent samples (about the last five minutes) in `history`.

Each `history` sample is `[unix_time, inbound_packets_per_s, inbound_bytes_per_s, outbound_packets_per_s, outbound_bytes_per_s]`; note that the byte columns are bytes, not bits, per second. For the same figures in bits per second use [Get the overview](#operation/shield_summary). An IP without measurements has empty `counters` or `baseline` objects.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield traffic`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `traffic` | object | yes | Traffic data keyed by the IP address of each protected target. |

Example:

```json
{
  "traffic": {
    "203.0.113.10": {
      "baseline": {
        "baseline_pps": 912.4,
        "history": [
          [
            1792367990,
            905.0,
            525000.0,
            1370.0,
            10100000.0
          ],
          [
            1792367995,
            931.2,
            541000.0,
            1390.0,
            10250000.0
          ]
        ],
        "sigma": 130.2
      },
      "counters": {
        "in": {
          "bytes": 3012451120,
          "packets": 5821733
        },
        "out": {
          "bytes": 5120993740,
          "packets": 4410220
        }
      }
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `forbidden` | The account is blocked or suspended. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/traffic" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add a blocking rule

`POST /v1/tenants/{tid}/targets/{id}/rules`

Adds one or more blocking rules to a protected IP. A rule drops (`block`) or only counts (`count`) traffic from a source: an IPv4 address or network (`/8` to `/32`), an IPv6 address or network (`/32` to `/128`), an AS number such as `AS64500`, or a two-letter country code. Private, loopback and multicast ranges are refused. A country is only accepted when it is repeated in `confirm_country`, because it blocks a whole country. AS and country values are expanded to their networks, which needs a lookup and takes longer.

Pass the values in `values` (an array, or one string separated by spaces, commas, semicolons or new lines) or a single one in `value`. At most 50 values are processed per call; the rest are returned in `rejected`, as are duplicates and invalid values, so a call can succeed with `added` equal to 0. `:id` must be the target `id` (the IP address is not accepted here). Rules are limited per account (500 rules and 20,000 networks by default), and an account can make 60 calls per minute to this operation (10 per minute for calls that contain an AS number or a country). New rules take effect shortly after the call returns.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield rule add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |
| `id` | string | yes | Protected target identifier, as returned by List protected IPs (for example `pt-1792000000`). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `values` | string or array of string | no | Values to add: an array of strings, or one string with the values separated by spaces, commas, semicolons or new lines. At most 50 values are processed per call. Takes precedence over `value`. |
| `value` | string | no | A single value to add. Used when `values` is empty or absent. |
| `mode` | string: `block`, `count` | no | `block` (default) drops matching packets; `count` only counts them, which lets you test a rule safely. |
| `ttl_min` | integer | no | Lifetime of the rules in minutes, from 5 to 43200 (30 days). Omit or send 0 for permanent rules. |
| `note` | string | no | Free text note stored with each rule. Longer text is cut to 120 characters. |
| `confirm_country` | array of string | no | Country codes you confirm to block. A country value in `values` is rejected unless its code is listed here. |

Example:

```json
{
  "mode": "block",
  "note": "scanner traffic",
  "ttl_min": 1440,
  "values": [
    "198.51.100.7",
    "203.0.113.0/24",
    "AS64500"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `added` | integer | yes | Number of rules created. |
| `rejected` | array of string | yes | Values that were not added: duplicates, invalid or internal addresses, countries that were not confirmed, and anything over the limits. The reason text is not translated and is currently provided in Vietnamese only. |
| `mode` | string: `block`, `count` | yes | Mode applied to the new rules. |
| `expires` | integer or null | yes | When the new rules are removed automatically, or null for permanent rules (Unix time, seconds, UTC) |
| `kind` | string or null | yes | Kind of the first value of the request that passed validation, or null if none did. It is reported even when that value turned out to be a duplicate. |
| `value` | string or null | yes | The first value of the request that passed validation, normalised, or null if none did. |

Example:

```json
{
  "added": 3,
  "expires": 1792454400,
  "kind": "ip",
  "mode": "block",
  "rejected": [],
  "value": "198.51.100.7/32"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `tenant_suspended` | The DDoS Shield account is suspended; rules cannot be changed until it is reactivated (reads still work). |
| 403 | `limit_exceeded` | The account already has the maximum number of blocking rules. |
| 403 | `forbidden` | The account is blocked. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `ttl_min` is not 0 or between 5 and 43200, or the JSON body is malformed. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing reasons, so its rules cannot be changed until the balance is restored. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rules" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"block","note":"scanner traffic","ttl_min":1440,"values":["198.51.100.7","203.0.113.0/24","AS64500"]}'
```

---

#### Delete a blocking rule

`DELETE /v1/tenants/{tid}/targets/{id}/rules/{rid}`

Deletes a blocking rule that was created by your account (`actor` is `you` in [List blocking rules](#operation/shield_rule_list)); the rule stops applying shortly after the call returns. Rules created by an integration, intrusion prevention, AI analysis, automatic mitigation or an operator are read-only and cannot be deleted: the call fails with `403 readonly_rule`. `:id` is the target `id`; the IP address itself is accepted too.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield rule delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Your tenant (customer) identifier, of the form `acc-xxxxxxxx`, shown on the Account page of the dashboard. Any other identifier returns `404`. |
| `id` | string | yes | Protected target identifier, as returned by List protected IPs (for example `pt-1792000000`). |
| `rid` | string | yes | Blocking rule identifier, as returned by List blocking rules (for example `r-0-1792100000`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `readonly_rule` | The rule was not created by your account (it comes from the system, an integration or an operator) and can only be viewed. |
| 403 | `tenant_suspended` | The DDoS Shield account is suspended; rules cannot be changed until it is reactivated (reads still work). |
| 403 | `forbidden` | The account is blocked. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rules/<rid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Tenant overview: quota, usage and protected IPs

`GET /v1/tenants/{tid}`

Returns your DDoS Shield account: status, limits, current usage and every protected IP with its blocking rules. Rules created by the protection system or by staff appear with an actor label instead of a name.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield tenant get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Tenant identifier. |
| `name` | string | yes | Display name. |
| `status` | string | yes | `active` or `suspended`. A suspended tenant is read-only. |
| `note` | string | yes | Note. |
| `created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `registered` | boolean | yes | Whether the tenant is registered. |
| `quota` | object | yes |  |
| `quota.max_targets` | integer | yes | Maximum protected IPs, 0 = no limit. |
| `quota.max_rules` | integer | yes | Maximum blocking rules, 0 = no limit. |
| `usage` | object | yes |  |
| `usage.targets` | integer | yes | Protected IPs in use. |
| `usage.rules` | integer | yes | Rules in use. |
| `usage.waf_domains` | integer | yes | Always 0 (web firewall domains were retired). |
| `targets` | array of ShieldTargetRaw | yes |  |
| `targets[].id` | string | yes | Target identifier (`pt…`). |
| `targets[].ip` | string | yes | The protected IP address. |
| `targets[].label` | string | yes | Label: your tenant id, optionally followed by `/vm:{id}` for IPs of your servers. |
| `targets[].kind` | string: `vm`, `baremetal`, `service` | yes | What the IP belongs to. |
| `targets[].enabled` | boolean | yes | Whether protection is on. |
| `targets[].created_at` | integer | yes | When the IP was added (Unix time, seconds, UTC) |
| `targets[].rules` | array of ShieldRuleRaw | yes |  |
| `targets[].rules[].id` | string | yes | Rule identifier. |
| `targets[].rules[].kind` | string: `ip`, `cidr`, `asn`, `country` | yes | What the rule matches. |
| `targets[].rules[].value` | string | yes | The address, network, AS number or country code. |
| `targets[].rules[].prefixes` | array of string | yes |  |
| `targets[].rules[].note` | string | yes | Free-text note. |
| `targets[].rules[].by` | string | yes | Who created the rule, as an actor label: `you`, `portal`, `ips`, `ai`, `auto` or `system`. |
| `targets[].rules[].at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `targets[].rules[].mode` | string | yes | `block`, or `count` for rules that only count. |
| `targets[].rules[].expires` | integer or null | yes | Expiry of a temporary rule (Unix time, seconds, UTC) |
| `targets[].web` | ShieldWebPolicy | yes |  |
| `targets[].web.enabled` | boolean | yes | Whether web protection is on. |
| `targets[].web.syn_rate` | integer | yes | Maximum SYN packets per second from one source to the web ports. 0 = no limit. |
| `targets[].web.pkt_rate` | integer | yes | Maximum packets per second from one source to the web ports. 0 = no limit. |
| `targets[].web.ports` | array of integer | yes |  |
| `targets[].seen_at` | integer | yes | Last time traffic was seen (Unix time, seconds, UTC) |

Example:

```json
{
  "created_at": 1759000000,
  "id": "acc-42",
  "name": "Example",
  "note": "",
  "quota": {
    "max_rules": 100,
    "max_targets": 10
  },
  "registered": true,
  "status": "active",
  "targets": [
    {
      "created_at": 1759000000,
      "enabled": true,
      "id": "pt1760000000a",
      "ip": "203.0.113.10",
      "kind": "vm",
      "label": "acc-42/vm:3f6c1d0e-0000-4000-8000-000000000001",
      "rules": [
        {
          "at": 1760000000,
          "by": "you",
          "expires": null,
          "id": "r-x1760000000a",
          "kind": "ip",
          "mode": "block",
          "note": "scanner",
          "prefixes": [],
          "value": "198.51.100.72"
        }
      ],
      "seen_at": 1760000100,
      "web": {
        "enabled": false,
        "pkt_rate": 0,
        "ports": [],
        "syn_rate": 0
      }
    }
  ],
  "usage": {
    "rules": 1,
    "targets": 1,
    "waf_domains": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### All blocking rules of the tenant, flat and paged

`GET /v1/tenants/{tid}/blocks`

Lists every blocking rule of the tenant across all protected IPs in one flat list, newest first, with cursor paging. To list the rules of one IP with their hit counters use the target rule list instead.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield block list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `target` | string | no | Only rules of this protected IP (identifier or address). |
| `limit` | integer | no | Rules per page. |
| `cursor` | integer | no | Offset to continue from: pass the `next_cursor` of the previous page. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `blocks` | array of ShieldBlock | yes |  |
| `blocks[].id` | string | yes | `{target_id}:{rule_id}`. |
| `blocks[].target_id` | string | yes | Target identifier. |
| `blocks[].target_ip` | string | yes | Protected IP the rule belongs to. |
| `blocks[].kind` | string | yes | Rule kind. |
| `blocks[].value` | string | yes | Blocked address, network, AS or country. |
| `blocks[].prefixes` | integer | yes | Number of networks the rule expands to. |
| `blocks[].note` | string | yes | Note. |
| `blocks[].by` | string | yes | Actor label of the creator. |
| `blocks[].at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of rules matching. |
| `next_cursor` | integer or null | yes | Cursor of the next page, null on the last page. |

Example:

```json
{
  "blocks": [
    {
      "at": 1760000000,
      "by": "you",
      "id": "pt1760000000a:r-x1760000000a",
      "kind": "ip",
      "note": "scanner",
      "prefixes": 0,
      "target_id": "pt1760000000a",
      "target_ip": "203.0.113.10",
      "value": "198.51.100.72"
    }
  ],
  "next_cursor": null,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/blocks" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Download the tenant's blocking rules as CSV

`GET /v1/tenants/{tid}/blocks/export`

Downloads every blocking rule of the tenant as a CSV file with the columns `id,target_ip,kind,value,prefixes,note,by,at`.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield block export`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `target` | string | no | Only rules of this protected IP (identifier or address). |

**Response 200** - Success.

Content type: `text/csv`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/blocks/export" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Country code table used by country rules

`GET /v1/tenants/{tid}/countries`

Returns the countries seen in recent traffic, for building country rules. Each entry has the ISO country code and its name. The call needs the traffic analyzer to be running and returns 503 `unavailable` otherwise.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield country list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

Example:

```json
[
  {
    "cc": "VN",
    "name": "Vietnam"
  },
  {
    "cc": "US",
    "name": "United States"
  }
]
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 502 | `upstream` | The traffic analyzer refused the request. |
| 503 | `unavailable` | The traffic analyzer is not running. |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/countries" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attack events against the tenant's IPs

`GET /v1/tenants/{tid}/events`

Lists attack events against the tenant's IPs, newest first (at most 300). Events from before an IP was assigned to you are never shown. Use `brief=1` to drop the bulky sample arrays.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield tenant events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d` | no | Only events that started within this range. |
| `brief` | integer | no | Pass `1` for the short form without `samples`, with `severity`, `peak_bits`, `duration_s` and `open` added. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `events` | array of ShieldEvent | yes |  |
| `events[].id` | string | yes | Event identifier. |
| `events[].target` | string | yes | The attacked IP. |
| `events[].label` | string | yes | Attack type label. |
| `events[].started` | integer | yes | Start time (Unix time, seconds, UTC) |
| `events[].ended` | integer or null | yes | End time, null while the attack is ongoing (Unix time, seconds, UTC) |
| `events[].peak_pps` | number | yes | Peak packets per second. |
| `events[].peak_bps` | number | yes | Peak rate in BYTES per second (see `peak_bits` for bits). |
| `events[].severity` | string: `low`, `medium`, `high`, `critical` | yes | Severity derived from the peak rate. |
| `events[].peak_bits` | number | no | Peak rate in bits per second (brief form only). |
| `events[].duration_s` | integer | no | Duration in seconds (brief form only). |
| `events[].open` | boolean | no | True while the attack is ongoing (brief form only). |
| `events[].avg_packet` | number | no | Average packet size in bytes. |
| `events[].baseline_pps` | number | no | Normal packet rate before the attack. |
| `events[].top_sources` | any | no | Busiest sources seen during the attack. |
| `events[].samples` | any | no | Rate samples during the attack (omitted in the brief form). |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |
| `range` | string or null | yes | The range you asked for. |

Example:

```json
{
  "at": 1760001000,
  "events": [
    {
      "duration_s": 900,
      "ended": 1760000900,
      "id": "ev-1760000000-1",
      "label": "UDP flood",
      "open": false,
      "peak_bits": 100000000.0,
      "peak_bps": 12500000.0,
      "peak_pps": 410000.0,
      "severity": "high",
      "started": 1760000000,
      "target": "203.0.113.10"
    }
  ],
  "range": "24h"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### One attack event with packet sample

`GET /v1/tenants/{tid}/events/{eid}`

Returns one attack event with the captured packet sample (top sources, protocols and ports) and a link to the text report.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield event get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `eid` | string | yes | Attack event identifier as returned by the events calls. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `event` | ShieldEvent | yes |  |
| `event.id` | string | yes | Event identifier. |
| `event.target` | string | yes | The attacked IP. |
| `event.label` | string | yes | Attack type label. |
| `event.started` | integer | yes | Start time (Unix time, seconds, UTC) |
| `event.ended` | integer or null | yes | End time, null while the attack is ongoing (Unix time, seconds, UTC) |
| `event.peak_pps` | number | yes | Peak packets per second. |
| `event.peak_bps` | number | yes | Peak rate in BYTES per second (see `peak_bits` for bits). |
| `event.severity` | string: `low`, `medium`, `high`, `critical` | yes | Severity derived from the peak rate. |
| `event.peak_bits` | number | no | Peak rate in bits per second (brief form only). |
| `event.duration_s` | integer | no | Duration in seconds (brief form only). |
| `event.open` | boolean | no | True while the attack is ongoing (brief form only). |
| `event.avg_packet` | number | no | Average packet size in bytes. |
| `event.baseline_pps` | number | no | Normal packet rate before the attack. |
| `event.top_sources` | any | no | Busiest sources seen during the attack. |
| `event.samples` | any | no | Rate samples during the attack (omitted in the brief form). |
| `sample` | object | yes | Packet sample: `at`, `packets`, `top_sources` (`ip`, `packets`), `protocols`, `ports`. Empty when no sample was captured. |
| `ai_tasks` | array of any | yes |  |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |
| `links` | object | yes |  |
| `links.report` | string | yes | Path of the text report. |

Example:

```json
{
  "ai_tasks": [],
  "at": 1760001000,
  "event": {
    "duration_s": 900,
    "ended": 1760000900,
    "id": "ev-1760000000-1",
    "label": "UDP flood",
    "open": false,
    "peak_bits": 100000000.0,
    "peak_bps": 12500000.0,
    "peak_pps": 410000.0,
    "severity": "high",
    "started": 1760000000,
    "target": "203.0.113.10"
  },
  "links": {
    "report": "/v1/tenants/acc-42/events/ev-1760000000-1/report"
  },
  "sample": {}
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | The event identifier has invalid characters. |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/events/<eid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Plain-text incident report of an attack event

`GET /v1/tenants/{tid}/events/{eid}/report`

Downloads the incident report of an attack event as a plain-text file: target, type, times, peak rates, top sources and protocol mix. The text is written in Vietnamese.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield event report`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `eid` | string | yes | Attack event identifier as returned by the events calls. |

**Response 200** - Success.

Content type: `text/plain`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | The event identifier has invalid characters. |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/events/<eid>/report" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Upstream blackhole (RTBH) entries of the tenant's IPs

`GET /v1/tenants/{tid}/rtbh`

Lists the upstream blackhole (RTBH) entries that currently cover the tenant's IPs, including entries created by the protection system. Use the target blackhole calls for the full detail of one IP.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield rtbh list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `rtbh` | array of object | yes |  |
| `rtbh[].id` | string | yes | Entry identifier. |
| `rtbh[].ip` | string | yes | Blackholed address. |
| `rtbh[].scope` | string | yes | Scope of the blackhole. |
| `rtbh[].scope_label` | string | yes | Display label of the scope. |
| `rtbh[].status` | string | yes | Entry status. |
| `rtbh[].created` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `rtbh[].until` | integer | yes | Expiry (Unix time, seconds, UTC) |
| `rtbh[].remaining_s` | integer | yes | Seconds left. |
| `rtbh[].source` | string | yes | `manual` or `auto`. |
| `rtbh[].note` | string | yes | Note. |
| `rtbh[].event_id` | string | yes | Related attack event, if any. |

Example:

```json
{
  "rtbh": [
    {
      "created": 1760000000,
      "event_id": "",
      "id": "bh-1760000000-a1",
      "ip": "203.0.113.10",
      "note": "",
      "remaining_s": 420,
      "scope": "international",
      "scope_label": "International",
      "source": "manual",
      "status": "active",
      "until": 1760000600
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/rtbh" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Traffic shaping state of all the tenant's IPs (read-only)

`GET /v1/tenants/{tid}/shape`

Returns the traffic shaping (rate limiting) state of every protected IP of the tenant: whether a shaper applies, its limits and the live rates. Read-only.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield shape list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `engine` | string | yes | Shaping engine mode. |
| `readonly` | boolean | yes | Always true. |
| `items` | array of object | yes |  |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1760001000,
  "engine": "off",
  "items": [
    {
      "expires": null,
      "ip": "203.0.113.10",
      "live": null,
      "shaped": false,
      "shaper": null,
      "since": null,
      "state": "off",
      "target_id": "pt1760000000a"
    }
  ],
  "readonly": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/shape" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Live packet and bit rate of each protected IP

`GET /v1/tenants/{tid}/traffic/live`

Returns the current packet and bit rate of every protected IP, computed from the last two counter readings. `stale` is true when no earlier reading was available to compare with.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield traffic live`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the latest reading (Unix time, seconds, UTC) |
| `live` | object | yes | Rates keyed by protected IP. |

Example:

```json
{
  "at": 1760001000,
  "live": {
    "203.0.113.10": {
      "bps": 9600000.0,
      "pps": 1200.0,
      "stale": false,
      "window_s": 10.0
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/traffic/live" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Top attacking source IPs seen in the tenant's events

`GET /v1/tenants/{tid}/traffic/top-sources`

Returns the 50 source addresses that sent the most packets to your IPs across the recorded attack events. Useful for building block rules; the numbers come from packet samples, not from full counting.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield traffic sources`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `sources` | array of object | yes |  |
| `sources[].ip` | string | yes | Source address. |
| `sources[].packets` | integer | yes | Sampled packets from this source. |
| `note` | string | yes | Explanation when there is no data yet. |

Example:

```json
{
  "note": "",
  "sources": [
    {
      "ip": "198.51.100.72",
      "packets": 18000
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/traffic/top-sources" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Everything about one protected IP: status, history, rules, events, RTBH

`GET /v1/tenants/{tid}/targets/{id}/detail`

Returns everything about one protected IP in a single call: protection status, current and baseline rates, the last 5 and 30 minutes of history, counters, up to 10 recent events, all blocking rules with their hit counters, the web protection policy, blackhole entries and the server that holds the IP.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Target identifier. |
| `ip` | string | yes | The protected IP. |
| `label` | string | yes | Label of the target. |
| `kind` | string | yes | What the IP belongs to. |
| `enabled` | boolean | yes | Whether protection is on. |
| `protected` | boolean | yes | Same as `enabled`. |
| `created_at` | integer | yes | When the IP was added (Unix time, seconds, UTC) |
| `status` | any | yes | Traffic status: `idle`, `normal` or `attack`. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |
| `now` | any | yes | Current rates. |
| `baseline_pps` | any | yes | Normal packet rate. |
| `sigma` | any | yes | Deviation used to detect attacks. |
| `history_5m` | array of object | yes |  |
| `history_30m` | array of object | yes |  |
| `counters` | object | yes | Packet and byte counters: `in`, `out`, `at`. |
| `events` | array of ShieldEvent | yes |  |
| `events[].id` | string | yes | Event identifier. |
| `events[].target` | string | yes | The attacked IP. |
| `events[].label` | string | yes | Attack type label. |
| `events[].started` | integer | yes | Start time (Unix time, seconds, UTC) |
| `events[].ended` | integer or null | yes | End time, null while the attack is ongoing (Unix time, seconds, UTC) |
| `events[].peak_pps` | number | yes | Peak packets per second. |
| `events[].peak_bps` | number | yes | Peak rate in BYTES per second (see `peak_bits` for bits). |
| `events[].severity` | string: `low`, `medium`, `high`, `critical` | yes | Severity derived from the peak rate. |
| `events[].peak_bits` | number | no | Peak rate in bits per second (brief form only). |
| `events[].duration_s` | integer | no | Duration in seconds (brief form only). |
| `events[].open` | boolean | no | True while the attack is ongoing (brief form only). |
| `events[].avg_packet` | number | no | Average packet size in bytes. |
| `events[].baseline_pps` | number | no | Normal packet rate before the attack. |
| `events[].top_sources` | any | no | Busiest sources seen during the attack. |
| `events[].samples` | any | no | Rate samples during the attack (omitted in the brief form). |
| `open_event` | ShieldEvent or null | yes |  |
| `rules` | array of object | yes |  |
| `rules_total` | integer | yes | Number of rules. |
| `web` | ShieldWebPolicy | yes |  |
| `web.enabled` | boolean | yes | Whether web protection is on. |
| `web.syn_rate` | integer | yes | Maximum SYN packets per second from one source to the web ports. 0 = no limit. |
| `web.pkt_rate` | integer | yes | Maximum packets per second from one source to the web ports. 0 = no limit. |
| `web.ports` | array of integer | yes |  |
| `ipv4_only` | boolean | yes | True when the IP is IPv6 and web protection is unavailable. |
| `rtbh` | array of ShieldRtbhEntry | yes |  |
| `rtbh[].id` | string | yes | Blackhole entry identifier. |
| `rtbh[].ip` | string | yes | The blackholed address. |
| `rtbh[].scope` | string: `international`, `domestic`, `all` | yes | Which traffic is dropped: from abroad, from the home country, or everything. |
| `rtbh[].scope_label` | string | yes | Display label of the scope. |
| `rtbh[].status` | string | yes | `pending`, `announced`, `active`, `expired` or `withdrawn`. |
| `rtbh[].created` | integer | yes | When the entry was created (Unix time, seconds, UTC) |
| `rtbh[].until` | integer | yes | When the entry expires (Unix time, seconds, UTC) |
| `rtbh[].ttl_s` | integer | yes | Lifetime in seconds. |
| `rtbh[].remaining_s` | integer | yes | Seconds left before it expires. |
| `rtbh[].source` | string | yes | `manual` for entries you created, `auto` for entries created by the protection system. |
| `rtbh[].note` | string | yes | Note. |
| `rtbh[].event_id` | string | yes | Attack event the entry relates to, if any. |
| `rtbh[].pps_before` | number or null | yes | Packet rate before the blackhole |
| `rtbh[].bps_before` | number or null | yes | Bit rate before the blackhole |
| `rtbh[].pps_now` | number or null | yes | Packet rate now |
| `rtbh[].bps_now` | number or null | yes | Bit rate now |
| `rtbh[].drop_ratio` | number or null | yes | Share of traffic that is being dropped, 0 to 1 |
| `rtbh[].withdrawn_at` | integer or null | yes | When the entry was withdrawn (Unix time, seconds, UTC) |
| `rtbh[].mine` | boolean | yes | True when you created the entry; only those can be withdrawn or extended. |
| `rtbh[].actor` | string | yes | Actor label of the creator. |
| `vm` | object or null | yes |  |
| `vm.id` | string | yes | Server identifier. |
| `vm.hostname` | string | yes | Host name. |
| `vm.display_name` | string | yes | Display name. |
| `vm.state` | string | yes | Server state. |
| `vm.locked` | boolean | yes | True when the server is locked for billing. |

Example:

```json
{
  "at": 1760001000,
  "baseline_pps": 1000,
  "counters": {
    "at": 1760001000,
    "in": {},
    "out": {}
  },
  "created_at": 1759000000,
  "enabled": true,
  "events": [],
  "history_30m": [],
  "history_5m": [],
  "id": "pt1760000000a",
  "ip": "203.0.113.10",
  "ipv4_only": false,
  "kind": "vm",
  "label": "acc-42",
  "now": {},
  "open_event": null,
  "protected": true,
  "rtbh": [],
  "rules": [],
  "rules_total": 0,
  "sigma": 0,
  "status": "idle",
  "vm": null,
  "web": {
    "enabled": false,
    "pkt_rate": 0,
    "ports": [],
    "syn_rate": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/detail" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Download one IP's blocking rules as CSV

`GET /v1/tenants/{tid}/targets/{id}/rules/export`

Downloads the blocking rules of one protected IP as a CSV file with the columns `id,kind,value,mode,source,note,created_at,expires_at,hits_packets,hits_bytes,prefixes`.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield rule export`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Response 200** - Success.

Content type: `text/csv`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rules/export" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Live connections of one protected IP

`GET /v1/tenants/{tid}/targets/{id}/flows`

Lists the live connections of one protected IP, the busiest first: peer address, ports, protocol, bytes, packets and duration, refreshed every few seconds. Returns 503 `unavailable` when the traffic analyzer is not running.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target flows`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `dir` | string: `in`, `out`, `both` | no | Direction of the connections. |
| `fam` | string: `4`, `6` | no | Address family. |
| `win` | integer | no | Window in seconds the byte counts cover; 0 = the whole session. |
| `n` | integer | no | Maximum rows. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `rows` | array of object | yes |  |
| `sessions` | integer | yes | Number of rows returned. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1760001000,
  "ip": "203.0.113.10",
  "rows": [],
  "sessions": 0
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 502 | `upstream` | The traffic analyzer refused the request. |
| 503 | `unavailable` | The traffic analyzer is not running. |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/flows" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Top traffic sources of one protected IP over a range

`GET /v1/tenants/{tid}/targets/{id}/top`

Returns the traffic of one protected IP broken down by source country, source network, protocol and port over a time range, with a rate series for charting. The series columns are named in `series_cols`. Returns 503 `unavailable` when the traffic analyzer is not running.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target top`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `15m`, `1h`, `6h`, `24h` | no | Time range. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `range` | string | yes | The range that was returned. |
| `series_cols` | array of string | yes |  |
| `countries` | any | yes | Traffic per source country. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1760001000,
  "countries": [],
  "ip": "203.0.113.10",
  "range": "1h",
  "series_cols": [
    "t",
    "in_bps",
    "in_pps",
    "out_bps",
    "out_pps"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 502 | `upstream` | The traffic analyzer refused the request. |
| 503 | `unavailable` | The traffic analyzer is not running. |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/top" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Action log of one protected IP (last 24 hours)

`GET /v1/tenants/{tid}/targets/{id}/logs`

Returns the action log of one protected IP for the last 24 hours at most: rules added and removed, blackholes, web protection changes, AI requests and agent commands, each with the actor that did it.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target logs`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `since` | integer | no | Only entries after this Unix time. Cannot go back further than 24 hours. |
| `n` | integer | no | Maximum entries. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `since` | integer | yes | Start of the returned window (Unix time, seconds, UTC) |
| `entries` | array of object | yes |  |
| `entries[].t` | integer | yes | Time (Unix time, seconds, UTC) |
| `entries[].kind` | string | yes | Entry kind, e.g. `rule`, `unrule`, `rtbh`, `web`, `ai`, `agent`. |
| `entries[].actor` | string | yes | Actor label: `you`, `portal`, `ips`, `ai`, `auto` or `system`. |
| `entries[].msg` | string | yes | Message. |
| `entries[].data` | any | yes | Structured details. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1760001000,
  "entries": [
    {
      "actor": "you",
      "data": {},
      "kind": "rule",
      "msg": "block 198.51.100.72",
      "t": 1760000000
    }
  ],
  "ip": "203.0.113.10",
  "since": 1759914600
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/logs" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Intrusion-prevention (IPS) alerts aimed at one protected IP

`GET /v1/tenants/{tid}/targets/{id}/ips`

Returns the most recent intrusion-prevention (IPS) alerts aimed at one protected IP: source, ports, protocol, signature, category and severity (1 = highest). Alerts of other IPs are never shown.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target ips`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `n` | integer | no | Maximum alerts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `running` | boolean | yes | Whether the intrusion-prevention engine is running. |
| `alerts` | array of object | yes |  |
| `alerts[].time` | string | yes | Alert time as an ISO 8601 string. |
| `alerts[].src` | string | yes | Source address. |
| `alerts[].src_port` | any | yes | Source port. |
| `alerts[].dst_port` | any | yes | Destination port. |
| `alerts[].proto` | string | yes | Protocol. |
| `alerts[].signature` | string | yes | Rule that matched. |
| `alerts[].category` | string | yes | Rule category. |
| `alerts[].severity` | integer | yes | Severity, 1 (high) to 3 (low). |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "alerts": [],
  "at": 1760001000,
  "ip": "203.0.113.10",
  "running": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/ips" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Web protection policy of one protected IP

`GET /v1/tenants/{tid}/targets/{id}/web`

Returns the web protection policy of one protected IP: per-source SYN and packet rate limits applied to the web ports, plus the allowed ranges and how often the policy may change.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target web`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `protected` | boolean | yes | Whether protection is on. |
| `ipv4_only` | boolean | yes | True for IPv6 addresses, where web protection is unavailable. |
| `web` | ShieldWebPolicy | yes |  |
| `web.enabled` | boolean | yes | Whether web protection is on. |
| `web.syn_rate` | integer | yes | Maximum SYN packets per second from one source to the web ports. 0 = no limit. |
| `web.pkt_rate` | integer | yes | Maximum packets per second from one source to the web ports. 0 = no limit. |
| `web.ports` | array of integer | yes |  |
| `floors` | object | yes |  |
| `floors.syn_rate_max` | integer | yes | Highest allowed `syn_rate`. |
| `floors.pkt_rate_max` | integer | yes | Highest allowed `pkt_rate`. |
| `floors.ports_max` | integer | yes | Most ports allowed. |
| `apply_interval_min` | integer | yes | Minimum minutes between two changes of the policy. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "apply_interval_min": 10,
  "at": 1760001000,
  "floors": {
    "pkt_rate_max": 1000000,
    "ports_max": 16,
    "syn_rate_max": 100000
  },
  "ip": "203.0.113.10",
  "ipv4_only": false,
  "protected": true,
  "web": {
    "enabled": false,
    "pkt_rate": 0,
    "ports": [],
    "syn_rate": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/web" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Blackhole (RTBH) entries of one protected IP

`GET /v1/tenants/{tid}/targets/{id}/rtbh`

Returns the blackhole (RTBH) entries of one protected IP, the active one if any, and the allowed scopes and lifetimes for [Blackhole an IP](#operation/shield_target_blackhole).

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target rtbh`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `rtbh` | array of ShieldRtbhEntry | yes |  |
| `rtbh[].id` | string | yes | Blackhole entry identifier. |
| `rtbh[].ip` | string | yes | The blackholed address. |
| `rtbh[].scope` | string: `international`, `domestic`, `all` | yes | Which traffic is dropped: from abroad, from the home country, or everything. |
| `rtbh[].scope_label` | string | yes | Display label of the scope. |
| `rtbh[].status` | string | yes | `pending`, `announced`, `active`, `expired` or `withdrawn`. |
| `rtbh[].created` | integer | yes | When the entry was created (Unix time, seconds, UTC) |
| `rtbh[].until` | integer | yes | When the entry expires (Unix time, seconds, UTC) |
| `rtbh[].ttl_s` | integer | yes | Lifetime in seconds. |
| `rtbh[].remaining_s` | integer | yes | Seconds left before it expires. |
| `rtbh[].source` | string | yes | `manual` for entries you created, `auto` for entries created by the protection system. |
| `rtbh[].note` | string | yes | Note. |
| `rtbh[].event_id` | string | yes | Attack event the entry relates to, if any. |
| `rtbh[].pps_before` | number or null | yes | Packet rate before the blackhole |
| `rtbh[].bps_before` | number or null | yes | Bit rate before the blackhole |
| `rtbh[].pps_now` | number or null | yes | Packet rate now |
| `rtbh[].bps_now` | number or null | yes | Bit rate now |
| `rtbh[].drop_ratio` | number or null | yes | Share of traffic that is being dropped, 0 to 1 |
| `rtbh[].withdrawn_at` | integer or null | yes | When the entry was withdrawn (Unix time, seconds, UTC) |
| `rtbh[].mine` | boolean | yes | True when you created the entry; only those can be withdrawn or extended. |
| `rtbh[].actor` | string | yes | Actor label of the creator. |
| `active` | ShieldRtbhEntry or null | yes |  |
| `scopes` | array of string | yes |  |
| `ttl_presets` | array of integer | yes |  |
| `ttl_min` | integer | yes | Shortest lifetime in seconds. |
| `ttl_max` | integer | yes | Longest lifetime in seconds. |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "active": {
    "actor": "you",
    "bps_before": 31000000.0,
    "bps_now": 800000.0,
    "created": 1760000000,
    "drop_ratio": 0.97,
    "event_id": "",
    "id": "bh-1760000000-a1",
    "ip": "203.0.113.10",
    "mine": true,
    "note": "",
    "pps_before": 52000.0,
    "pps_now": 1200.0,
    "remaining_s": 420,
    "scope": "international",
    "scope_label": "International",
    "source": "manual",
    "status": "active",
    "ttl_s": 600,
    "until": 1760000600,
    "withdrawn_at": null
  },
  "at": 1760000100,
  "ip": "203.0.113.10",
  "rtbh": [
    {
      "actor": "you",
      "bps_before": 31000000.0,
      "bps_now": 800000.0,
      "created": 1760000000,
      "drop_ratio": 0.97,
      "event_id": "",
      "id": "bh-1760000000-a1",
      "ip": "203.0.113.10",
      "mine": true,
      "note": "",
      "pps_before": 52000.0,
      "pps_now": 1200.0,
      "remaining_s": 420,
      "scope": "international",
      "scope_label": "International",
      "source": "manual",
      "status": "active",
      "ttl_s": 600,
      "until": 1760000600,
      "withdrawn_at": null
    }
  ],
  "scopes": [
    "international",
    "domestic"
  ],
  "ttl_max": 86400,
  "ttl_min": 60,
  "ttl_presets": [
    600,
    1800,
    3600,
    21600,
    86400
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rtbh" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Traffic shaping state and history of one protected IP (read-only)

`GET /v1/tenants/{tid}/targets/{id}/shape`

Returns the traffic shaping state of one protected IP: the shaper in effect with its limits, live rates in both directions and a history series. Read-only.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target shape`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `24h` | no | History range. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `engine` | string | yes | Shaping engine mode. |
| `shaped` | boolean | yes | Whether a shaper applies to this IP. |
| `readonly` | boolean | yes | Always true. |
| `shaper` | object or null | yes | Shaper in effect: `name`, `port_mbps`, `rate_mbps`, `burst_secs`, `direction`. |
| `since` | integer or null | yes | When the shaper started (Unix time, seconds, UTC) |
| `expires` | integer or null | yes | When the shaper stops (Unix time, seconds, UTC) |
| `live` | object or null | yes | Live `in` and `out` rates and drops. |
| `history` | object or null | yes | History: `range`, `step_s`, `in`, `out`. |

Example:

```json
{
  "engine": "off",
  "expires": null,
  "history": null,
  "ip": "203.0.113.10",
  "live": null,
  "readonly": true,
  "shaped": false,
  "shaper": null,
  "since": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/shape" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### AI analysis tasks of one protected IP and today's quota

`GET /v1/tenants/{tid}/targets/{id}/ai/tasks`

Lists the AI analysis tasks of one protected IP, newest first, with the analyses still waiting and your quota for today. The analyzer states whether the traffic looks like an attack, why, and which blocking actions it proposes or applied. Start one with [Ask the AI to analyze](#operation/shield_target_analyze).

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target ai-tasks`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `n` | integer | no | Maximum tasks. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `tasks` | array of ShieldAiTask | yes |  |
| `tasks[].id` | string | yes | Task identifier. |
| `tasks[].at` | integer | yes | When the analysis finished (Unix time, seconds, UTC) |
| `tasks[].event_id` | string or null | yes | Attack event that was analyzed, or null for the last 30 minutes. |
| `tasks[].trigger` | any | yes | What started the analysis. |
| `tasks[].status` | any | yes | Task status. |
| `tasks[].verdict` | any | yes | Verdict, e.g. `attack`. |
| `tasks[].confidence` | number or null | yes | Confidence between 0 and 1. |
| `tasks[].kind` | any | yes | Attack type. |
| `tasks[].severity` | any | yes | Severity. |
| `tasks[].summary` | string | yes | Short explanation. |
| `tasks[].evidence` | array of string | yes |  |
| `tasks[].actions` | array of object | yes |  |
| `tasks[].actions[].type` | any | yes | Action type. |
| `tasks[].actions[].value` | any | yes | Action value, e.g. an address. |
| `tasks[].actions[].reason` | any | yes | Why the action is proposed. |
| `tasks[].actions[].valid` | boolean | yes | Whether the action passed validation. |
| `tasks[].applied` | array of any | yes |  |
| `tasks[].ms` | integer or null | yes | Processing time in milliseconds. |
| `tasks[].note` | string | yes | Note. |
| `queued` | integer | yes | Analyses requested and not finished yet. |
| `ai_ready` | boolean | yes | Whether the analyzer is available. |
| `quota` | ShieldAiQuota | yes |  |
| `quota.ip_used` | integer | yes | Analyses used today (UTC) for this IP. |
| `quota.ip_max` | integer | yes | Daily limit per IP (3). |
| `quota.account_used` | integer | yes | Analyses used today (UTC) across your tenant. |
| `quota.account_max` | integer | yes | Daily limit per tenant (10). |
| `at` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |

Example:

```json
{
  "ai_ready": true,
  "at": 1760001000,
  "ip": "203.0.113.10",
  "queued": 0,
  "quota": {
    "account_max": 10,
    "account_used": 1,
    "ip_max": 3,
    "ip_used": 1
  },
  "tasks": []
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/ai/tasks" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### One AI analysis task

`GET /v1/tenants/{tid}/targets/{id}/ai/tasks/{task}`

Returns one AI analysis task of a protected IP.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target ai-task`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |
| `task` | string | yes | AI analysis task identifier as returned by the AI task list. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `task` | ShieldAiTask | yes |  |
| `task.id` | string | yes | Task identifier. |
| `task.at` | integer | yes | When the analysis finished (Unix time, seconds, UTC) |
| `task.event_id` | string or null | yes | Attack event that was analyzed, or null for the last 30 minutes. |
| `task.trigger` | any | yes | What started the analysis. |
| `task.status` | any | yes | Task status. |
| `task.verdict` | any | yes | Verdict, e.g. `attack`. |
| `task.confidence` | number or null | yes | Confidence between 0 and 1. |
| `task.kind` | any | yes | Attack type. |
| `task.severity` | any | yes | Severity. |
| `task.summary` | string | yes | Short explanation. |
| `task.evidence` | array of string | yes |  |
| `task.actions` | array of object | yes |  |
| `task.actions[].type` | any | yes | Action type. |
| `task.actions[].value` | any | yes | Action value, e.g. an address. |
| `task.actions[].reason` | any | yes | Why the action is proposed. |
| `task.actions[].valid` | boolean | yes | Whether the action passed validation. |
| `task.applied` | array of any | yes |  |
| `task.ms` | integer or null | yes | Processing time in milliseconds. |
| `task.note` | string | yes | Note. |
| `ip` | string | yes | The protected IP. |

Example:

```json
{
  "ip": "203.0.113.10",
  "task": {
    "actions": [
      {
        "reason": "top source",
        "type": "block",
        "valid": true,
        "value": "198.51.100.72"
      }
    ],
    "applied": [],
    "at": 1760000500,
    "confidence": 0.92,
    "event_id": null,
    "evidence": [
      "52k pps of UDP to port 53"
    ],
    "id": "t-1",
    "kind": "udp_flood",
    "ms": 2300,
    "note": "",
    "severity": "high",
    "status": "done",
    "summary": "UDP flood from a few networks",
    "trigger": "customer",
    "verdict": "attack"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/ai/tasks/<task>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Monitoring agent installed on the VM that holds this IP

`GET /v1/tenants/{tid}/targets/{id}/agent`

Returns the monitoring agent installed on the server that holds this IP: its settings, the last 60 samples, the addresses it currently blocks and its baseline. `agent` is null when none is installed. This call only reads: it never starts an installation, whatever the credential (`installing` is always false). Installing the agent is done from the dashboard.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `shield target agent`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string | yes | The protected IP. |
| `agent` | ShieldAgentInfo or null | yes |  |
| `samples` | array of object | no |  |
| `blocks` | array of string | no |  |
| `baseline` | object | no |  |
| `baseline.pps` | number | yes | Normal packets per second. |
| `baseline.conns` | number | yes | Normal connections. |
| `now` | integer | yes | Time of the snapshot (Unix time, seconds, UTC) |
| `token_available` | boolean | yes | Legacy flag, always true. |
| `installing` | boolean | no | Always false; kept for compatibility. |

Example:

```json
{
  "agent": {
    "arch": "amd64",
    "enforce": false,
    "enrolled_at": 1759500000,
    "id": "ag-8c2d1f",
    "last_seen": 1760000050,
    "name": "web-1",
    "note": "",
    "os": "linux",
    "status": "active",
    "thr_conns": 0,
    "thr_pps": 0,
    "version": "1.4.2"
  },
  "baseline": {
    "conns": 120.0,
    "pps": 800.0
  },
  "blocks": [],
  "ip": "203.0.113.10",
  "now": 1760001000,
  "samples": [],
  "token_available": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/tenants/<tid>/targets/<id>/agent" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Delete up to 100 of your own blocking rules at once

`POST /v1/tenants/{tid}/targets/{id}/rules/bulk-delete`

Deletes up to 100 blocking rules of one protected IP in a single call. Only rules you created are deleted; rules made by the protection system or by staff are skipped and listed in `skipped` with the reason. Unknown identifiers are skipped too.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield rule bulk-delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `ids` | array of string | yes | Rules to delete, 1 to 100. |

Example:

```json
{
  "ids": [
    "r-x1760000000a",
    "r-x1760000000b"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `deleted` | integer | yes | Number of rules deleted. |
| `skipped` | array of string | yes |  |

Example:

```json
{
  "deleted": 1,
  "skipped": [
    "r-x1760000000b (not found)"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `ids` is empty or has more than 100 entries. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rules/bulk-delete" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids":["r-x1760000000a","r-x1760000000b"]}'
```

---

#### Change web protection (per-source SYN / packet rate limits) of one IPv4

`PUT /v1/tenants/{tid}/targets/{id}/web`

Changes the web protection of one protected IPv4: per-source SYN and packet rate limits on the web ports. Values above the allowed maximum are clamped. Sending the policy that is already in effect succeeds with `unchanged: true`. A policy can change at most once every 10 minutes per IP.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield target set-web`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Turn web protection on or off. |
| `syn_rate` | integer | yes | SYN packets per second per source (0 = no limit, capped at 100000). |
| `pkt_rate` | integer | yes | Packets per second per source (0 = no limit, capped at 1000000). |
| `ports` | array of integer | yes | Web ports to protect, at most 16. Empty means 80 and 443. |

Example:

```json
{
  "enabled": true,
  "pkt_rate": 1000,
  "ports": [
    80,
    443
  ],
  "syn_rate": 100
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `web` | ShieldWebPolicy | yes |  |
| `web.enabled` | boolean | yes | Whether web protection is on. |
| `web.syn_rate` | integer | yes | Maximum SYN packets per second from one source to the web ports. 0 = no limit. |
| `web.pkt_rate` | integer | yes | Maximum packets per second from one source to the web ports. 0 = no limit. |
| `web.ports` | array of integer | yes |  |
| `applied` | boolean | no | True when the change was saved. |
| `unchanged` | boolean | no | True when the policy was already in effect. |

Example:

```json
{
  "applied": true,
  "ok": true,
  "web": {
    "enabled": true,
    "pkt_rate": 1000,
    "ports": [
      80,
      443
    ],
    "syn_rate": 100
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | Web protection cannot be turned on for an IPv6 address. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing. |
| 429 | `rate_limited` | The policy was changed less than 10 minutes ago. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/tenants/<tid>/targets/<id>/web" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"pkt_rate":1000,"ports":[80,443],"syn_rate":100}'
```

---

#### Blackhole one of your IPs upstream (RTBH) — the IP goes offline for the chosen scope

`POST /v1/tenants/{tid}/targets/{id}/rtbh`

Blackholes one of your IPs at the upstream network (RTBH): traffic to the IP is dropped before it reaches you, which stops a volumetric attack but takes the IP offline for the chosen scope. `international` drops traffic from abroad, `domestic` drops domestic traffic; dropping everything is not available to customers. To prevent accidents you must repeat the IP in `confirm`. Only one active entry per IP, and the entry expires after `ttl_s`. Withdraw it early with [Withdraw a blackhole](#operation/shield_rtbh_delete). Send an `Idempotency-Key` to retry safely.

**Required scope:** `shield:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `shield:write` | CLI: `shield target blackhole` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `scope` | string: `international`, `domestic` | no | Which traffic to drop. Default `international`. |
| `ttl_s` | integer | no | Lifetime in seconds, from 60 to 86400. Default 3600. |
| `confirm` | string | yes | The protected IP address, typed again. Must match exactly. |
| `note` | string | no | Note, up to 120 characters. |
| `event_id` | string | no | Attack event this blackhole responds to. |

Example:

```json
{
  "confirm": "203.0.113.10",
  "note": "UDP flood",
  "scope": "international",
  "ttl_s": 3600
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `entry` | ShieldRtbhEntry | yes |  |
| `entry.id` | string | yes | Blackhole entry identifier. |
| `entry.ip` | string | yes | The blackholed address. |
| `entry.scope` | string: `international`, `domestic`, `all` | yes | Which traffic is dropped: from abroad, from the home country, or everything. |
| `entry.scope_label` | string | yes | Display label of the scope. |
| `entry.status` | string | yes | `pending`, `announced`, `active`, `expired` or `withdrawn`. |
| `entry.created` | integer | yes | When the entry was created (Unix time, seconds, UTC) |
| `entry.until` | integer | yes | When the entry expires (Unix time, seconds, UTC) |
| `entry.ttl_s` | integer | yes | Lifetime in seconds. |
| `entry.remaining_s` | integer | yes | Seconds left before it expires. |
| `entry.source` | string | yes | `manual` for entries you created, `auto` for entries created by the protection system. |
| `entry.note` | string | yes | Note. |
| `entry.event_id` | string | yes | Attack event the entry relates to, if any. |
| `entry.pps_before` | number or null | yes | Packet rate before the blackhole |
| `entry.bps_before` | number or null | yes | Bit rate before the blackhole |
| `entry.pps_now` | number or null | yes | Packet rate now |
| `entry.bps_now` | number or null | yes | Bit rate now |
| `entry.drop_ratio` | number or null | yes | Share of traffic that is being dropped, 0 to 1 |
| `entry.withdrawn_at` | integer or null | yes | When the entry was withdrawn (Unix time, seconds, UTC) |
| `entry.mine` | boolean | yes | True when you created the entry; only those can be withdrawn or extended. |
| `entry.actor` | string | yes | Actor label of the creator. |
| `warnings` | array of string | yes |  |

Example:

```json
{
  "entry": {
    "actor": "you",
    "bps_before": 31000000.0,
    "bps_now": 800000.0,
    "created": 1760000000,
    "drop_ratio": 0.97,
    "event_id": "",
    "id": "bh-1760000000-a1",
    "ip": "203.0.113.10",
    "mine": true,
    "note": "",
    "pps_before": 52000.0,
    "pps_now": 1200.0,
    "remaining_s": 420,
    "scope": "international",
    "scope_label": "International",
    "source": "manual",
    "status": "active",
    "ttl_s": 600,
    "until": 1760000600,
    "withdrawn_at": null
  },
  "ok": true,
  "warnings": [
    "covering prefix: 203.0.113.0/24"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `already_active` | The IP already has an active blackhole entry; withdraw or extend it. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `confirm_required` | `confirm` does not match the IP address. |
| 422 | `invalid_argument` | The scope or lifetime is not allowed, or the IP cannot be blackholed. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/targets/<id>/rtbh" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"203.0.113.10","note":"UDP flood","scope":"international","ttl_s":3600}'
```

---

#### Withdraw a blackhole entry you created

`DELETE /v1/tenants/{tid}/rtbh/{bid}`

Withdraws a blackhole entry that you created, so traffic to the IP flows again. Entries created by the protection system or by staff cannot be withdrawn this way.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield rtbh delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `bid` | string | yes | Blackhole entry identifier as returned by the blackhole calls. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `entry` | object | yes | The entry after withdrawal. |

Example:

```json
{
  "entry": {
    "id": "bh-1760000000-a1",
    "ip": "203.0.113.10",
    "status": "withdrawn"
  },
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `readonly_rtbh` | The entry was created by the system or staff; it is read-only for you. |
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | The entry is already withdrawn or expired. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/tenants/<tid>/rtbh/<bid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Reset the lifetime of a blackhole entry you created

`POST /v1/tenants/{tid}/rtbh/{bid}/extend`

Restarts the lifetime of a blackhole entry that you created: it now expires `ttl_s` seconds from now (it does not add to the old remaining time).

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `shield rtbh extend`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `bid` | string | yes | Blackhole entry identifier as returned by the blackhole calls. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `ttl_s` | integer | yes | New lifetime in seconds, from 60 to 86400. |

Example:

```json
{
  "ttl_s": 1800
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `entry` | object | yes | The entry with its new expiry. |

Example:

```json
{
  "entry": {
    "id": "bh-1760000000-a1",
    "ip": "203.0.113.10",
    "ttl_s": 1800
  },
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `readonly_rtbh` | The entry was created by the system or staff; it is read-only for you. |
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `ttl_s` is out of range, or the entry already expired. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/rtbh/<bid>/extend" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ttl_s":1800}'
```

---

#### Ask the AI to analyze one protected IP (uses a daily quota)

`POST /v1/tenants/{tid}/targets/{id}/ai/analyze`

Asks the AI to analyze one protected IP, either one of its attack events or its last 30 minutes of traffic. The request is queued and the result appears in the AI task list within a minute or two. Each IP allows 3 analyses per day and the tenant 10 per day (UTC); the call is rejected with `quota_exceeded` after that. Send an `Idempotency-Key` so that a retried call does not use a second analysis.

**Required scope:** `shield:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `shield:write` | CLI: `shield target analyze` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `event_id` | string | no | Attack event of this IP to analyze. Omit to analyze the last 30 minutes. |
| `note` | string | no | Hint for the analyzer, up to 60 characters. |

Example:

```json
{
  "event_id": "ev-1760000000-1",
  "note": "UDP to port 53"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `id` | string | yes | Identifier of the queued request. |
| `quota` | ShieldAiQuota | yes |  |
| `quota.ip_used` | integer | yes | Analyses used today (UTC) for this IP. |
| `quota.ip_max` | integer | yes | Daily limit per IP (3). |
| `quota.account_used` | integer | yes | Analyses used today (UTC) across your tenant. |
| `quota.account_max` | integer | yes | Daily limit per tenant (10). |

Example:

```json
{
  "id": "q-1760001000-a1b2c3",
  "ok": true,
  "quota": {
    "account_max": 10,
    "account_used": 1,
    "ip_max": 3,
    "ip_used": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `event_id` has invalid characters. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing. |
| 429 | `quota_exceeded` | The daily analysis quota is used up; the body has `quota`. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/targets/<id>/ai/analyze" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"event_id":"ev-1760000000-1","note":"UDP to port 53"}'
```

---

#### Change agent note, auto-block switch and thresholds

`PATCH /v1/tenants/{tid}/targets/{id}/agent`

Changes the settings of the monitoring agent on the server that holds this IP. Turning `enforce` on lets the agent block, by itself, any source that exceeds the thresholds, which can cut off real users if the thresholds are too low. Send at least one field. The agent must already be installed.

**Required scope:** `shield:agent`.

Scope: `shield:agent` | CLI: `shield target update-agent` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `note` | string | no | Note, up to 120 characters. |
| `enforce` | boolean | no | Block sources automatically when a threshold is exceeded. |
| `thr_pps` | integer | no | Packets per second per source above which a source is blocked. 0 = default. |
| `thr_conns` | integer | no | Connections per source above which a source is blocked. 0 = default. |

Example:

```json
{
  "enforce": true,
  "thr_pps": 50000
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `agent` | ShieldAgentInfo | yes |  |
| `agent.id` | string | yes | Agent identifier. |
| `agent.name` | string | yes | Agent name. |
| `agent.status` | string | yes | `active` or `suspended`. |
| `agent.os` | string | yes | Operating system. |
| `agent.arch` | string | yes | CPU architecture. |
| `agent.version` | string | yes | Agent version. |
| `agent.enrolled_at` | integer | yes | When the agent was set up (Unix time, seconds, UTC) |
| `agent.last_seen` | integer | yes | Last heartbeat (0 = never) (Unix time, seconds, UTC) |
| `agent.enforce` | boolean | yes | Whether the agent blocks sources by itself when a threshold is exceeded. |
| `agent.thr_pps` | integer | yes | Packets-per-second threshold per source, 0 = default (20000). |
| `agent.thr_conns` | integer | yes | Connections threshold per source, 0 = default (8000). |
| `agent.note` | string | yes | Note. |

Example:

```json
{
  "agent": {
    "arch": "amd64",
    "enforce": true,
    "enrolled_at": 1759500000,
    "id": "ag-8c2d1f",
    "last_seen": 1760000050,
    "name": "web-1",
    "note": "",
    "os": "linux",
    "status": "active",
    "thr_conns": 0,
    "thr_pps": 50000,
    "version": "1.4.2"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | No agent is installed on this server. |
| 422 | `invalid_argument` | No field to change was sent. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/tenants/<tid>/targets/<id>/agent" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enforce":true,"thr_pps":50000}'
```

---

#### Send a block, unblock or acct command to the agent

`POST /v1/tenants/{tid}/targets/{id}/agent/cmd`

Sends a command to the agent on your server. `block` and `unblock` add or remove one source address in the agent's block list; `acct` asks the agent to refresh its accounting. The agent picks the command up at its next heartbeat. Only single public addresses are accepted: your own IPs, the agent's own address and private ranges are refused. This acts directly on your server, so keep the key that has this scope tightly guarded.

**Required scope:** `shield:agent`.

Scope: `shield:agent` | CLI: `shield target agent-command` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tid` | string | yes | Tenant identifier of your DDoS Shield (as shown in the dashboard). |
| `id` | string | yes | Protected target: its identifier (`pt…`) or the protected IP address itself. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cmd` | string: `block`, `unblock`, `acct` | yes | Command. |
| `ip` | string | no | Single IPv4 or IPv6 address for `block` and `unblock`. |

Example:

```json
{
  "cmd": "block",
  "ip": "198.51.100.72"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`; the command is queued for the agent. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `tenant_suspended` | The tenant is suspended and is read-only. |
| 404 | `not_found` | No agent is installed on this server. |
| 422 | `invalid_argument` | Unknown command, not a single address, or the address is one of yours or private. |
| 423 | `vm_locked` | The server that holds this IP is locked for billing. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/tenants/<tid>/targets/<id>/agent/cmd" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cmd":"block","ip":"198.51.100.72"}'
```

---

### Kubernetes

Managed Kubernetes clusters: a free, fully managed control plane plus worker nodes that you pick from a fixed list of worker plans. Workers are billed like servers (by the hour while they run, or up front for monthly and longer billing cycles) and the control plane costs nothing. Creating, scaling, starting, stopping and deleting a cluster are asynchronous: the call answers `202 Accepted` with an operation, and the cluster reports `state` and `op` while the work runs. Creating, scaling and deleting charge or release wallet money, so they require an `Idempotency-Key`. A cluster is `provisioning` until it is built, then `active` or `stopped`; it becomes `locked` when the wallet or the site blocks it, and `deleting` then `deleted` when removed. Kubernetes is hidden on sites that do not sell it. On such a site the catalog, quote, create and scale calls answer `403 k8s_disabled`, while existing clusters can still be listed, started, stopped, deleted and their kubeconfig downloaded.

#### Cluster Bandwidth (per-worker quota, Add-ons, usage)

`GET /v1/k8s/clusters/{id}/bandwidth`

Returns the traffic allowance and usage of the cluster for the current monthly period: the included quota (which grows with the average number of workers over the period), Add-ons bought for the period, traffic used so far, what happens when the allowance runs out, and a usage series. It is the cluster view of the Bandwidth tag: use that tag to compare services or to buy an Add-on (`kind` is `k8s` and `ref` is the cluster `id`). Deleted or failed clusters answer `404`.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster bandwidth`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `series` | string: `24h`, `7d`, `30d`, `period` | no | Time range of the usage series: hourly points for `24h`, daily points otherwise. Other values behave as `period`, the current monthly period. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `kind` | string | yes | Always `k8s` for a cluster. |
| `ref` | string | yes | Cluster identifier. |
| `name` | string | yes | Cluster name. |
| `sub` | string | yes | Public IP address of the cluster, or an empty string. |
| `state` | string | yes | Cluster state, see the `state` field of a cluster. |
| `account_id` | integer | yes | Identifier of the owning account. |
| `period` | object | yes | Current accounting period. |
| `period.start` | integer | yes | Start of the current monthly period (Unix time, seconds, UTC) |
| `period.end` | integer | yes | End of the current monthly period (when the counter resets) (Unix time, seconds, UTC) |
| `period.kind` | string | yes | How the period is defined. A cluster uses `anchored_month`: a month counted from the creation hour. |
| `quota_bytes` | integer or null | yes | Included traffic for the period in bytes: the per-server quota multiplied by the average number of workers over the period. Null when the cluster is unmetered. |
| `addon_bytes` | integer | yes | Extra traffic bought with Add-ons for this period, in bytes. |
| `addon_tb` | integer | yes | Extra traffic bought with Add-ons for this period, in TiB. |
| `limit_bytes` | integer or null | yes | Total allowance for the period (`quota_bytes` + `addon_bytes`), or null when unmetered. |
| `used_bytes` | integer | yes | Traffic counted against the allowance so far, in bytes. |
| `remaining_bytes` | integer or null | yes | Allowance left, in bytes (negative when over), or null when unmetered. |
| `pct` | number or null | yes | Percent of the allowance used, or null when unmetered. |
| `total` | object | yes | Real traffic of the period, whether or not it counts against the allowance. |
| `total.in` | integer | yes | Bytes received in the period. |
| `total.out` | integer | yes | Bytes sent in the period. |
| `total.total` | integer | yes | `in` + `out`. |
| `unmetered` | object or null | yes |  |
| `unmetered.label` | string | yes | Name of the unmetered network. |
| `unmetered.mbps` | integer | yes | Committed bandwidth in Mbit/s. |
| `metered_frac` | number | yes | Fraction of the period (0 to 1) during which traffic was metered. |
| `workers_avg` | number or null | yes | Average number of workers over the period. |
| `can_buy` | boolean | yes | Whether a Bandwidth Add-on can be bought for the cluster now. |
| `buy_block` | string or null | yes | Why an Add-on cannot be bought (`unmetered` or `not_active`), or null when it can. |
| `count` | string | yes | What is measured: `edge`, traffic at the network edge. |
| `addons` | array of object | yes | Add-ons of the current period. |
| `addons[].id` | integer | yes | Add-on identifier. |
| `addons[].kind` | string | yes | `k8s`. |
| `addons[].ref` | string | yes | Cluster identifier. |
| `addons[].account_id` | integer | yes | Owning account. |
| `addons[].period_start` | integer | yes | Start of the period the Add-on applies to (Unix time, seconds, UTC) |
| `addons[].period_end` | integer | yes | End of the period the Add-on applies to (Unix time, seconds, UTC) |
| `addons[].tb` | integer | yes | Extra traffic in TiB. |
| `addons[].amount_cents` | integer | yes | Price paid in US cents. |
| `addons[].status` | string: `pending`, `active`, `granted`, `failed` | yes | `active`: bought and counted. `granted`: given free by the site operator. |
| `addons[].invoice_id` | integer or null | yes | Receipt identifier, if one was issued. |
| `addons[].created_at` | integer | yes | When the Add-on was bought (Unix time, seconds, UTC) |
| `price` | object | yes | Add-on price on this site. |
| `price.tb_cents` | integer | no | Price of 1 TiB of Add-on in US cents. Missing when the price cannot be computed right now. |
| `price.max_tb` | integer | yes | Most TiB one Add-on purchase may add. |
| `price.error` | string | no | Reason code when the price is unavailable. |
| `policy` | string: `notify`, `throttle`, `suspend` | yes | What happens when the allowance is used up: `notify` (only warn), `throttle` (slow down) or `suspend` (block). |
| `suspend_active` | boolean | yes | Whether the `suspend` policy is already being enforced. |
| `count_mode` | string: `both`, `out` | yes | Which directions count: `both` or `out` only. |
| `series` | object | yes | Traffic over time. |
| `series.range` | string | yes | Range that was returned (`24h`, `7d`, `30d` or `period`). |
| `series.bucket` | integer | yes | Length of each point in seconds: 3600 for `24h`, 86400 otherwise. |
| `series.from` | integer | yes | Start of the series (Unix time, seconds, UTC) |
| `series.to` | integer | yes | End of the series (Unix time, seconds, UTC) |
| `series.points` | array of object | yes |  |
| `series.points[].t` | integer | yes | Start of the bucket (Unix time, seconds, UTC) |
| `series.points[].in` | integer | yes | Bytes received in the bucket. |
| `series.points[].out` | integer | yes | Bytes sent in the bucket. |
| `series.points[].total` | integer | yes | `in` + `out`. |

Example:

```json
{
  "account_id": 1042,
  "addon_bytes": 0,
  "addon_tb": 0,
  "addons": [],
  "buy_block": null,
  "can_buy": true,
  "count": "edge",
  "count_mode": "both",
  "kind": "k8s",
  "limit_bytes": 6597069766656,
  "metered_frac": 1.0,
  "name": "prod-cluster",
  "pct": 0.8,
  "period": {
    "end": 1761955200,
    "kind": "anchored_month",
    "start": 1759276800
  },
  "policy": "notify",
  "price": {
    "max_tb": 50,
    "tb_cents": 400
  },
  "quota_bytes": 6597069766656,
  "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "remaining_bytes": 6543382675456,
  "series": {
    "bucket": 86400,
    "from": 1759276800,
    "points": [
      {
        "in": 10737418240,
        "out": 16106127360,
        "t": 1759881600,
        "total": 26843545600
      }
    ],
    "range": "period",
    "to": 1760007200
  },
  "state": "active",
  "sub": "203.0.113.10",
  "suspend_active": false,
  "total": {
    "in": 21474836480,
    "out": 32212254720,
    "total": 53687091200
  },
  "unmetered": null,
  "used_bytes": 53687091200,
  "workers_avg": 3.0
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 501 | `feature_disabled` | Bandwidth metering is switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Kubernetes catalog: zones, versions, worker plans, cycles

`GET /v1/k8s/catalog`

Returns everything needed to order a cluster: the regions that offer Kubernetes, the versions you can choose, the fixed worker plans with their price per hour and for each billing cycle, the billing cycles, the specification of the free control plane and the limits that apply to your account. Call it before [Get a quote](#operation/k8s_quote) or [Create a cluster](#operation/k8s_cluster_create).

Pass `zone_id` to see the versions of one region; without it the default region of the site is used. `enabled` is false when no region currently sells Kubernetes. When Kubernetes is switched off for the site the call fails with `403 k8s_disabled`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `k8s catalog`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `zone_id` | integer | no | Region whose versions to list, taken from `zones[].id`. Defaults to the default region of the site. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether any region currently sells Kubernetes to your account. |
| `zones` | array of Zone | yes | Regions that offer Kubernetes. |
| `zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when creating resources. |
| `zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zones[].name` | string | yes | Display name. |
| `zones[].name_en` | string or null | no | English display name. |
| `zones[].country` | string | no | ISO country code. |
| `zones[].city` | string or null | no | City. |
| `zone` | Zone or null | yes | Region the `versions` belong to: the one you asked for, otherwise the site default. Null when no region qualifies. |
| `versions` | array of K8sVersion | yes | Versions you can order in `zone`, default first. |
| `versions[].id` | integer | yes | Version identifier. Pass it as `version_id` when creating a cluster. |
| `versions[].name` | string | yes | Display name, e.g. `v1.35.0`. |
| `versions[].semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `versions[].is_default` | boolean | yes | Whether this version is used when you omit `version_id`. |
| `versions[].status` | string: `supported`, `eol` | yes | `supported` while the version can be ordered; `eol` once its end-of-life date has passed (such versions are no longer offered for new clusters). |
| `versions[].eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `versions[].min_cpu` | integer | yes | Smallest worker vCPU count this version accepts. Worker plans below it are refused. |
| `versions[].min_ram_mb` | integer | yes | Smallest worker memory this version accepts, in MiB. Worker plans below it are refused. |
| `versions[].supports_ha` | boolean | yes | Whether the version supports a highly available control plane. |
| `versions[].supports_autoscaling` | boolean | yes | Whether the version supports automatic scaling of workers. |
| `versions[].zone` | Zone or null | yes | Region the version is offered in. Filled in by List versions; null inside the catalog and the quote, where the region is given separately. |
| `worker_plans` | array of K8sWorkerPlan | yes | Worker plans on sale with their prices on this site. |
| `worker_plans[].code` | string | yes | Plan code. Pass it as `worker_plan` when creating a cluster, e.g. `K8S-3`. |
| `worker_plans[].vcpu` | integer | yes | Virtual CPU cores of each worker. |
| `worker_plans[].ram_gb` | integer | yes | Memory of each worker in GiB. |
| `worker_plans[].ram_mb` | integer | yes | Memory of each worker in MiB. |
| `worker_plans[].disk_gb` | integer | yes | NVMe system disk of each worker in GiB (the same for every plan). |
| `worker_plans[].hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar (1,000,000 = US$1). |
| `worker_plans[].monthly_cents` | integer | yes | Approximate price of one worker for a month of `hours_per_month` hours, in US cents. |
| `worker_plans[].cycles` | array of object | yes |  |
| `worker_plans[].cycles[].cycle` | string | yes | Billing cycle identifier, e.g. `monthly`. Pass it as `cycle` when creating a cluster. |
| `worker_plans[].cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `worker_plans[].cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `worker_plans[].cycles[].cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly billing). |
| `worker_disk_gb` | integer | yes | NVMe system disk of every worker in GiB. |
| `cycles` | array of object | yes | Billing cycles you can choose for workers. |
| `cycles[].slug` | string | yes | Billing cycle identifier. Pass it as `cycle`. |
| `cycles[].name` | string | yes | Display name. |
| `cycles[].months` | integer | yes | Length of the cycle in months (0 = pay by the hour). |
| `cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `control_plane` | object | yes | Control plane that comes with every cluster. |
| `control_plane.free` | boolean | yes | Always true. |
| `control_plane.count` | integer | yes | Number of control plane nodes. |
| `control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `limits` | object | yes | Limits that apply to your account. |
| `limits.workers_min` | integer | yes | Fewest workers a cluster may have. |
| `limits.workers_max` | integer | yes | Most workers a cluster may have. |
| `limits.clusters_max` | integer | yes | Most clusters one account may have. |
| `limits.clusters_used` | integer | yes | Clusters your account currently has. |
| `limits.min_hours_to_create` | integer | yes | Hours of worker cost your wallet balance must cover to create or enlarge a cluster. |
| `hours_per_month` | integer | yes | Hours in a billing month, used for the monthly estimates (730). |

Example:

```json
{
  "control_plane": {
    "count": 1,
    "cpu": 2,
    "free": true,
    "ram_mb": 2048
  },
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    },
    {
      "discount_pct": 10.0,
      "months": 12,
      "name": "Yearly",
      "slug": "yearly"
    }
  ],
  "enabled": true,
  "hours_per_month": 730,
  "limits": {
    "clusters_max": 2,
    "clusters_used": 0,
    "min_hours_to_create": 24,
    "workers_max": 9,
    "workers_min": 1
  },
  "versions": [
    {
      "eol_at": null,
      "id": 2,
      "is_default": true,
      "min_cpu": 2,
      "min_ram_mb": 2048,
      "name": "v1.35.0",
      "semver": "1.35.0",
      "status": "supported",
      "supports_autoscaling": false,
      "supports_ha": false,
      "zone": null
    }
  ],
  "worker_disk_gb": 70,
  "worker_plans": [
    {
      "code": "K8S-1",
      "cycles": [
        {
          "cycle": "monthly",
          "cycle_cents": 818,
          "discount_pct": 0.0,
          "months": 1
        },
        {
          "cycle": "yearly",
          "cycle_cents": 8834,
          "discount_pct": 10.0,
          "months": 12
        }
      ],
      "disk_gb": 70,
      "hourly_uusd": 11200,
      "monthly_cents": 818,
      "ram_gb": 4,
      "ram_mb": 4096,
      "vcpu": 2
    },
    {
      "code": "K8S-3",
      "cycles": [
        {
          "cycle": "monthly",
          "cycle_cents": 1635,
          "discount_pct": 0.0,
          "months": 1
        },
        {
          "cycle": "yearly",
          "cycle_cents": 17658,
          "discount_pct": 10.0,
          "months": 12
        }
      ],
      "disk_gb": 70,
      "hourly_uusd": 22400,
      "monthly_cents": 1635,
      "ram_gb": 8,
      "ram_mb": 8192,
      "vcpu": 4
    }
  ],
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  },
  "zones": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `zone_id` is not an integer. |
| 403 | `k8s_disabled` | Kubernetes is not sold on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Kubernetes images (sellable versions)

`GET /v1/k8s/versions`

Lists the Kubernetes versions that can be ordered, one entry per region and version, with the smallest worker size each version accepts. Versions that are disabled, withdrawn or past their end-of-life date are not listed. Use an entry's `id` as `version_id` when creating a cluster, or omit `version_id` to get the default version.

Results are sorted by the order the site chose (default version first) unless you pass `sort`. When Kubernetes is switched off for the site the call fails with `403 k8s_disabled`.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `k8s versions`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `sort`, `name`, `semver`, `eol_at` | no | Field to sort by. `sort` is the order chosen by the site. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `zone_id` | integer | no | Only versions offered in this region, taken from the catalog `zones[].id`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of K8sVersion | yes |  |
| `items[].id` | integer | yes | Version identifier. Pass it as `version_id` when creating a cluster. |
| `items[].name` | string | yes | Display name, e.g. `v1.35.0`. |
| `items[].semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `items[].is_default` | boolean | yes | Whether this version is used when you omit `version_id`. |
| `items[].status` | string: `supported`, `eol` | yes | `supported` while the version can be ordered; `eol` once its end-of-life date has passed (such versions are no longer offered for new clusters). |
| `items[].eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `items[].min_cpu` | integer | yes | Smallest worker vCPU count this version accepts. Worker plans below it are refused. |
| `items[].min_ram_mb` | integer | yes | Smallest worker memory this version accepts, in MiB. Worker plans below it are refused. |
| `items[].supports_ha` | boolean | yes | Whether the version supports a highly available control plane. |
| `items[].supports_autoscaling` | boolean | yes | Whether the version supports automatic scaling of workers. |
| `items[].zone` | Zone or null | yes | Region the version is offered in. Filled in by List versions; null inside the catalog and the quote, where the region is given separately. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "eol_at": null,
      "id": 2,
      "is_default": true,
      "min_cpu": 2,
      "min_ram_mb": 2048,
      "name": "v1.35.0",
      "semver": "1.35.0",
      "status": "supported",
      "supports_autoscaling": false,
      "supports_ha": false,
      "zone": {
        "city": "Ho Chi Minh City",
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "name_en": "Ho Chi Minh City",
        "slug": "hcm-1"
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page`, `per_page` or `zone_id` is not an integer, `dir` is not `asc` or `desc`, or `sort` is not one of the listed fields. |
| 403 | `k8s_disabled` | Kubernetes is not sold on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/versions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a cluster + required balance (no charge)

`GET /v1/k8s/quote`

Prices a cluster and checks whether you could create it right now, without creating anything and without charging. The response gives the price per hour and per month, the amount charged up front for a prepaid cycle, the wallet balance you need (`funds.need_cents`) next to your current balance, and every pre-flight check that [Create a cluster](#operation/k8s_cluster_create) applies: resource quota, cluster count limits, e-mail verification and whether the site takes orders. `can_create` is true only when all of them pass. A failed check does not fail the call: the status stays `200` and the failing item says why. Mistakes in the parameters (unknown plan, worker count out of range) are errors.

All money is in US cents, except prices per hour, which are in millionths of a US dollar. The control plane is free. When Kubernetes is switched off for the site the call fails with `403 k8s_disabled`.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `worker_plan` | string | yes | Worker plan code from the catalog, e.g. `K8S-3`. |
| `worker_count` | integer | yes | Number of workers. Must be within `limits.workers_min` and `limits.workers_max` of the catalog. |
| `zone_id` | integer | no | Region to build the cluster in. Defaults to the default region of the site. |
| `version_id` | integer | no | Kubernetes version, from List versions. Defaults to the default version. |
| `cycle` | string | no | Billing cycle identifier from the catalog: `hourly`, or a prepaid cycle such as `monthly`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `funds` | object | yes | Wallet check. |
| `funds.balance_cents` | integer | yes | Your wallet balance in US cents. |
| `funds.need_cents` | integer | yes | Wallet balance required to create this cluster, in US cents: the larger of the up-front charge of a prepaid cycle, the site's minimum balance, and the cost of `min_hours` hours of the new workers plus any cluster still being built. |
| `funds.enough` | boolean | yes | Whether `balance_cents` covers `need_cents`. |
| `funds.first_charge_cents` | integer | yes | Amount charged to the wallet at creation, in US cents. 0 for hourly billing. |
| `funds.min_hours` | integer | yes | Hours of worker cost the balance must cover (the site setting behind `need_cents`). |
| `checks` | object | yes | Pre-flight checks that Create a cluster would apply. |
| `checks.sales_enabled` | boolean | yes | Whether the site accepts new orders. |
| `checks.email_verified` | boolean | yes | Whether the account e-mail requirement is met. |
| `checks.quota` | object or null | yes | Set when the account's resource quota would be exceeded: `reason`, `used`, `requested`, `limit`, `need_more_cents`, `message` and related fields. Null when the quota allows the order. |
| `checks.quota_request` | object | yes |  |
| `checks.quota_request.cpu` | integer | yes | vCPU the cluster would add to your quota usage (workers plus control plane). |
| `checks.quota_request.ram_mb` | integer | yes | Memory the cluster would add, in MiB. |
| `checks.quota_request.disk_gb` | integer | yes | Disk the cluster would add, in GiB. |
| `checks.quota_request.vm` | integer | yes | Server count the cluster would add (one per worker). |
| `checks.clusters` | object | yes |  |
| `checks.clusters.used` | integer | yes | Clusters you currently have (not deleted or failed). |
| `checks.clusters.max` | integer | yes | Most clusters one account may have. |
| `checks.clusters.site_ok` | boolean | yes | Whether the site-wide cluster limit still has room. |
| `checks.clusters.total_ok` | boolean | yes | Whether the platform-wide cluster limit still has room. |
| `checks.provider_ok` | boolean | yes | Whether capacity for new resources is available on the site right now. |
| `can_create` | boolean | yes | True only when every check passes and the balance is enough. When false, the failing item above shows why. |
| `zone` | Zone | yes |  |
| `zone.id` | integer | yes | Region identifier. Pass it as `zone_id` when creating resources. |
| `zone.slug` | string | yes | Short name, e.g. `hcm-1`. |
| `zone.name` | string | yes | Display name. |
| `zone.name_en` | string or null | no | English display name. |
| `zone.country` | string | no | ISO country code. |
| `zone.city` | string or null | no | City. |
| `version` | K8sVersion | yes | A Kubernetes version you can choose for a new cluster. |
| `version.id` | integer | yes | Version identifier. Pass it as `version_id` when creating a cluster. |
| `version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `version.is_default` | boolean | yes | Whether this version is used when you omit `version_id`. |
| `version.status` | string: `supported`, `eol` | yes | `supported` while the version can be ordered; `eol` once its end-of-life date has passed (such versions are no longer offered for new clusters). |
| `version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `version.min_cpu` | integer | yes | Smallest worker vCPU count this version accepts. Worker plans below it are refused. |
| `version.min_ram_mb` | integer | yes | Smallest worker memory this version accepts, in MiB. Worker plans below it are refused. |
| `version.supports_ha` | boolean | yes | Whether the version supports a highly available control plane. |
| `version.supports_autoscaling` | boolean | yes | Whether the version supports automatic scaling of workers. |
| `version.zone` | Zone or null | yes | Region the version is offered in. Filled in by List versions; null inside the catalog and the quote, where the region is given separately. |
| `worker` | object | yes | The worker plan that was priced. |
| `worker.plan` | string | yes | Worker plan code. |
| `worker.vcpu` | integer | yes | vCPU of each worker. |
| `worker.ram_gb` | integer | yes | Memory of each worker in GiB. |
| `worker.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `worker.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `worker.name` | string | yes | Display label of the plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `worker_count` | integer | yes | Number of workers that was priced. |
| `control_plane` | object | yes | Control plane that comes with the cluster. |
| `control_plane.free` | boolean | yes | Always true. |
| `control_plane.count` | integer | yes | Number of control plane nodes. |
| `control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `control_plane.hourly_uusd` | integer | yes | Always 0. |
| `control_plane.monthly_cents` | integer | yes | Always 0. |
| `pricing` | object | yes | Price of the cluster. |
| `pricing.worker_monthly_cents` | integer | yes | Price of one worker for a month of `hours_per_month` hours, in US cents. |
| `pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `pricing.hourly_uusd` | integer | yes | Price of all workers per hour in millionths of a US dollar. |
| `pricing.monthly_cents` | integer | yes | Price of all workers for a month of `hours_per_month` hours, in US cents. |
| `pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `pricing.hours_per_month` | integer | yes | Hours in a billing month (730). |
| `pricing.cycle` | string | yes | Billing cycle that was priced. |
| `pricing.cycle_name` | string | yes | Display name of the billing cycle. |
| `pricing.months` | integer | yes | Length of the cycle in months (0 = hourly). |
| `pricing.discount_pct` | number | yes | Discount for paying the cycle up front, in percent. |
| `pricing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly). |
| `pricing.cycle_cents` | integer | yes | Amount charged at creation for all workers in US cents (0 for hourly). |
| `pricing.first_charge_cents` | integer | yes | Same as `cycle_cents`: what the wallet is charged at creation. |

Example:

```json
{
  "can_create": true,
  "checks": {
    "clusters": {
      "max": 2,
      "site_ok": true,
      "total_ok": true,
      "used": 0
    },
    "email_verified": true,
    "provider_ok": true,
    "quota": null,
    "quota_request": {
      "cpu": 14,
      "disk_gb": 280,
      "ram_mb": 26624,
      "vm": 3
    },
    "sales_enabled": true
  },
  "control_plane": {
    "count": 1,
    "cpu": 2,
    "free": true,
    "hourly_uusd": 0,
    "monthly_cents": 0,
    "ram_mb": 2048
  },
  "funds": {
    "balance_cents": 2500,
    "enough": true,
    "first_charge_cents": 0,
    "min_hours": 24,
    "need_cents": 162
  },
  "pricing": {
    "control_plane_cents": 0,
    "cycle": "hourly",
    "cycle_cents": 0,
    "cycle_name": "Hourly",
    "discount_pct": 0.0,
    "first_charge_cents": 0,
    "hourly_uusd": 67200,
    "hours_per_month": 730,
    "monthly_cents": 4906,
    "months": 0,
    "worker_cycle_cents": 0,
    "worker_hourly_uusd": 22400,
    "worker_monthly_cents": 1635
  },
  "version": {
    "eol_at": null,
    "id": 2,
    "is_default": true,
    "min_cpu": 2,
    "min_ram_mb": 2048,
    "name": "v1.35.0",
    "semver": "1.35.0",
    "status": "supported",
    "supports_autoscaling": false,
    "supports_ha": false,
    "zone": null
  },
  "worker": {
    "disk_gb": 70,
    "name": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
    "plan": "K8S-3",
    "ram_gb": 8,
    "ram_mb": 8192,
    "vcpu": 4
  },
  "worker_count": 3,
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `worker_plan` or `worker_count` is missing, `worker_count`, `zone_id` or `version_id` is not an integer, or `cycle` is not an available billing cycle. The error carries `field`. |
| 400 | `worker_custom_removed` | The legacy parameters `vcpu`, `ram_gb` or `disk_gb` were sent. Custom worker sizes are no longer sold; choose a `worker_plan`. |
| 400 | `worker_plan_invalid` | `worker_plan` is not a plan on sale, or it is smaller than the chosen version requires (`reason` is then `version_min`, with `min_cpu` and `min_ram_mb`). The error lists the plans on sale in `plans`. |
| 400 | `version_unavailable` | `version_id` is not a version that can be ordered in this region. |
| 400 | `workers_out_of_range` | `worker_count` is outside the allowed range. The error carries `min` and `max`. |
| 403 | `k8s_disabled` | Kubernetes is not sold on this site. |
| 409 | `zone_not_k8s` | `zone_id` is not a region that offers Kubernetes, or no region is available. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/quote?worker_plan=<worker_plan>&worker_count=<worker_count>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List clusters

`GET /v1/k8s/clusters`

Lists your clusters with the state, size and price of each. By default deleted clusters are hidden; filter with `state=deleted` to see the ones deleted in the last 30 days. The items do not include `note`; fetch a single cluster to read it. `counts` always describes your live clusters, whatever the filter. Clusters are sorted by creation time, oldest first, unless you pass `sort` and `dir`.

This call works even when the site no longer sells Kubernetes, so existing clusters stay visible.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `name`, `state`, `created_at`, `workers`, `hourly`, `hourly_uusd`, `version`, `semver`, `public_ip`, `zone` | no | Field to sort by. `workers` is the worker count, `hourly` and `hourly_uusd` the price per hour, `version` and `semver` the Kubernetes version, `zone` the region name. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `state` | string: `all`, `running`, `active`, `stopped`, `locked`, `provisioning`, `failed`, `deleted` | no | Only clusters in this state. `running` and `active` are the same. Omit or use `all` for every live cluster. |
| `q` | string | no | Only clusters whose name or public IP contains this text (case-insensitive). |
| `zone_id` | integer | no | Only your clusters in this region (`zones[].id` from the catalog). A region where you have no cluster gives an empty list; `total` and the paging apply after the filter. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of K8sCluster | yes |  |
| `items[].id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `items[].name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `items[].note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `items[].state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `items[].cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `items[].zone` | Zone or null | yes | Region the cluster runs in. |
| `items[].version` | object | yes | Kubernetes version the cluster runs. |
| `items[].version.id` | integer | yes | Version identifier. |
| `items[].version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `items[].version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `items[].version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `items[].endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `items[].public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `items[].control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `items[].control_plane.count` | integer | yes | Number of control plane nodes. |
| `items[].control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `items[].control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `items[].control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `items[].workers` | object | yes | Worker node configuration. |
| `items[].workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `items[].workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `items[].workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `items[].workers.cpu` | integer | yes | vCPU of each worker. |
| `items[].workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `items[].workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `items[].workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `items[].workers.observed` | integer | yes | Number of workers the platform last counted. |
| `items[].workers.running` | integer | yes | Number of workers that are running right now. |
| `items[].pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `items[].pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `items[].pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `items[].pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `items[].pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `items[].billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `items[].billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `items[].billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `items[].billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `items[].billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `items[].billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `items[].billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `items[].lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `items[].lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `items[].lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `items[].lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `items[].op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `items[].can` | object | yes | Which actions are possible in the current state. |
| `items[].can.scale` | boolean | yes | Scale can be called now. |
| `items[].can.start` | boolean | yes | Start can be called now. |
| `items[].can.stop` | boolean | yes | Stop can be called now. |
| `items[].can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `items[].can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `items[].can.delete` | boolean | yes | Delete can be called now. |
| `items[].public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `items[].created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `items[].ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `counts` | object | yes | Number of your live clusters per state. |
| `counts.all` | integer | yes | Live clusters. |
| `counts.running` | integer | yes | Clusters in state `active`. |
| `counts.active` | integer | yes | Same as `running`. |
| `counts.stopped` | integer | yes | Clusters in state `stopped`. |
| `counts.locked` | integer | yes | Clusters in state `locked`. |

Example:

```json
{
  "counts": {
    "active": 1,
    "all": 1,
    "locked": 0,
    "running": 1,
    "stopped": 0
  },
  "items": [
    {
      "billing": {
        "auto_renew": true,
        "cycle": "hourly",
        "cycle_cents": 0,
        "months": 0,
        "paid_until": null,
        "worker_cycle_cents": 0
      },
      "can": {
        "delete": true,
        "kubeconfig": true,
        "scale": true,
        "start": false,
        "stop": true,
        "upgrade": false
      },
      "control_plane": {
        "count": 1,
        "cpu": 2,
        "free": true,
        "ram_mb": 2048
      },
      "created_at": 1760000000,
      "cs_state": "Running",
      "endpoint": "https://203.0.113.10:6443",
      "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "lock": null,
      "name": "prod-cluster",
      "op": null,
      "pricing": {
        "control_plane_cents": 0,
        "hourly_uusd": 67200,
        "monthly_cents": 4906,
        "worker_hourly_uusd": 22400
      },
      "public_error": null,
      "public_ip": "203.0.113.10",
      "ready_at": 1760000540,
      "state": "active",
      "updated_at": 1760003600,
      "version": {
        "eol_at": null,
        "id": 2,
        "name": "v1.35.0",
        "semver": "1.35.0"
      },
      "workers": {
        "cpu": 4,
        "custom": false,
        "desired": 3,
        "disk_gb": 70,
        "observed": 3,
        "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
        "plan_code": "K8S-3",
        "ram_mb": 8192,
        "running": 3
      },
      "zone": {
        "city": "Ho Chi Minh City",
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "name_en": "Ho Chi Minh City",
        "slug": "hcm-1"
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page`, `per_page` or `zone_id` is not an integer, or `sort`, `dir` or `state` is not one of the listed values. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one cluster

`GET /v1/k8s/clusters/{id}`

Returns one cluster with its configuration, state, price, billing terms, any lock and any operation in progress. `can` tells which actions are possible right now. A deleted cluster stays readable for 30 days after deletion; after that it answers `404`.

This call works even when the site no longer sells Kubernetes.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |

Example:

```json
{
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": true,
      "kubeconfig": true,
      "scale": true,
      "start": false,
      "stop": true,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": "Running",
    "endpoint": "https://203.0.113.10:6443",
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": "Production workloads",
    "op": null,
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": "203.0.113.10",
    "ready_at": 1760000540,
    "state": "active",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 3,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 3
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rename / notes / auto-renew

`PATCH /v1/k8s/clusters/{id}`

Changes the display name, the note or the auto-renew setting of a cluster. Only the fields you send change; an empty object changes nothing. Renaming only changes the label: the cluster keeps running and existing kubeconfig files stay valid. `auto_renew` applies to prepaid cycles: when it is off, the cluster is locked at the end of the paid period instead of being renewed, so turn it back on before then. Hourly clusters have no renewal and reject `auto_renew`.

The cluster must not be locked, being deleted, deleted or failed. Costs nothing.

**Required scope:** `k8s:write`.

Scope: `k8s:write` | CLI: `k8s cluster update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | New name: 3 to 40 characters, lowercase letters, digits and hyphens, starting with a letter and not ending with a hyphen. Upper-case letters are converted to lower case. Must be unique among your live clusters. |
| `note` | string or null | no | Free-form note, at most 500 characters (longer text is cut). An empty string or null removes the note. |
| `auto_renew` | boolean | no | Whether a prepaid cluster renews at the end of its paid period. |

Example:

```json
{
  "name": "prod-cluster",
  "note": "Production workloads"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |

Example:

```json
{
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": true,
      "kubeconfig": true,
      "scale": true,
      "start": false,
      "stop": true,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": "Running",
    "endpoint": "https://203.0.113.10:6443",
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": "Production workloads",
    "op": null,
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": "203.0.113.10",
    "ready_at": 1760000540,
    "state": "active",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 3,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 3
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, `note` is not a string or null, `auto_renew` is not a boolean, or `auto_renew` was sent for an hourly cluster (the error carries `field`). |
| 400 | `name_invalid` | `name` is not 3 to 40 characters of lowercase letters, digits and hyphens starting with a letter and not ending with a hyphen. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `name_taken` | You already have another live cluster with this name. |
| 409 | `cluster_busy` | The cluster is being deleted, or is deleted or failed, and cannot be changed. |
| 423 | `cluster_locked` | The cluster is locked. The error carries `reason`, `locked_at` and `destroy_after`. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/k8s/clusters/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"prod-cluster","note":"Production workloads"}'
```

---

#### Cluster nodes (free control + workers)

`GET /v1/k8s/clusters/{id}/nodes`

Lists the nodes that currently make up the cluster: the free control plane node first, then the workers, with their size, status and hourly price. Nodes that were removed are not listed. The list is not paginated.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster nodes`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of K8sNode | yes |  |
| `items[].id` | string | yes | Node identifier. |
| `items[].name` | string or null | yes | Node host name. |
| `items[].role` | string: `control`, `worker`, `etcd` | yes | `control`: control plane node (free). `worker`: billed worker node. `etcd`: dedicated datastore node. |
| `items[].cs_state` | string or null | yes | Live status of the node, e.g. `Running` or `Stopped`. |
| `items[].private_ip` | string or null | yes | Private IP address of the node inside the cluster network. |
| `items[].cpu` | integer | yes | vCPU of the node. |
| `items[].ram_mb` | integer | yes | Memory of the node in MiB. |
| `items[].disk_gb` | integer | yes | System disk of the node in GiB. |
| `items[].hourly_uusd` | integer | yes | Hourly price of the node in millionths of a US dollar. 0 for control plane nodes. |
| `items[].billable` | boolean | yes | Whether the node is billed. False for control plane nodes. |
| `items[].source` | string: `op`, `observed` | yes | `op`: created by an operation of the cluster. `observed`: found on the cluster later, for example added from inside the cluster. |
| `items[].since` | integer | yes | When the node started to exist (and to be billed, for workers) (Unix time, seconds, UTC) |
| `items[].state` | string: `active`, `removed` | yes | Always `active` in this list: removed nodes are not returned. |
| `total` | integer | yes | Number of nodes returned. |

Example:

```json
{
  "items": [
    {
      "billable": false,
      "cpu": 2,
      "cs_state": "Running",
      "disk_gb": 70,
      "hourly_uusd": 0,
      "id": "9b1f3c52-4e7a-4d0b-8c13-2a6e5f7d8c90",
      "name": "prod-cluster-control-1",
      "private_ip": "10.1.1.10",
      "ram_mb": 2048,
      "role": "control",
      "since": 1760000100,
      "source": "op",
      "state": "active"
    },
    {
      "billable": true,
      "cpu": 4,
      "cs_state": "Running",
      "disk_gb": 70,
      "hourly_uusd": 22400,
      "id": "5d2e8a47-1b3c-4f69-9e0a-7c4b6d8e1f23",
      "name": "prod-cluster-node-1",
      "private_ip": "10.1.1.11",
      "ram_mb": 8192,
      "role": "worker",
      "since": 1760000300,
      "source": "op",
      "state": "active"
    }
  ],
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/nodes" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Start the cluster

`POST /v1/k8s/clusters/{id}/start`

Starts a stopped cluster. The call returns `202 Accepted` and an operation starts the nodes in the background; the cluster becomes `active` and `can.kubeconfig` turns true when it is running. Workers of an hourly cluster are billed again once they run; a prepaid cluster simply continues its paid period. The cluster must be `stopped` with no operation in progress; at most 12 start and stop operations per hour are allowed per cluster. Costs nothing by itself. This call works even when the site no longer sells Kubernetes.

**Required scope:** `k8s:write`.

Scope: `k8s:write` | CLI: `k8s cluster start`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |
| `op` | K8sOpQueued | yes | The operation queued by a create, scale, start, stop or delete call. |
| `op.id` | integer | yes | Operation identifier. Follow it with List operations. |
| `op.kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | Kind of operation that was queued. |
| `op.state` | string: `queued` | yes | Always `queued` right after the call. |

Example:

```json
{
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": false,
      "kubeconfig": false,
      "scale": false,
      "start": false,
      "stop": false,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": "Stopped",
    "endpoint": "https://203.0.113.10:6443",
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": "Production workloads",
    "op": {
      "created_at": 1760003700,
      "finished_at": null,
      "id": 41,
      "kind": "start",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": "203.0.113.10",
    "ready_at": 1760000540,
    "state": "stopped",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 3,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 0
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  },
  "op": {
    "id": 41,
    "kind": "start",
    "state": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `cluster_busy` | Another operation is running on the cluster. |
| 409 | `cluster_not_running` | The cluster is not `stopped`, so it cannot be started. |
| 423 | `cluster_locked` | The cluster is locked. The error carries `reason`, `locked_at` and `destroy_after`. |
| 429 | `rate_limited` | Too many start and stop operations on this cluster in the last hour. The error carries `retry_after` in seconds. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/k8s/clusters/<id>/start" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Stop the cluster

`POST /v1/k8s/clusters/{id}/stop`

Stops a running cluster: the nodes are shut down, workloads stop and the Kubernetes API becomes unreachable until you start the cluster again. The call returns `202 Accepted` and an operation stops the nodes in the background. Workers of an hourly cluster are not billed while they are stopped; a prepaid period is not refunded by stopping. Disks and the public IP address are kept. A cluster left stopped for a long time (30 days by default) is deleted automatically after warnings by e-mail.

The cluster must be `active` with no operation in progress; at most 12 start and stop operations per hour are allowed per cluster. This call works even when the site no longer sells Kubernetes.

**Required scope:** `k8s:write`.

Scope: `k8s:write` | CLI: `k8s cluster stop`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |
| `op` | K8sOpQueued | yes | The operation queued by a create, scale, start, stop or delete call. |
| `op.id` | integer | yes | Operation identifier. Follow it with List operations. |
| `op.kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | Kind of operation that was queued. |
| `op.state` | string: `queued` | yes | Always `queued` right after the call. |

Example:

```json
{
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": false,
      "kubeconfig": true,
      "scale": false,
      "start": false,
      "stop": false,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": "Running",
    "endpoint": "https://203.0.113.10:6443",
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": "Production workloads",
    "op": {
      "created_at": 1760003700,
      "finished_at": null,
      "id": 41,
      "kind": "stop",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": "203.0.113.10",
    "ready_at": 1760000540,
    "state": "active",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 3,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 3
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  },
  "op": {
    "id": 41,
    "kind": "stop",
    "state": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `cluster_busy` | Another operation is running on the cluster. |
| 409 | `cluster_not_running` | The cluster is not `active`, so it cannot be stopped. |
| 423 | `cluster_locked` | The cluster is locked. The error carries `reason`, `locked_at` and `destroy_after`. |
| 429 | `rate_limited` | Too many start and stop operations on this cluster in the last hour. The error carries `retry_after` in seconds. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/k8s/clusters/<id>/stop" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Download kubeconfig (cluster-admin)

`GET /v1/k8s/clusters/{id}/kubeconfig`

Downloads the kubeconfig file (YAML) of the cluster. **It grants cluster-admin rights**: anyone holding the file has full control of the cluster and everything running in it, so treat it like a root password and give the dedicated `k8s:kubeconfig` scope only to keys that need it. The file is generated on every request, is never stored by the API and is not written to logs; the response carries `Cache-Control: no-store` and a `Content-Disposition` header with the file name `<cluster name>-kubeconfig.yaml`. Every download is recorded in the cluster's events, and downloads are limited per account (10 per hour by default).

The cluster must be running (`can.kubeconfig` is true). Save the response body to a file and point `KUBECONFIG` at it. This call works even when the site no longer sells Kubernetes.

**Required scope:** `k8s:kubeconfig`.

Scope: `k8s:kubeconfig` | CLI: `k8s cluster kubeconfig`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 200** - Success.

Content type: `application/yaml`

Example:

```
apiVersion: v1
kind: Config
clusters:
- name: prod-cluster
  cluster:
    server: https://203.0.113.10:6443
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t...
users:
- name: prod-cluster-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0t...
    client-key-data: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQ...
contexts:
- name: prod-cluster
  context:
    cluster: prod-cluster
    user: prod-cluster-admin
current-context: prod-cluster

```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `cluster_not_running` | The cluster is not running, so there is no kubeconfig to download. |
| 423 | `cluster_locked` | The cluster is locked. The error carries `reason`, `locked_at` and `destroy_after`. |
| 429 | `rate_limited` | Too many kubeconfig downloads in the last hour. The error carries `retry_after` in seconds and the response has a `Retry-After` header. |
| 503 | `cloud_unavailable` | The kubeconfig could not be produced right now. Try again in a minute. |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/kubeconfig" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Cluster operations

`GET /v1/k8s/clusters/{id}/ops`

Lists the background operations of the cluster (creation, scaling, start, stop, deletion and maintenance), newest first by default. Use it to follow a `202 Accepted` call: find the operation by the `op.id` you received and wait until `state` is `done`, or `failed` with a `public_error` reason code.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster ops`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `id`, `kind`, `state` | no | Field to sort by. `created_at` and `id` give the same order. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of K8sOp | yes |  |
| `items[].id` | integer | yes | Operation identifier. |
| `items[].kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | What the operation does. `create`, `scale`, `start`, `stop` and `delete` are started by you; the others are started by the platform. |
| `items[].state` | string: `queued`, `running`, `done`, `failed`, `cancelled` | yes | `queued` and `running` mean work is in progress; `done`, `failed` and `cancelled` are final. |
| `items[].step` | string | yes | Current step of the operation, for progress display only. The set of values can change. |
| `items[].public_error` | string or null | yes | Reason code when the operation failed: `capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`; null otherwise. |
| `items[].created_at` | integer | yes | When the operation was queued (Unix time, seconds, UTC) |
| `items[].finished_at` | integer or null | yes | When the operation finished, or null while it is still queued or running (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "created_at": 1760003700,
      "finished_at": 1760003820,
      "id": 41,
      "kind": "scale",
      "public_error": null,
      "state": "done",
      "step": "done"
    },
    {
      "created_at": 1760000000,
      "finished_at": 1760000540,
      "id": 38,
      "kind": "create",
      "public_error": null,
      "state": "done",
      "step": "done"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page` or `per_page` is not an integer, or `dir` or `sort` is not one of the listed values. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/ops" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Cluster event log

`GET /v1/k8s/clusters/{id}/events`

Returns the event log of the cluster, newest first by default: what was ordered, started, scaled, renamed, locked or deleted, when the cluster became ready, and every kubeconfig download. `actor` tells who caused the event: `you`, `admin` (the site operator) or `system` (automatic action). `msg` is a short human-readable sentence in English; branch on `kind`, not on the text.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `kind`, `actor` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Event identifier. |
| `items[].at` | integer | yes | When the event happened (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | Event type, e.g. `create`, `ready`, `scale`, `scaled`, `start`, `stop`, `rename`, `auto_renew`, `lock`, `unlock`, `renewal`, `destroy`, `deleted`, `kubeconfig_download`. New types may be added. |
| `items[].actor` | string: `you`, `admin`, `system` | yes | Who caused the event. |
| `items[].msg` | string | yes | Short description of the event in English. |
| `items[].key` | string or null | yes | Stable message code (for example `k8s.ready`); `null` for entries written before message codes existed. With `args` it lets you show the message in your own language. |
| `items[].args` | object | yes | Raw values to fill into the message named by `key` (string values). An empty object when `key` is `null`. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "actor": "system",
      "args": {
        "from": "3",
        "to": "5"
      },
      "at": 1760003820,
      "id": 93,
      "key": "k8s.scaled",
      "kind": "scaled",
      "msg": "Workers 3 → 5"
    },
    {
      "actor": "you",
      "args": {
        "from": "3",
        "to": "5"
      },
      "at": 1760003700,
      "id": 92,
      "key": "k8s.scale_requested",
      "kind": "scale",
      "msg": "Scale workers 3 → 5"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page` or `per_page` is not an integer, or `dir` or `sort` is not one of the listed values. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Cluster billing

`GET /v1/k8s/clusters/{id}/billing`

Shows what the cluster costs and has cost: its current price and billing terms, what it spent this calendar month (UTC) and in total, and the wallet entries that belong to it, newest first by default. Entries have a `kind`: `hour` (hourly charge of a worker), `new` (up-front charge at creation), `cycle` (renewal of a prepaid period), `scale` (prorated charge for added workers) and `refund`. `amount_cents` is in US cents and is negative for charges and positive for refunds, while `spent_month_cents` and `spent_total_cents` are positive totals of the charges net of refunds. The control plane never appears because it is free.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster billing`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `amount_cents` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Wallet entry identifier. |
| `items[].at` | integer | yes | When the entry was booked (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | What the entry is for: `hour`, `new`, `cycle`, `scale` or `refund`. |
| `items[].amount_cents` | integer | yes | Amount in US cents: negative for a charge, positive for a refund. |
| `items[].memo` | string or null | yes | Description of the entry. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `spent_month_cents` | integer | yes | Net amount charged for this cluster since the start of the current calendar month (UTC), in US cents. |
| `spent_total_cents` | integer | yes | Net amount charged for this cluster since it was created, in US cents. |

Example:

```json
{
  "billing": {
    "auto_renew": true,
    "cycle": "hourly",
    "cycle_cents": 0,
    "months": 0,
    "paid_until": null,
    "worker_cycle_cents": 0
  },
  "items": [
    {
      "amount_cents": -2,
      "at": 1760007200,
      "id": 1207,
      "kind": "hour",
      "memo": "Kubernetes prod-cluster - hourly worker charge"
    },
    {
      "amount_cents": -2,
      "at": 1760003600,
      "id": 1190,
      "kind": "hour",
      "memo": "Kubernetes prod-cluster - hourly worker charge"
    }
  ],
  "page": 1,
  "per_page": 25,
  "pricing": {
    "control_plane_cents": 0,
    "hourly_uusd": 67200,
    "monthly_cents": 4906,
    "worker_hourly_uusd": 22400
  },
  "spent_month_cents": 4,
  "spent_total_cents": 4,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page` or `per_page` is not an integer, or `dir` or `sort` is not one of the listed values. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/billing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Endpoint, IP, open ports

`GET /v1/k8s/clusters/{id}/networking`

Shows how to reach the cluster: the API server endpoint, the public IP address, and the ports that are open on that address. Port 6443 is the Kubernetes API; ports 80 and 443 reach the cluster's ingress (node ports 30080 and 30443) once `ingress_ready` is true; the SSH ports starting at 2222 map to port 22 of each node in order. `cidrs` lists the source ranges allowed on a rule; an empty list means any address.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster networking`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `endpoint` | string or null | yes | URL of the Kubernetes API server. Null until the cluster is ready. |
| `public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `ingress` | array of object | yes | Web ports forwarded to the nodes. |
| `ingress[].public_port` | integer | yes | Port on the public IP address. |
| `ingress[].node_port` | integer | yes | Node port the traffic is forwarded to. Expose your ingress controller on it. |
| `ingress[].protocol` | string | yes | `tcp`. |
| `ingress_ready` | boolean | yes | Whether ports 80 and 443 are set up. |
| `rules` | array of object | yes | Rules open on the public IP address. |
| `rules[].kind` | string: `api`, `ingress`, `port_forward` | yes | `api`: Kubernetes API. `ingress`: web traffic. `port_forward`: SSH to a node. |
| `rules[].protocol` | string | yes | `tcp`. |
| `rules[].public_port` | integer | yes | Port on the public IP address. |
| `rules[].private_port` | integer | yes | Port the traffic is forwarded to. |
| `rules[].cidrs` | array of string | yes | Allowed source ranges. Empty means any address. |
| `load_balancer_service` | boolean | yes | Whether Kubernetes `LoadBalancer` services are supported. Currently always false: expose workloads through the ingress ports instead. |

Example:

```json
{
  "endpoint": "https://203.0.113.10:6443",
  "ingress": [
    {
      "node_port": 30080,
      "protocol": "tcp",
      "public_port": 80
    },
    {
      "node_port": 30443,
      "protocol": "tcp",
      "public_port": 443
    }
  ],
  "ingress_ready": true,
  "load_balancer_service": false,
  "public_ip": "203.0.113.10",
  "rules": [
    {
      "cidrs": [],
      "kind": "api",
      "private_port": 6443,
      "protocol": "tcp",
      "public_port": 6443
    },
    {
      "cidrs": [],
      "kind": "ingress",
      "private_port": 30080,
      "protocol": "tcp",
      "public_port": 80
    },
    {
      "cidrs": [],
      "kind": "ingress",
      "private_port": 30443,
      "protocol": "tcp",
      "public_port": 443
    },
    {
      "cidrs": [],
      "kind": "port_forward",
      "private_port": 22,
      "protocol": "tcp",
      "public_port": 2222
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/networking" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Preview before deleting the cluster

`GET /v1/k8s/clusters/{id}/delete-preview`

Shows what [Delete a cluster](#operation/k8s_cluster_delete) would remove and refund, without deleting anything: the number of nodes, the data that would be lost, the expected refund of the unused prepaid period and the exact text to send as `confirm`. `data_loss` is a list of human-readable sentences in the language of the account. Costs nothing.

**Required scope:** `k8s:read`.

Scope: `k8s:read` | CLI: `k8s cluster delete-preview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `name` | string | yes | Cluster name. |
| `nodes` | integer | yes | Number of nodes that would be removed (control plane and workers). |
| `workers` | integer | yes | Number of workers. |
| `refund_cents` | integer | yes | Expected refund of the unused prepaid period in US cents, as estimated now. 0 for hourly clusters. |
| `confirm` | string | yes | Text to send as `confirm` in the delete call: the cluster name. |
| `public_ip` | string or null | yes | Public IP address that would be released and cannot be kept. |
| `data_loss` | array of string | yes | What would be lost. |
| `cycle` | string | yes | Billing cycle identifier of the cluster. |
| `paid_until` | integer or null | yes | End of the paid period of a prepaid cluster, or null (Unix time, seconds, UTC) |

Example:

```json
{
  "confirm": "prod-cluster",
  "cycle": "hourly",
  "data_loss": [
    "4 node(s) (control + workers) and all their disks",
    "All workloads, PersistentVolumes and Secrets in the cluster",
    "Public IP 203.0.113.10 (quarantined 72 h, cannot be kept)",
    "The current kubeconfig stops working"
  ],
  "name": "prod-cluster",
  "nodes": 4,
  "paid_until": null,
  "public_ip": "203.0.113.10",
  "refund_cents": 0,
  "workers": 3
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/k8s/clusters/<id>/delete-preview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a cluster (prepaid cycles charge the wallet)

`POST /v1/k8s/clusters`

Orders a new cluster. The request is validated and priced at once; the cluster itself is built in the background, so the call returns `202 Accepted` with the cluster in state `provisioning` and the queued operation. Poll [Get a cluster](#operation/k8s_cluster_get) (or follow the operation with [List operations](#operation/k8s_cluster_ops)) until `state` is `active`; this normally takes a few minutes.

**Billing.** The control plane is free. With `cycle` set to `hourly` (the default) nothing is charged now and running workers are billed every hour. With a monthly or longer cycle the first cycle for all workers is charged to the wallet immediately and refunded in full if the build fails. Your wallet balance must reach `funds.need_cents` as reported by [Get a quote](#operation/k8s_quote) (at least the up-front charge, and enough to run the new workers for the minimum number of hours).

**Limits.** The name must be unique among your live clusters. A limit on clusters per account, a daily creation limit and a cool-down after deleting a cluster apply, and your account's resource quota covers the workers and the control plane. Call the quote first to see them all. When Kubernetes is switched off for the site the call fails with `403 k8s_disabled`. Retry safely with the same `Idempotency-Key`.

**Required scope:** `k8s:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `k8s:create` | CLI: `k8s cluster create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Cluster name: 3 to 40 characters, lowercase letters, digits and hyphens, starting with a letter and not ending with a hyphen. Upper-case letters are converted to lower case. Must be unique among your live clusters. |
| `worker_plan` | string | yes | Worker plan code from the catalog, e.g. `K8S-3`. |
| `worker_count` | integer | yes | Number of workers, within the catalog `limits` (1 to 9 by default). |
| `zone_id` | integer | no | Region to build the cluster in. Defaults to the default region of the site. |
| `version_id` | integer | no | Kubernetes version, from List versions. Defaults to the default version. |
| `cycle` | string | no | Billing cycle identifier from the catalog. `hourly` (default) bills by the hour; a monthly or longer cycle is paid up front. |
| `ssh_key_id` | integer | no | One of your SSH keys, installed on every node so you can log in to them. |

Example:

```json
{
  "cycle": "hourly",
  "name": "prod-cluster",
  "version_id": 2,
  "worker_count": 3,
  "worker_plan": "K8S-3",
  "zone_id": 1
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |
| `op` | K8sOpQueued | yes | The operation queued by a create, scale, start, stop or delete call. |
| `op.id` | integer | yes | Operation identifier. Follow it with List operations. |
| `op.kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | Kind of operation that was queued. |
| `op.state` | string: `queued` | yes | Always `queued` right after the call. |

Example:

```json
{
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": false,
      "kubeconfig": false,
      "scale": false,
      "start": false,
      "stop": false,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": null,
    "endpoint": null,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": null,
    "op": {
      "created_at": 1760003700,
      "finished_at": null,
      "id": 41,
      "kind": "create",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": null,
    "ready_at": null,
    "state": "provisioning",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 0,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 0
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  },
  "op": {
    "id": 41,
    "kind": "create",
    "state": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, `name`, `worker_plan` or `worker_count` is missing or has the wrong type, `cycle` is not an available billing cycle, or `ssh_key_id` is not one of your keys. The error carries `field` or `detail`. |
| 400 | `name_invalid` | `name` is not 3 to 40 characters of lowercase letters, digits and hyphens starting with a letter and not ending with a hyphen. |
| 400 | `worker_custom_removed` | The legacy `worker` object (custom worker size) was sent. Custom sizes are no longer sold; send `worker_plan`. |
| 400 | `worker_plan_invalid` | `worker_plan` is not a plan on sale, or it is smaller than the chosen version requires (`reason` is then `version_min`, with `min_cpu` and `min_ram_mb`). The error lists the plans on sale in `plans`. |
| 400 | `version_unavailable` | `version_id` is not a version that can be ordered in this region. |
| 400 | `workers_out_of_range` | `worker_count` is outside the allowed range. The error carries `min` and `max`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is below the amount required. The error carries `need_cents` (the balance required) and `balance_cents` (your balance), both in US cents. Top up and retry. |
| 403 | `k8s_disabled` | Kubernetes is not sold on this site. |
| 403 | `email_unverified` | The account e-mail address must be verified first. |
| 403 | `cluster_limit` | You reached the maximum number of clusters. The error carries `scope` (`account`, with `max`, or `site`). |
| 403 | `quota_exceeded` | The workers and control plane would exceed your account's resource quota. The error carries `reason`, `used`, `requested`, `limit` and `need_more_cents` (US cents still to deposit to raise the quota). |
| 403 | `limit_reached` | The site's overall resource limit has been reached. Contact support. |
| 409 | `zone_not_k8s` | `zone_id` is not a region that offers Kubernetes, or no region is available. |
| 409 | `name_taken` | You already have a live cluster with this name. |
| 409 | `idempotency_conflict` | The same `Idempotency-Key` was already used on this account with a different request body. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `sales_disabled` | The site is not taking new orders. |
| 423 | `site_unavailable` | The site is temporarily not accepting new orders. |
| 429 | `cooldown` | A cluster was deleted recently and creating a new one is paused. The error carries `retry_after` in seconds. |
| 429 | `rate_limited` | The daily limit of cluster creations was reached. The error carries `retry_after` in seconds. |
| 503 | `capacity` | The platform-wide cluster limit has been reached. Try again later. |
| 503 | `quota_unavailable` | The resource quota could not be verified. Try again later. |
| 503 | `provider_unavailable` | The site cannot take new resources right now. Try again later. |
| 503 | `tenant_unavailable` | Your account could not be matched to this site. Try again in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/k8s/clusters" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"hourly","name":"prod-cluster","version_id":2,"worker_count":3,"worker_plan":"K8S-3","zone_id":1}'
```

---

#### Change worker count (costs money)

`POST /v1/k8s/clusters/{id}/scale`

Changes the number of workers. The call returns `202 Accepted` and an operation adds or removes workers in the background; `workers.desired` keeps the old number until it finishes. Only a running cluster (`state` `active`, `cs_state` `Running`) with no operation in progress can be scaled, and at most 6 scale operations per hour are allowed per cluster.

**Adding workers** charges money. On an hourly cluster nothing is charged now, but your balance must cover the minimum number of hours of the added workers. On a prepaid cluster the added workers are charged immediately for the rest of the paid period (`charged_cents`), and refunded if the operation fails; a prepaid cluster whose paid period has ended cannot be scaled until it renews. Your resource quota and the site limits also apply. **Removing workers** deletes nodes (and anything stored only on them); for a prepaid cluster the unused part of the paid period is refunded when the operation finishes.

When Kubernetes is switched off for the site the call fails with `403 k8s_disabled`. Retry safely with the same `Idempotency-Key`.

**Required scope:** `k8s:scale`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `k8s:scale` | CLI: `k8s cluster scale` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `worker_count` | integer | yes | New number of workers, within the catalog `limits` (1 to 9 by default) and different from the current number. |

Example:

```json
{
  "worker_count": 5
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cluster` | K8sCluster | yes | A Kubernetes cluster. |
| `cluster.id` | string | yes | Cluster identifier (UUID). Use it as the `id` path parameter of every cluster operation. |
| `cluster.name` | string | yes | Cluster name: 3 to 40 lowercase letters, digits and hyphens. |
| `cluster.note` | string or null | no | Free-form note set with Update a cluster, or null when empty. Left out of the items of List clusters. |
| `cluster.state` | string: `provisioning`, `active`, `stopped`, `locked`, `deleting`, `deleted`, `failed` | yes | Lifecycle state. `provisioning`: being built. `active`: built and running. `stopped`: stopped by you. `locked`: stopped and blocked by the platform (see `lock`). `deleting`: being removed. `deleted`: gone (still readable for 30 days). `failed`: the build failed (see `public_error`); delete it to clean up. |
| `cluster.cs_state` | string or null | yes | Live status of the cluster software, e.g. `Running`, `Stopped`, `Starting`, `Scaling`, `Alert`, `Error`. Null until it has been reported. A cluster is usable when `state` is `active` and this is `Running`. |
| `cluster.zone` | Zone or null | yes | Region the cluster runs in. |
| `cluster.version` | object | yes | Kubernetes version the cluster runs. |
| `cluster.version.id` | integer | yes | Version identifier. |
| `cluster.version.name` | string | yes | Display name, e.g. `v1.35.0`. |
| `cluster.version.semver` | string | yes | Semantic version, e.g. `1.35.0`. |
| `cluster.version.eol_at` | integer or null | yes | End-of-life date of the version, or null when none is announced (Unix time, seconds, UTC) |
| `cluster.endpoint` | string or null | yes | URL of the Kubernetes API server, e.g. `https://203.0.113.10:6443`. Null until the cluster is ready. |
| `cluster.public_ip` | string or null | yes | Public IP address of the cluster. Null until the cluster is ready. |
| `cluster.control_plane` | object | yes | Control plane specification. It is free and managed for you. |
| `cluster.control_plane.count` | integer | yes | Number of control plane nodes. |
| `cluster.control_plane.cpu` | integer | yes | vCPU of each control plane node. |
| `cluster.control_plane.ram_mb` | integer | yes | Memory of each control plane node in MiB. |
| `cluster.control_plane.free` | boolean | yes | Always true: the control plane is not billed. |
| `cluster.workers` | object | yes | Worker node configuration. |
| `cluster.workers.custom` | boolean | yes | True only for older clusters created before fixed worker plans existed; `plan_code` is then null. |
| `cluster.workers.plan_code` | string or null | yes | Worker plan code, e.g. `K8S-3`. |
| `cluster.workers.plan` | string | yes | Display label of the worker plan, e.g. `K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)`. |
| `cluster.workers.cpu` | integer | yes | vCPU of each worker. |
| `cluster.workers.ram_mb` | integer | yes | Memory of each worker in MiB. |
| `cluster.workers.disk_gb` | integer | yes | NVMe system disk of each worker in GiB. |
| `cluster.workers.desired` | integer | yes | Number of workers you asked for. After a scale call it keeps the old value until the operation finishes. |
| `cluster.workers.observed` | integer | yes | Number of workers the platform last counted. |
| `cluster.workers.running` | integer | yes | Number of workers that are running right now. |
| `cluster.pricing` | K8sPricing | yes | What the cluster costs at its current size. |
| `cluster.pricing.worker_hourly_uusd` | integer | yes | Price of one worker per hour in millionths of a US dollar. |
| `cluster.pricing.hourly_uusd` | integer | yes | Price of the whole cluster per hour in millionths of a US dollar (workers only; the control plane is free). |
| `cluster.pricing.monthly_cents` | integer | yes | Price of the whole cluster for a month of 730 hours in US cents. |
| `cluster.pricing.control_plane_cents` | integer | yes | Price of the control plane. Always 0. |
| `cluster.billing` | K8sCycleBilling | yes | How the cluster is billed. |
| `cluster.billing.cycle` | string | yes | Billing cycle identifier: `hourly`, or a prepaid cycle such as `monthly`. |
| `cluster.billing.months` | integer | yes | Length of the cycle in months (0 = billed by the hour). |
| `cluster.billing.paid_until` | integer or null | yes | End of the period already paid for, or null for hourly clusters (Unix time, seconds, UTC) |
| `cluster.billing.auto_renew` | boolean | yes | Whether a prepaid cluster renews at the end of the paid period. Only meaningful for prepaid cycles. |
| `cluster.billing.worker_cycle_cents` | integer | yes | Price of one worker for one full cycle in US cents (0 for hourly clusters). |
| `cluster.billing.cycle_cents` | integer | yes | Price of one full cycle for all workers (`worker_cycle_cents` times the worker count) in US cents. |
| `cluster.lock` | object or null | yes | Present only while `state` is `locked`. While locked, scale, start, stop and kubeconfig are refused with `423 cluster_locked`; deleting is still allowed. |
| `cluster.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why the cluster is locked: `no_funds` (the wallet could not pay the hourly charges), `expired` (a prepaid period ended and was not renewed), `admin` (blocked by the site operator), `abuse` (blocked for a policy violation). |
| `cluster.lock.locked_at` | integer or null | yes | When the cluster was locked (Unix time, seconds, UTC) |
| `cluster.lock.destroy_after` | integer or null | yes | When an unresolved lock leads to automatic deletion, if scheduled (Unix time, seconds, UTC) |
| `cluster.op` | K8sOp or null | yes | The operation in progress, or null when the cluster is idle. |
| `cluster.can` | object | yes | Which actions are possible in the current state. |
| `cluster.can.scale` | boolean | yes | Scale can be called now. |
| `cluster.can.start` | boolean | yes | Start can be called now. |
| `cluster.can.stop` | boolean | yes | Stop can be called now. |
| `cluster.can.kubeconfig` | boolean | yes | The kubeconfig can be downloaded now. |
| `cluster.can.upgrade` | boolean | yes | Version upgrades. Always false: upgrades are not available through the API yet. |
| `cluster.can.delete` | boolean | yes | Delete can be called now. |
| `cluster.public_error` | string or null | yes | Only when `state` is `failed`: reason code (`capacity`, `timeout`, `cloud_limit`, `network`, `cancelled`, `cks_failed` or `internal`). Null otherwise. |
| `cluster.created_at` | integer | yes | When the cluster was ordered (Unix time, seconds, UTC) |
| `cluster.ready_at` | integer or null | yes | When the cluster first became ready, or null if it has not (Unix time, seconds, UTC) |
| `cluster.updated_at` | integer | yes | When the cluster record last changed (Unix time, seconds, UTC) |
| `op` | K8sOpQueued | yes | The operation queued by a create, scale, start, stop or delete call. |
| `op.id` | integer | yes | Operation identifier. Follow it with List operations. |
| `op.kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | Kind of operation that was queued. |
| `op.state` | string: `queued` | yes | Always `queued` right after the call. |
| `charged_cents` | integer | yes | Amount charged to the wallet now in US cents: the prorated price of the added workers on a prepaid cluster, otherwise 0. |

Example:

```json
{
  "charged_cents": 0,
  "cluster": {
    "billing": {
      "auto_renew": true,
      "cycle": "hourly",
      "cycle_cents": 0,
      "months": 0,
      "paid_until": null,
      "worker_cycle_cents": 0
    },
    "can": {
      "delete": false,
      "kubeconfig": true,
      "scale": false,
      "start": false,
      "stop": false,
      "upgrade": false
    },
    "control_plane": {
      "count": 1,
      "cpu": 2,
      "free": true,
      "ram_mb": 2048
    },
    "created_at": 1760000000,
    "cs_state": "Running",
    "endpoint": "https://203.0.113.10:6443",
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "lock": null,
    "name": "prod-cluster",
    "note": "Production workloads",
    "op": {
      "created_at": 1760003700,
      "finished_at": null,
      "id": 41,
      "kind": "scale",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "pricing": {
      "control_plane_cents": 0,
      "hourly_uusd": 67200,
      "monthly_cents": 4906,
      "worker_hourly_uusd": 22400
    },
    "public_error": null,
    "public_ip": "203.0.113.10",
    "ready_at": 1760000540,
    "state": "active",
    "updated_at": 1760003600,
    "version": {
      "eol_at": null,
      "id": 2,
      "name": "v1.35.0",
      "semver": "1.35.0"
    },
    "workers": {
      "cpu": 4,
      "custom": false,
      "desired": 3,
      "disk_gb": 70,
      "observed": 3,
      "plan": "K8S-3 (4 vCPU / 8 GB / 70 GB NVMe)",
      "plan_code": "K8S-3",
      "ram_mb": 8192,
      "running": 3
    },
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  },
  "op": {
    "id": 41,
    "kind": "scale",
    "state": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, `worker_count` is missing or not an integer, or it equals the current number of workers. |
| 400 | `workers_out_of_range` | `worker_count` is outside the allowed range. The error carries `min` and `max`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is below the amount required. The error carries `need_cents` (the balance required) and `balance_cents` (your balance), both in US cents. |
| 403 | `k8s_disabled` | Kubernetes is not sold on this site. |
| 403 | `quota_exceeded` | The added workers would exceed your account's resource quota. The error carries `reason`, `used`, `requested`, `limit` and `need_more_cents`. |
| 403 | `limit_reached` | The site's overall resource limit has been reached. Contact support. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `cluster_busy` | Another operation is running, or the prepaid period has ended and the cluster is waiting for renewal. |
| 409 | `cluster_not_running` | The cluster is not running (`state` is not `active` or `cs_state` is not `Running`). |
| 409 | `idempotency_conflict` | The same `Idempotency-Key` was already used on this account with a different request body. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `cluster_locked` | The cluster is locked. The error carries `reason`, `locked_at` and `destroy_after`. |
| 423 | `site_unavailable` | The site is temporarily not accepting new resources. |
| 429 | `rate_limited` | Too many scale operations on this cluster in the last hour. The error carries `retry_after` in seconds. |
| 503 | `quota_unavailable` | The resource quota could not be verified. Try again later. |
| 503 | `provider_unavailable` | The site cannot take new resources right now. Try again later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/k8s/clusters/<id>/scale" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"worker_count":5}'
```

---

#### Delete the cluster (data is lost)

`DELETE /v1/k8s/clusters/{id}`

Deletes the cluster with all its nodes and disks, its stored data and its public IP address. **This cannot be undone.** Send the exact cluster name in `confirm`; call [Preview a deletion](#operation/k8s_cluster_delete_preview) first to see what will be lost and the expected refund.

The call returns `202 Accepted`: the cluster goes to `deleting` and an operation removes it in the background, after which it becomes `deleted`. For a prepaid cluster the unused part of the paid period is refunded to the wallet when the operation finishes; `refund_cents` is that amount as estimated now. Hourly clusters have nothing to refund and stop being billed. Clusters locked for a policy violation are not refunded.

Allowed while the cluster is `active`, `stopped`, `locked` or `failed` and no other operation is running. This call works even when the site no longer sells Kubernetes. Retry safely with the same `Idempotency-Key`.

**Required scope:** `k8s:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `k8s:destroy` | CLI: `k8s cluster delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Cluster identifier (UUID), taken from the `id` field of Create a cluster or List clusters. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | string | yes | The exact name of the cluster (case-insensitive), as a guard against deleting the wrong one. |

Example:

```json
{
  "confirm": "prod-cluster"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | K8sOpQueued | yes | The operation queued by a create, scale, start, stop or delete call. |
| `op.id` | integer | yes | Operation identifier. Follow it with List operations. |
| `op.kind` | string: `create`, `scale`, `start`, `stop`, `upgrade`, `delete`, `limits`, `autoscale`, `worker_plan`, `ingress_sync` | yes | Kind of operation that was queued. |
| `op.state` | string: `queued` | yes | Always `queued` right after the call. |
| `refund_cents` | integer | yes | Expected refund of the unused prepaid period in US cents, as estimated now. 0 for hourly clusters. |

Example:

```json
{
  "op": {
    "id": 44,
    "kind": "delete",
    "state": "queued"
  },
  "refund_cents": 0
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object. |
| 400 | `confirm_mismatch` | `confirm` is missing or does not match the cluster name. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `cluster_busy` | The cluster is provisioning, already being deleted or deleted, or another operation is running. Wait for it to finish. |
| 409 | `idempotency_conflict` | The same `Idempotency-Key` was already used on this account with a different request body. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/k8s/clusters/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"prod-cluster"}'
```

---

### Private Cloud

Private Cloud networks with their own dedicated, unmetered bandwidth plan. A Private Cloud is a private network (a /16 range) split into tiers (/24 subnets, each with its own IPv6 /64), protected by Network ACL rules, with one virtual router and one public IP address for outbound traffic. Servers are placed in a tier when you create them.

Creating, changing the plan, adding or removing tiers, editing ACL rules and deleting are asynchronous: the call answers `202` with an `op` and the Private Cloud settles in the background, so poll [Get a Private Cloud](#operation/vpc_get) or [List operations](#operation/vpc_ops). Only one operation runs at a time; a second change meanwhile fails with `409 vpc_busy`.

Ordering calls (catalog, quote, create, change plan, add tier) answer `403 vpc_disabled` while Private Cloud is not enabled for your account. Existing Private Clouds stay readable, their ACL can be edited and they can be deleted. Amounts ending in `_cents` are US cents; amounts ending in `_uusd` are millionths of a US dollar per hour; timestamps are Unix seconds. Hidden on sites that do not sell Private Cloud.

#### Private Cloud catalog: bandwidth plans, cycles, limits

`GET /v1/vpc/catalog`

Returns what you can order: the bandwidth plans (dedicated, unmetered Mbps) with their price for every billing cycle, the billing cycles, the region where Private Clouds are built, and the limits that apply to your account (`limits.used` of `limits.max_per_account` Private Clouds already created). Prices are the retail prices of the site you call, in US dollars. Nothing is created or charged.

Use [Quote a Private Cloud](#operation/vpc_quote) to price one plan and check your balance before ordering. Fails with `403 vpc_disabled` while Private Cloud is not enabled for your account.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `vpc catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plans` | array of VpcPlan | yes |  |
| `plans[].id` | integer | yes | Plan identifier. It can be passed as `plan` instead of the slug. |
| `plans[].slug` | string | yes | Stable short name of the plan, e.g. `100m`. Pass it as `plan` when ordering or changing plan. |
| `plans[].name` | string | yes | Display name, e.g. `100 Mbps`. |
| `plans[].mbps` | integer | yes | Dedicated bandwidth of the plan in Mbit/s, for inbound and outbound traffic. |
| `plans[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plans[].monthly_cents` | integer | yes | Price for a month of 730 hours in US cents (`hours_per_month` of the catalog). |
| `plans[].label` | string | yes | Short marketing label, e.g. `Unmetered traffic · 100 Mbps dedicated`. |
| `plans[].cycles` | array of VpcPlanCycle | yes |  |
| `plans[].cycles[].cycle` | string | yes | Billing cycle identifier. |
| `plans[].cycles[].name` | string | yes | Display name of the cycle. |
| `plans[].cycles[].months` | integer | yes | Length of the cycle in months. `0` means pay by the hour. |
| `plans[].cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `plans[].cycles[].cycle_cents` | integer | yes | Price of one full cycle of this plan in US cents. `0` for hourly billing (you pay per hour instead). |
| `cycles` | array of VpcCycle | yes |  |
| `cycles[].slug` | string | yes | Billing cycle identifier. Pass it as `cycle` when ordering, e.g. `hourly`, `monthly`, `yearly`. |
| `cycles[].name` | string | yes | Display name of the cycle. |
| `cycles[].months` | integer | yes | Length of the cycle in months. `0` means pay by the hour. |
| `cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `zone` | Zone or null | yes |  |
| `limits` | object | yes |  |
| `limits.max_per_account` | integer | yes | How many Private Clouds one account may own at the same time. |
| `limits.used` | integer | yes | How many you own now (Private Clouds being created or deleted count, deleted and failed ones do not). |
| `limits.max_tiers` | integer | yes | Maximum tiers per Private Cloud, including the default tier. |
| `limits.max_vms` | integer | yes | Maximum servers per Private Cloud. |
| `limits.max_acl_rules` | integer | yes | Maximum ACL rules you can add per Private Cloud (platform rules do not count). |
| `limits.min_hours_to_create` | integer | yes | Hours of plan price your wallet balance must cover to order a Private Cloud. |
| `features` | object | yes |  |
| `features.unmetered` | boolean | yes | Always `true`: no transfer quota. |
| `features.ipv6_per_tier` | string | yes | Size of the IPv6 subnet every tier receives, e.g. `/64`. |
| `features.router` | string | yes | `single`: one virtual router and one public IP address per Private Cloud. |
| `features.network_acl` | boolean | yes | Network ACL rules are available. |
| `hours_per_month` | integer | yes | Hours in a billing month (730), used for `monthly_cents`. |

Example:

```json
{
  "cycles": [
    {
      "discount_pct": 0.0,
      "months": 0,
      "name": "Hourly",
      "slug": "hourly"
    },
    {
      "discount_pct": 0.0,
      "months": 1,
      "name": "Monthly",
      "slug": "monthly"
    },
    {
      "discount_pct": 10.0,
      "months": 12,
      "name": "1 year",
      "slug": "yearly"
    }
  ],
  "features": {
    "ipv6_per_tier": "/64",
    "network_acl": true,
    "router": "single",
    "unmetered": true
  },
  "hours_per_month": 730,
  "limits": {
    "max_acl_rules": 50,
    "max_per_account": 1,
    "max_tiers": 3,
    "max_vms": 50,
    "min_hours_to_create": 24,
    "used": 0
  },
  "plans": [
    {
      "cycles": [
        {
          "cycle": "hourly",
          "cycle_cents": 0,
          "discount_pct": 0.0,
          "months": 0,
          "name": "Hourly"
        },
        {
          "cycle": "monthly",
          "cycle_cents": 384,
          "discount_pct": 0.0,
          "months": 1,
          "name": "Monthly"
        },
        {
          "cycle": "yearly",
          "cycle_cents": 4147,
          "discount_pct": 10.0,
          "months": 12,
          "name": "1 year"
        }
      ],
      "hourly_uusd": 5257,
      "id": 2,
      "label": "Unmetered traffic · 100 Mbps dedicated",
      "mbps": 100,
      "monthly_cents": 384,
      "name": "100 Mbps",
      "slug": "100m"
    }
  ],
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `vpc_disabled` | Private Cloud is not enabled on this site for your account. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a Private Cloud + required balance (no charge)

`GET /v1/vpc/quote`

Prices one plan for one billing cycle and tells you whether you can order it right now, without creating or charging anything. `quote` holds the prices; `funds` compares your wallet with the balance an order needs (`need_cents`: the first charge, or `min_hours` hours of the plan price for hourly billing, whichever is larger); `checks` lists the other ordering conditions; `can_create` is `true` only when every condition passes.

Order with [Create a Private Cloud](#operation/vpc_create) using the same `plan` and `cycle`. Fails with `403 vpc_disabled` while Private Cloud is not enabled for your account.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `plan` | string | yes | Plan to price: the plan `slug` (e.g. `100m`) or its numeric `id`, both from the catalog. |
| `cycle` | string | no | Billing cycle slug from the catalog, e.g. `hourly`, `monthly`, `yearly`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plan` | VpcPlan | yes |  |
| `plan.id` | integer | yes | Plan identifier. It can be passed as `plan` instead of the slug. |
| `plan.slug` | string | yes | Stable short name of the plan, e.g. `100m`. Pass it as `plan` when ordering or changing plan. |
| `plan.name` | string | yes | Display name, e.g. `100 Mbps`. |
| `plan.mbps` | integer | yes | Dedicated bandwidth of the plan in Mbit/s, for inbound and outbound traffic. |
| `plan.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `plan.monthly_cents` | integer | yes | Price for a month of 730 hours in US cents (`hours_per_month` of the catalog). |
| `plan.label` | string | yes | Short marketing label, e.g. `Unmetered traffic · 100 Mbps dedicated`. |
| `plan.cycles` | array of VpcPlanCycle | yes |  |
| `plan.cycles[].cycle` | string | yes | Billing cycle identifier. |
| `plan.cycles[].name` | string | yes | Display name of the cycle. |
| `plan.cycles[].months` | integer | yes | Length of the cycle in months. `0` means pay by the hour. |
| `plan.cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `plan.cycles[].cycle_cents` | integer | yes | Price of one full cycle of this plan in US cents. `0` for hourly billing (you pay per hour instead). |
| `quote` | VpcQuote | yes |  |
| `quote.plan_id` | integer | yes | Plan identifier. |
| `quote.mbps` | integer | yes | Dedicated bandwidth of the plan in Mbit/s. |
| `quote.cycle` | string | yes | Billing cycle slug the quote is for. |
| `quote.cycle_name` | string | yes | Display name of the cycle. |
| `quote.months` | integer | yes | Months in the cycle. `0` for hourly billing. |
| `quote.discount_pct` | number | yes | Cycle discount in percent. |
| `quote.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `quote.monthly_cents` | integer | yes | Price for a month of 730 hours in US cents. |
| `quote.cycle_cents` | integer | yes | Price of one full cycle in US cents. `0` for hourly billing. |
| `quote.first_charge_cents` | integer | yes | Amount taken from the wallet when the order is placed, in US cents. `0` for hourly billing: the first hour is charged when the Private Cloud becomes active. |
| `funds` | object | yes |  |
| `funds.balance_cents` | integer | yes | Your wallet balance in US cents. |
| `funds.need_cents` | integer | yes | Balance an order needs, in US cents. |
| `funds.enough` | boolean | yes | Whether `balance_cents` covers `need_cents`. |
| `funds.first_charge_cents` | integer | yes | Amount charged immediately by the order, in US cents (0 for hourly billing). |
| `funds.min_hours` | integer | yes | Hours of plan price a balance must cover for hourly billing. |
| `checks` | object | yes |  |
| `checks.sales_enabled` | boolean | yes | New orders are being accepted. |
| `checks.email_verified` | boolean | yes | Your e-mail address is verified (or verification is not required). |
| `checks.vpc` | object | yes |  |
| `checks.vpc.used` | integer | yes | Private Clouds you own now. |
| `checks.vpc.max` | integer | yes | Maximum per account. |
| `checks.vpc.total_ok` | boolean | yes | The platform still has room for another Private Cloud. |
| `checks.provider_ok` | boolean | yes | The site operator can accept a new order. |
| `can_create` | boolean | yes | `true` when an order with this plan and cycle would be accepted right now. |

Example:

```json
{
  "can_create": true,
  "checks": {
    "email_verified": true,
    "provider_ok": true,
    "sales_enabled": true,
    "vpc": {
      "max": 1,
      "total_ok": true,
      "used": 0
    }
  },
  "funds": {
    "balance_cents": 2500,
    "enough": true,
    "first_charge_cents": 384,
    "min_hours": 24,
    "need_cents": 384
  },
  "plan": {
    "cycles": [
      {
        "cycle": "hourly",
        "cycle_cents": 0,
        "discount_pct": 0.0,
        "months": 0,
        "name": "Hourly"
      },
      {
        "cycle": "monthly",
        "cycle_cents": 384,
        "discount_pct": 0.0,
        "months": 1,
        "name": "Monthly"
      },
      {
        "cycle": "yearly",
        "cycle_cents": 4147,
        "discount_pct": 10.0,
        "months": 12,
        "name": "1 year"
      }
    ],
    "hourly_uusd": 5257,
    "id": 2,
    "label": "Unmetered traffic · 100 Mbps dedicated",
    "mbps": 100,
    "monthly_cents": 384,
    "name": "100 Mbps",
    "slug": "100m"
  },
  "quote": {
    "cycle": "monthly",
    "cycle_cents": 384,
    "cycle_name": "Monthly",
    "discount_pct": 0.0,
    "first_charge_cents": 384,
    "hourly_uusd": 5257,
    "mbps": 100,
    "monthly_cents": 384,
    "months": 1,
    "plan_id": 2
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `cycle` is not a known or enabled billing cycle. The error carries a `detail` text. |
| 403 | `vpc_disabled` | Private Cloud is not enabled on this site for your account. |
| 422 | `plan_unavailable` | `plan` is missing, unknown or not on sale. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/quote?plan=<plan>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List Private Clouds

`GET /v1/vpc`

Lists your Private Clouds, oldest first by default. Deleted Private Clouds are hidden unless you filter with `state=deleted`, which shows those deleted in the last 30 days. Besides the page, the response tells you whether Private Cloud is enabled for you (`enabled`) and whether you may create another one now (`can_create`: enabled and below your limit).

The list items omit `note` and `tiers`; use [Get a Private Cloud](#operation/vpc_get) for the full object.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `name`, `state`, `mbps`, `plan`, `public_ip` | no | Field to sort by. `plan` and `mbps` both sort by bandwidth. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `state` | string: `all`, `active`, `locked`, `provisioning`, `failed`, `deleted` | no | Only Private Clouds in this state. `all` (the default) lists every state except `deleted`. |
| `q` | string | no | Case-insensitive search in the name, the public IP address and the CIDR. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Vpc | yes |  |
| `items[].id` | string | yes | Private Cloud identifier (UUID). Use it in the `:id` path parameter and as the network when creating servers. |
| `items[].name` | string | yes | Name, unique within your account. |
| `items[].note` | string or null | no | Free-text note, up to 500 characters. Only present on the detail view (Get, Create, Update, Change plan). |
| `items[].state` | string: `provisioning`, `active`, `locked`, `deleting`, `deleted`, `failed` | yes | `provisioning`: being created. `active`: ready. `locked`: suspended for an unpaid bill or by support - bandwidth is cut to 1 Mbps until it is unlocked (see `lock`). `deleting`: being deleted. `deleted`: gone (still listed for 30 days). `failed`: creation failed (prepaid charges were refunded). |
| `items[].zone` | Zone or null | yes |  |
| `items[].cidr` | string | yes | Private IPv4 range of the Private Cloud, always a /16 inside 10.128.0.0/9, e.g. `10.128.0.0/16`. |
| `items[].public_ip` | string or null | yes | Public IPv4 address used by the virtual router for outbound traffic (source NAT); null until the Private Cloud is ready. |
| `items[].router` | string or null | yes | State of the virtual router, for example `Running`; null until the first health check. |
| `items[].plan` | object | yes |  |
| `items[].plan.id` | integer | yes | Plan identifier. |
| `items[].plan.slug` | string or null | yes | Plan slug. |
| `items[].plan.name` | string or null | yes | Plan display name. |
| `items[].plan.mbps` | integer | yes | Bandwidth of the plan in Mbit/s. |
| `items[].bandwidth` | object | yes |  |
| `items[].bandwidth.mbps` | integer | yes | Dedicated bandwidth of the current plan in Mbit/s. |
| `items[].bandwidth.unmetered` | boolean | yes | Always `true`: traffic is not metered, there is no transfer quota or overage charge. |
| `items[].bandwidth.label` | string | yes | Short human-readable description of the bandwidth. |
| `items[].bandwidth.effective_mbps` | integer | yes | Bandwidth applied right now. Equals `mbps`, except `1` while the Private Cloud is locked. |
| `items[].ipv6` | array of object | yes |  |
| `items[].ipv6[].tier` | string | yes | Tier name. |
| `items[].ipv6[].cidr` | string | yes | IPv6 /64 subnet of that tier. |
| `items[].tier_count` | integer | yes | Number of tiers. |
| `items[].vm_count` | integer | yes | Number of servers in the Private Cloud. |
| `items[].pricing` | object | yes |  |
| `items[].pricing.hourly_uusd` | integer | yes | Price you pay per hour in millionths of a US dollar. It is fixed when you order or change plan. |
| `items[].pricing.monthly_cents` | integer | yes | The same price for a month of 730 hours, in US cents. |
| `items[].billing` | object | yes |  |
| `items[].billing.cycle` | string | yes | Billing cycle slug, `hourly` or a prepaid cycle such as `monthly`. |
| `items[].billing.months` | integer | yes | Months in the cycle; `0` for hourly billing. |
| `items[].billing.paid_until` | integer or null | yes | End of the period already paid; null for hourly billing (Unix time, seconds, UTC) |
| `items[].billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically from the wallet. |
| `items[].billing.cycle_cents` | integer | yes | Price of one cycle in US cents; `0` for hourly billing. |
| `items[].lock` | object or null | yes |  |
| `items[].lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why it is locked: `no_funds` (hourly bill unpaid), `expired` (prepaid period ended), `admin` or `abuse` (locked by support - it cannot be deleted until support unlocks it). |
| `items[].lock.locked_at` | integer or null | yes | When it was locked (Unix time, seconds, UTC) |
| `items[].lock.destroy_after` | integer or null | yes | When an unpaid Private Cloud without servers will be deleted automatically; null when no automatic deletion is scheduled (Unix time, seconds, UTC) |
| `items[].op` | VpcOp or null | yes |  |
| `items[].can` | object | yes |  |
| `items[].can.change_plan` | boolean | yes | The bandwidth plan can be changed now (state `active`, no operation running). |
| `items[].can.add_tier` | boolean | yes | A tier can be added now (state `active`, no operation running; the tier limit is checked when you add). |
| `items[].can.acl` | boolean | yes | ACL rules can be added and deleted (state `active` or `locked`). |
| `items[].can.create_vm` | boolean | yes | Servers can be created in this Private Cloud (state `active`). |
| `items[].can.delete` | boolean | yes | The Private Cloud can be deleted now: state `active` or `locked`, no operation running, no servers, and not locked by support. |
| `items[].public_error` | string or null | yes | Reason code when `state` is `failed` (for example `capacity`, `timeout`, `no_public_ip`, `internal`); null otherwise. |
| `items[].created_at` | integer | yes | When it was ordered (Unix time, seconds, UTC) |
| `items[].ready_at` | integer or null | yes | When it became active; null before that (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Last change (Unix time, seconds, UTC) |
| `items[].tiers` | array of VpcTier | no |  |
| `items[].tiers[].id` | string | yes | Tier identifier. |
| `items[].tiers[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `items[].tiers[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `items[].tiers[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `items[].tiers[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `items[].tiers[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `items[].tiers[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `items[].tiers[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `items[].tiers[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `items[].tiers[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `items[].tiers[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `items[].tiers[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `enabled` | boolean | yes | Whether Private Cloud is enabled for your account. |
| `can_create` | boolean | yes | Whether you can create another Private Cloud now (enabled and below `max_per_account`). |

Example:

```json
{
  "can_create": false,
  "enabled": true,
  "items": [
    {
      "bandwidth": {
        "effective_mbps": 100,
        "label": "Unmetered traffic · 100 Mbps dedicated",
        "mbps": 100,
        "unmetered": true
      },
      "billing": {
        "auto_renew": true,
        "cycle": "monthly",
        "cycle_cents": 384,
        "months": 1,
        "paid_until": 1795000000
      },
      "can": {
        "acl": true,
        "add_tier": true,
        "change_plan": true,
        "create_vm": true,
        "delete": false
      },
      "cidr": "10.128.0.0/16",
      "created_at": 1792400000,
      "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "ipv6": [
        {
          "cidr": "2001:db8:10:1::/64",
          "tier": "default"
        }
      ],
      "lock": null,
      "name": "prod-net",
      "op": null,
      "plan": {
        "id": 2,
        "mbps": 100,
        "name": "100 Mbps",
        "slug": "100m"
      },
      "pricing": {
        "hourly_uusd": 5257,
        "monthly_cents": 384
      },
      "public_error": null,
      "public_ip": "203.0.113.25",
      "ready_at": 1792400180,
      "router": "Running",
      "state": "active",
      "tier_count": 1,
      "updated_at": 1792400180,
      "vm_count": 2,
      "zone": {
        "city": "Ho Chi Minh City",
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "name_en": "Ho Chi Minh City",
        "slug": "hcm-1"
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page`, `per_page`, `sort`, `dir` or `state` is not valid. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one Private Cloud

`GET /v1/vpc/{id}`

Returns one Private Cloud with its tiers, billing, current operation and what you can do with it now (`can`). A Private Cloud you deleted stays readable, with state `deleted`, for 30 days. Use the list calls for the parts that grow: [tiers](#operation/vpc_tier_list), [ACL rules](#operation/vpc_acl_list), [servers](#operation/vpc_vms) and [public IPs](#operation/vpc_ips).

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vpc` | Vpc | yes |  |
| `vpc.id` | string | yes | Private Cloud identifier (UUID). Use it in the `:id` path parameter and as the network when creating servers. |
| `vpc.name` | string | yes | Name, unique within your account. |
| `vpc.note` | string or null | no | Free-text note, up to 500 characters. Only present on the detail view (Get, Create, Update, Change plan). |
| `vpc.state` | string: `provisioning`, `active`, `locked`, `deleting`, `deleted`, `failed` | yes | `provisioning`: being created. `active`: ready. `locked`: suspended for an unpaid bill or by support - bandwidth is cut to 1 Mbps until it is unlocked (see `lock`). `deleting`: being deleted. `deleted`: gone (still listed for 30 days). `failed`: creation failed (prepaid charges were refunded). |
| `vpc.zone` | Zone or null | yes |  |
| `vpc.cidr` | string | yes | Private IPv4 range of the Private Cloud, always a /16 inside 10.128.0.0/9, e.g. `10.128.0.0/16`. |
| `vpc.public_ip` | string or null | yes | Public IPv4 address used by the virtual router for outbound traffic (source NAT); null until the Private Cloud is ready. |
| `vpc.router` | string or null | yes | State of the virtual router, for example `Running`; null until the first health check. |
| `vpc.plan` | object | yes |  |
| `vpc.plan.id` | integer | yes | Plan identifier. |
| `vpc.plan.slug` | string or null | yes | Plan slug. |
| `vpc.plan.name` | string or null | yes | Plan display name. |
| `vpc.plan.mbps` | integer | yes | Bandwidth of the plan in Mbit/s. |
| `vpc.bandwidth` | object | yes |  |
| `vpc.bandwidth.mbps` | integer | yes | Dedicated bandwidth of the current plan in Mbit/s. |
| `vpc.bandwidth.unmetered` | boolean | yes | Always `true`: traffic is not metered, there is no transfer quota or overage charge. |
| `vpc.bandwidth.label` | string | yes | Short human-readable description of the bandwidth. |
| `vpc.bandwidth.effective_mbps` | integer | yes | Bandwidth applied right now. Equals `mbps`, except `1` while the Private Cloud is locked. |
| `vpc.ipv6` | array of object | yes |  |
| `vpc.ipv6[].tier` | string | yes | Tier name. |
| `vpc.ipv6[].cidr` | string | yes | IPv6 /64 subnet of that tier. |
| `vpc.tier_count` | integer | yes | Number of tiers. |
| `vpc.vm_count` | integer | yes | Number of servers in the Private Cloud. |
| `vpc.pricing` | object | yes |  |
| `vpc.pricing.hourly_uusd` | integer | yes | Price you pay per hour in millionths of a US dollar. It is fixed when you order or change plan. |
| `vpc.pricing.monthly_cents` | integer | yes | The same price for a month of 730 hours, in US cents. |
| `vpc.billing` | object | yes |  |
| `vpc.billing.cycle` | string | yes | Billing cycle slug, `hourly` or a prepaid cycle such as `monthly`. |
| `vpc.billing.months` | integer | yes | Months in the cycle; `0` for hourly billing. |
| `vpc.billing.paid_until` | integer or null | yes | End of the period already paid; null for hourly billing (Unix time, seconds, UTC) |
| `vpc.billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically from the wallet. |
| `vpc.billing.cycle_cents` | integer | yes | Price of one cycle in US cents; `0` for hourly billing. |
| `vpc.lock` | object or null | yes |  |
| `vpc.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why it is locked: `no_funds` (hourly bill unpaid), `expired` (prepaid period ended), `admin` or `abuse` (locked by support - it cannot be deleted until support unlocks it). |
| `vpc.lock.locked_at` | integer or null | yes | When it was locked (Unix time, seconds, UTC) |
| `vpc.lock.destroy_after` | integer or null | yes | When an unpaid Private Cloud without servers will be deleted automatically; null when no automatic deletion is scheduled (Unix time, seconds, UTC) |
| `vpc.op` | VpcOp or null | yes |  |
| `vpc.can` | object | yes |  |
| `vpc.can.change_plan` | boolean | yes | The bandwidth plan can be changed now (state `active`, no operation running). |
| `vpc.can.add_tier` | boolean | yes | A tier can be added now (state `active`, no operation running; the tier limit is checked when you add). |
| `vpc.can.acl` | boolean | yes | ACL rules can be added and deleted (state `active` or `locked`). |
| `vpc.can.create_vm` | boolean | yes | Servers can be created in this Private Cloud (state `active`). |
| `vpc.can.delete` | boolean | yes | The Private Cloud can be deleted now: state `active` or `locked`, no operation running, no servers, and not locked by support. |
| `vpc.public_error` | string or null | yes | Reason code when `state` is `failed` (for example `capacity`, `timeout`, `no_public_ip`, `internal`); null otherwise. |
| `vpc.created_at` | integer | yes | When it was ordered (Unix time, seconds, UTC) |
| `vpc.ready_at` | integer or null | yes | When it became active; null before that (Unix time, seconds, UTC) |
| `vpc.updated_at` | integer | yes | Last change (Unix time, seconds, UTC) |
| `vpc.tiers` | array of VpcTier | no |  |
| `vpc.tiers[].id` | string | yes | Tier identifier. |
| `vpc.tiers[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `vpc.tiers[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `vpc.tiers[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `vpc.tiers[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `vpc.tiers[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `vpc.tiers[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `vpc.tiers[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `vpc.tiers[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `vpc.tiers[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `vpc.tiers[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `vpc.tiers[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |

Example:

```json
{
  "vpc": {
    "bandwidth": {
      "effective_mbps": 100,
      "label": "Unmetered traffic · 100 Mbps dedicated",
      "mbps": 100,
      "unmetered": true
    },
    "billing": {
      "auto_renew": true,
      "cycle": "monthly",
      "cycle_cents": 384,
      "months": 1,
      "paid_until": 1795000000
    },
    "can": {
      "acl": true,
      "add_tier": true,
      "change_plan": true,
      "create_vm": true,
      "delete": false
    },
    "cidr": "10.128.0.0/16",
    "created_at": 1792400000,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": [
      {
        "cidr": "2001:db8:10:1::/64",
        "tier": "default"
      }
    ],
    "lock": null,
    "name": "prod-net",
    "note": "Production network",
    "op": null,
    "plan": {
      "id": 2,
      "mbps": 100,
      "name": "100 Mbps",
      "slug": "100m"
    },
    "pricing": {
      "hourly_uusd": 5257,
      "monthly_cents": 384
    },
    "public_error": null,
    "public_ip": "203.0.113.25",
    "ready_at": 1792400180,
    "router": "Running",
    "state": "active",
    "tier_count": 1,
    "tiers": [
      {
        "can_delete": false,
        "cidr": "10.128.1.0/24",
        "created_at": 1792400000,
        "gateway": "10.128.1.1",
        "id": "7b1e2c44-52d0-4f6b-8a3e-90d1c6a5e2f1",
        "index": 1,
        "ipv6_cidr": "2001:db8:10:1::/64",
        "ipv6_gateway": "2001:db8:10:1::1",
        "is_default": true,
        "name": "default",
        "state": "active",
        "vm_count": 2
      }
    ],
    "updated_at": 1792400180,
    "vm_count": 2,
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rename / notes / auto-renew

`PATCH /v1/vpc/{id}`

Changes the name, the note or the automatic renewal of a Private Cloud. Nothing is charged and the network is not touched. Send only the fields you want to change. It works in every state except `deleting`, `deleted` and `failed`.

Turning `auto_renew` on also retries unlocking a Private Cloud that was locked because its prepaid period ended or its bill was unpaid; when your balance covers it, the charge is taken from the wallet and the Private Cloud is unlocked.

**Required scope:** `vpc:write`.

Scope: `vpc:write` | CLI: `vpc update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | New name, same rules as when creating. It must be unique among your Private Clouds. |
| `note` | string or null | no | New note, up to 500 characters (longer text is cut). An empty string or null clears the note. |
| `auto_renew` | boolean | no | Whether a prepaid cycle renews automatically from the wallet when it ends. |

Example:

```json
{
  "auto_renew": false,
  "name": "prod-net-2",
  "note": "Production network"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vpc` | Vpc | yes |  |
| `vpc.id` | string | yes | Private Cloud identifier (UUID). Use it in the `:id` path parameter and as the network when creating servers. |
| `vpc.name` | string | yes | Name, unique within your account. |
| `vpc.note` | string or null | no | Free-text note, up to 500 characters. Only present on the detail view (Get, Create, Update, Change plan). |
| `vpc.state` | string: `provisioning`, `active`, `locked`, `deleting`, `deleted`, `failed` | yes | `provisioning`: being created. `active`: ready. `locked`: suspended for an unpaid bill or by support - bandwidth is cut to 1 Mbps until it is unlocked (see `lock`). `deleting`: being deleted. `deleted`: gone (still listed for 30 days). `failed`: creation failed (prepaid charges were refunded). |
| `vpc.zone` | Zone or null | yes |  |
| `vpc.cidr` | string | yes | Private IPv4 range of the Private Cloud, always a /16 inside 10.128.0.0/9, e.g. `10.128.0.0/16`. |
| `vpc.public_ip` | string or null | yes | Public IPv4 address used by the virtual router for outbound traffic (source NAT); null until the Private Cloud is ready. |
| `vpc.router` | string or null | yes | State of the virtual router, for example `Running`; null until the first health check. |
| `vpc.plan` | object | yes |  |
| `vpc.plan.id` | integer | yes | Plan identifier. |
| `vpc.plan.slug` | string or null | yes | Plan slug. |
| `vpc.plan.name` | string or null | yes | Plan display name. |
| `vpc.plan.mbps` | integer | yes | Bandwidth of the plan in Mbit/s. |
| `vpc.bandwidth` | object | yes |  |
| `vpc.bandwidth.mbps` | integer | yes | Dedicated bandwidth of the current plan in Mbit/s. |
| `vpc.bandwidth.unmetered` | boolean | yes | Always `true`: traffic is not metered, there is no transfer quota or overage charge. |
| `vpc.bandwidth.label` | string | yes | Short human-readable description of the bandwidth. |
| `vpc.bandwidth.effective_mbps` | integer | yes | Bandwidth applied right now. Equals `mbps`, except `1` while the Private Cloud is locked. |
| `vpc.ipv6` | array of object | yes |  |
| `vpc.ipv6[].tier` | string | yes | Tier name. |
| `vpc.ipv6[].cidr` | string | yes | IPv6 /64 subnet of that tier. |
| `vpc.tier_count` | integer | yes | Number of tiers. |
| `vpc.vm_count` | integer | yes | Number of servers in the Private Cloud. |
| `vpc.pricing` | object | yes |  |
| `vpc.pricing.hourly_uusd` | integer | yes | Price you pay per hour in millionths of a US dollar. It is fixed when you order or change plan. |
| `vpc.pricing.monthly_cents` | integer | yes | The same price for a month of 730 hours, in US cents. |
| `vpc.billing` | object | yes |  |
| `vpc.billing.cycle` | string | yes | Billing cycle slug, `hourly` or a prepaid cycle such as `monthly`. |
| `vpc.billing.months` | integer | yes | Months in the cycle; `0` for hourly billing. |
| `vpc.billing.paid_until` | integer or null | yes | End of the period already paid; null for hourly billing (Unix time, seconds, UTC) |
| `vpc.billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically from the wallet. |
| `vpc.billing.cycle_cents` | integer | yes | Price of one cycle in US cents; `0` for hourly billing. |
| `vpc.lock` | object or null | yes |  |
| `vpc.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why it is locked: `no_funds` (hourly bill unpaid), `expired` (prepaid period ended), `admin` or `abuse` (locked by support - it cannot be deleted until support unlocks it). |
| `vpc.lock.locked_at` | integer or null | yes | When it was locked (Unix time, seconds, UTC) |
| `vpc.lock.destroy_after` | integer or null | yes | When an unpaid Private Cloud without servers will be deleted automatically; null when no automatic deletion is scheduled (Unix time, seconds, UTC) |
| `vpc.op` | VpcOp or null | yes |  |
| `vpc.can` | object | yes |  |
| `vpc.can.change_plan` | boolean | yes | The bandwidth plan can be changed now (state `active`, no operation running). |
| `vpc.can.add_tier` | boolean | yes | A tier can be added now (state `active`, no operation running; the tier limit is checked when you add). |
| `vpc.can.acl` | boolean | yes | ACL rules can be added and deleted (state `active` or `locked`). |
| `vpc.can.create_vm` | boolean | yes | Servers can be created in this Private Cloud (state `active`). |
| `vpc.can.delete` | boolean | yes | The Private Cloud can be deleted now: state `active` or `locked`, no operation running, no servers, and not locked by support. |
| `vpc.public_error` | string or null | yes | Reason code when `state` is `failed` (for example `capacity`, `timeout`, `no_public_ip`, `internal`); null otherwise. |
| `vpc.created_at` | integer | yes | When it was ordered (Unix time, seconds, UTC) |
| `vpc.ready_at` | integer or null | yes | When it became active; null before that (Unix time, seconds, UTC) |
| `vpc.updated_at` | integer | yes | Last change (Unix time, seconds, UTC) |
| `vpc.tiers` | array of VpcTier | no |  |
| `vpc.tiers[].id` | string | yes | Tier identifier. |
| `vpc.tiers[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `vpc.tiers[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `vpc.tiers[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `vpc.tiers[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `vpc.tiers[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `vpc.tiers[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `vpc.tiers[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `vpc.tiers[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `vpc.tiers[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `vpc.tiers[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `vpc.tiers[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |

Example:

```json
{
  "vpc": {
    "bandwidth": {
      "effective_mbps": 100,
      "label": "Unmetered traffic · 100 Mbps dedicated",
      "mbps": 100,
      "unmetered": true
    },
    "billing": {
      "auto_renew": false,
      "cycle": "monthly",
      "cycle_cents": 384,
      "months": 1,
      "paid_until": 1795000000
    },
    "can": {
      "acl": true,
      "add_tier": true,
      "change_plan": true,
      "create_vm": true,
      "delete": false
    },
    "cidr": "10.128.0.0/16",
    "created_at": 1792400000,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": [
      {
        "cidr": "2001:db8:10:1::/64",
        "tier": "default"
      }
    ],
    "lock": null,
    "name": "prod-net-2",
    "note": "Production network",
    "op": null,
    "plan": {
      "id": 2,
      "mbps": 100,
      "name": "100 Mbps",
      "slug": "100m"
    },
    "pricing": {
      "hourly_uusd": 5257,
      "monthly_cents": 384
    },
    "public_error": null,
    "public_ip": "203.0.113.25",
    "ready_at": 1792400180,
    "router": "Running",
    "state": "active",
    "tier_count": 1,
    "tiers": [
      {
        "can_delete": false,
        "cidr": "10.128.1.0/24",
        "created_at": 1792400000,
        "gateway": "10.128.1.1",
        "id": "7b1e2c44-52d0-4f6b-8a3e-90d1c6a5e2f1",
        "index": 1,
        "ipv6_cidr": "2001:db8:10:1::/64",
        "ipv6_gateway": "2001:db8:10:1::1",
        "is_default": true,
        "name": "default",
        "state": "active",
        "vm_count": 2
      }
    ],
    "updated_at": 1792410000,
    "vm_count": 2,
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, or `auto_renew` is not a boolean. |
| 400 | `name_invalid` | `name` does not follow the naming rules. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `name_taken` | You already have another Private Cloud with this name. |
| 409 | `vpc_busy` | The Private Cloud is being deleted, or is deleted or failed. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/vpc/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_renew":false,"name":"prod-net-2","note":"Production network"}'
```

---

#### Quote a bandwidth plan change

`GET /v1/vpc/{id}/plan-quote`

Shows what changing the bandwidth plan of this Private Cloud to `plan` would cost, without changing anything. For a prepaid cycle the difference for the rest of the paid period is charged (`charge_cents`) or refunded (`refund_cents`); for hourly billing nothing is charged now and the new hourly price applies from the next billed hour, but moving to a more expensive plan needs a balance covering 24 hours of the new price. `enough` tells whether your balance covers `need_cents`.

Apply it with [Change the bandwidth plan](#operation/vpc_plan_change).

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc plan-quote`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `plan` | string | yes | Target plan: the plan `slug` (e.g. `500m`) or numeric `id`, from the catalog. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `from` | object | yes |  |
| `from.plan_id` | integer | yes | Current plan identifier. |
| `from.mbps` | integer | yes | Current bandwidth in Mbit/s. |
| `from.hourly_uusd` | integer | yes | Current price per hour in millionths of a US dollar. |
| `to` | VpcPlan | yes |  |
| `to.id` | integer | yes | Plan identifier. It can be passed as `plan` instead of the slug. |
| `to.slug` | string | yes | Stable short name of the plan, e.g. `100m`. Pass it as `plan` when ordering or changing plan. |
| `to.name` | string | yes | Display name, e.g. `100 Mbps`. |
| `to.mbps` | integer | yes | Dedicated bandwidth of the plan in Mbit/s, for inbound and outbound traffic. |
| `to.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `to.monthly_cents` | integer | yes | Price for a month of 730 hours in US cents (`hours_per_month` of the catalog). |
| `to.label` | string | yes | Short marketing label, e.g. `Unmetered traffic · 100 Mbps dedicated`. |
| `to.cycles` | array of VpcPlanCycle | yes |  |
| `to.cycles[].cycle` | string | yes | Billing cycle identifier. |
| `to.cycles[].name` | string | yes | Display name of the cycle. |
| `to.cycles[].months` | integer | yes | Length of the cycle in months. `0` means pay by the hour. |
| `to.cycles[].discount_pct` | number | yes | Discount for paying this cycle up front, in percent. |
| `to.cycles[].cycle_cents` | integer | yes | Price of one full cycle of this plan in US cents. `0` for hourly billing (you pay per hour instead). |
| `quote` | VpcQuote | yes |  |
| `quote.plan_id` | integer | yes | Plan identifier. |
| `quote.mbps` | integer | yes | Dedicated bandwidth of the plan in Mbit/s. |
| `quote.cycle` | string | yes | Billing cycle slug the quote is for. |
| `quote.cycle_name` | string | yes | Display name of the cycle. |
| `quote.months` | integer | yes | Months in the cycle. `0` for hourly billing. |
| `quote.discount_pct` | number | yes | Cycle discount in percent. |
| `quote.hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `quote.monthly_cents` | integer | yes | Price for a month of 730 hours in US cents. |
| `quote.cycle_cents` | integer | yes | Price of one full cycle in US cents. `0` for hourly billing. |
| `quote.first_charge_cents` | integer | yes | Amount taken from the wallet when the order is placed, in US cents. `0` for hourly billing: the first hour is charged when the Private Cloud becomes active. |
| `charge_cents` | integer | yes | Amount that would be charged now, in US cents. |
| `refund_cents` | integer | yes | Amount that would be refunded now, in US cents. |
| `need_cents` | integer | yes | Balance required to make the change, in US cents. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |
| `enough` | boolean | yes | Whether `balance_cents` covers `need_cents`. |
| `applies` | string | yes | When the new bandwidth takes effect. Always `immediately`. |
| `hourly_note` | boolean | yes | `true` when the Private Cloud is billed by the hour: `charge_cents` and `refund_cents` are then 0 and the new price applies from the next billed hour. |

Example:

```json
{
  "applies": "immediately",
  "balance_cents": 2500,
  "charge_cents": 1920,
  "enough": true,
  "from": {
    "hourly_uusd": 5257,
    "mbps": 100,
    "plan_id": 2
  },
  "hourly_note": false,
  "need_cents": 1920,
  "quote": {
    "cycle": "monthly",
    "cycle_cents": 2302,
    "cycle_name": "Monthly",
    "discount_pct": 0.0,
    "first_charge_cents": 2302,
    "hourly_uusd": 31539,
    "mbps": 500,
    "monthly_cents": 2302,
    "months": 1,
    "plan_id": 3
  },
  "refund_cents": 0,
  "to": {
    "cycles": [
      {
        "cycle": "hourly",
        "cycle_cents": 0,
        "discount_pct": 0.0,
        "months": 0,
        "name": "Hourly"
      },
      {
        "cycle": "monthly",
        "cycle_cents": 2302,
        "discount_pct": 0.0,
        "months": 1,
        "name": "Monthly"
      }
    ],
    "hourly_uusd": 31539,
    "id": 3,
    "label": "Unmetered traffic · 500 Mbps dedicated",
    "mbps": 500,
    "monthly_cents": 2302,
    "name": "500 Mbps",
    "slug": "500m"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The billing cycle of the Private Cloud can no longer be priced. The error carries a `detail` text. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `plan_unavailable` | `plan` is missing, unknown or not on sale. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/plan-quote?plan=<plan>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List tiers (subnets)

`GET /v1/vpc/{id}/tiers`

Lists the tiers (subnets) of a Private Cloud, the default tier first, with the number of servers in each. `max` is the most tiers a Private Cloud may have, the default tier included. Deleted and failed tiers are not listed.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc tier list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpcTier | yes |  |
| `items[].id` | string | yes | Tier identifier. |
| `items[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `items[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `items[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `items[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `items[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `items[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `items[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `items[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `items[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `items[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `items[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |
| `total` | integer | yes | Number of tiers. |
| `max` | integer | yes | Maximum number of tiers per Private Cloud. |

Example:

```json
{
  "items": [
    {
      "can_delete": false,
      "cidr": "10.128.1.0/24",
      "created_at": 1792400000,
      "gateway": "10.128.1.1",
      "id": "7b1e2c44-52d0-4f6b-8a3e-90d1c6a5e2f1",
      "index": 1,
      "ipv6_cidr": "2001:db8:10:1::/64",
      "ipv6_gateway": "2001:db8:10:1::1",
      "is_default": true,
      "name": "default",
      "state": "active",
      "vm_count": 2
    },
    {
      "can_delete": false,
      "cidr": "10.128.2.0/24",
      "created_at": 1792403600,
      "gateway": "10.128.2.1",
      "id": "c2d9a1f0-3b64-4e0a-9f75-6a1d2e8b4c33",
      "index": 2,
      "ipv6_cidr": null,
      "ipv6_gateway": null,
      "is_default": false,
      "name": "web",
      "state": "provisioning",
      "vm_count": 0
    }
  ],
  "max": 3,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/tiers" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add a tier

`POST /v1/vpc/{id}/tiers`

Adds a tier (a /24 IPv4 subnet with its own IPv6 /64) to the Private Cloud. The tier is created in the background: the call returns `202` with the new tier in state `provisioning`; it can host servers once it is `active`. Adding a tier costs nothing. A Private Cloud holds at most `max` tiers (see List tiers); beyond that the call fails with `403 tier_limit`.

The Private Cloud must be `active` with no other operation running, you can add or remove at most 10 tiers per Private Cloud in 24 hours, and the call fails with `403 vpc_disabled` while Private Cloud is not enabled for your account.

**Required scope:** `vpc:write`.

Scope: `vpc:write` | CLI: `vpc tier add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Tier name, 2-32 characters: lowercase letters, digits and hyphens, starting with a letter and not ending with a hyphen. It must be unique in the Private Cloud. |
| `index` | integer | no | Subnet number 2-254: the tier gets the `/24` with this third octet inside the Private Cloud range (index 3 of `10.128.0.0/16` is `10.128.3.0/24`). Omit it to use the lowest free number. Index 1 is the default tier. |

Example:

```json
{
  "index": 2,
  "name": "web"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `tier` | VpcTier | yes |  |
| `tier.id` | string | yes | Tier identifier. |
| `tier.name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `tier.index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `tier.cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `tier.gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `tier.is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `tier.ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `tier.ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `tier.state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `tier.vm_count` | integer | yes | Number of servers currently in the tier. |
| `tier.created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `tier.can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |
| `op` | VpcOpRef | yes |  |
| `op.id` | integer | yes | Operation identifier. It also appears in List operations. |
| `op.kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does. |
| `op.state` | string: `queued` | yes | State when the call returned. Operations always start `queued`. |

Example:

```json
{
  "op": {
    "id": 44,
    "kind": "tier_add",
    "state": "queued"
  },
  "tier": {
    "can_delete": false,
    "cidr": "10.128.2.0/24",
    "created_at": 1792403600,
    "gateway": "10.128.2.1",
    "id": "c2d9a1f0-3b64-4e0a-9f75-6a1d2e8b4c33",
    "index": 2,
    "ipv6_cidr": null,
    "ipv6_gateway": null,
    "is_default": false,
    "name": "web",
    "state": "provisioning",
    "vm_count": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, or `index` is not an integer from 2 to 254 (the error carries `field: "index"`). |
| 400 | `name_invalid` | `name` does not follow the naming rules. |
| 403 | `vpc_disabled` | Private Cloud is not enabled on this site for your account. |
| 403 | `tier_limit` | The Private Cloud already has the maximum number of tiers. The error carries `max`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `name_taken` | Another tier of this Private Cloud has this name. |
| 409 | `bad_input` | `index` is already used by another tier (the error carries `field: "index"`). |
| 409 | `vpc_busy` | Another operation is running, or the Private Cloud is not `active`. |
| 423 | `vpc_locked` | The Private Cloud is locked; settle the bill or contact support first. |
| 429 | `rate_limited` | Too many tier changes in the last 24 hours. The error carries `retry_after` (seconds). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpc/<id>/tiers" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"index":2,"name":"web"}'
```

---

#### Delete a tier (no VMs left)

`DELETE /v1/vpc/{id}/tiers/{tier}`

Deletes a tier that has no servers left. The tier moves to `deleting` and is removed in the background (`202` with an `op`). A tier that never became ready (state `failed`, not listed) is discarded at once and answered with `200` and `{"deleted": true}`. The default tier cannot be deleted.

**Required scope:** `vpc:write`.

Scope: `vpc:write` | CLI: `vpc tier delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |
| `tier` | string | yes | Tier (subnet) identifier as returned by List tiers. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | VpcOpRef | no |  |
| `op.id` | integer | yes | Operation identifier. It also appears in List operations. |
| `op.kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does. |
| `op.state` | string: `queued` | yes | State when the call returned. Operations always start `queued`. |
| `deleted` | boolean | no | Present and `true` only when a tier that never became ready was discarded immediately (status 200, no `op`). |

Example:

```json
{
  "op": {
    "id": 47,
    "kind": "tier_del",
    "state": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `bad_input` | This is the default tier (`detail: "default tier"`), which cannot be deleted. |
| 409 | `vpc_busy` | Another operation is running, the tier is not `active`, or the Private Cloud is not `active` or `locked`. |
| 409 | `vpc_has_vms` | Servers are still in the tier. Delete or move them first. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vpc/<id>/tiers/<tier>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Network ACL rules

`GET /v1/vpc/{id}/acl`

Lists the Network ACL rules of a Private Cloud in ascending order of `number`. The ACL applies to all tiers. A new Private Cloud starts with rules that allow SSH (22), RDP (3389) and ICMP in and everything out for IPv4 and IPv6, plus platform rules (numbers 1-8, `system: true`): rule 1 allows traffic to the Private Cloud's own range and rules 2-6 block outbound traffic to other private address ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10 and 169.254.0.0/16). Traffic that matches no rule is denied in both directions (`default_policy`). `max` is the number of rules you may add; platform rules do not count.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc acl list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpcAclRule | yes |  |
| `items[].id` | string | yes | Rule identifier. Pass it to Delete an ACL rule. |
| `items[].number` | integer | yes | Priority of the rule, 1-9999. Rules are evaluated in ascending order of number and the first match decides. Numbers 1-8 belong to platform rules. |
| `items[].direction` | string: `ingress`, `egress` | yes | `ingress` filters traffic entering the Private Cloud, `egress` traffic leaving it. |
| `items[].protocol` | string: `tcp`, `udp`, `icmp`, `all` | yes | Protocol the rule matches. |
| `items[].start_port` | integer or null | yes | First port of the range for `tcp` / `udp`; null for `icmp` and `all`. |
| `items[].end_port` | integer or null | yes | Last port of the range for `tcp` / `udp`; null for `icmp` and `all`. |
| `items[].cidr` | string | yes | Remote address range the rule matches: the source for `ingress`, the destination for `egress`. IPv4 or IPv6 CIDR, e.g. `0.0.0.0/0` or `::/0`. |
| `items[].action` | string: `allow`, `deny` | yes | What happens to matching traffic. |
| `items[].note` | string or null | yes | Free-text label, at most 100 characters. |
| `items[].is_default` | boolean | yes | True for rules created together with the Private Cloud and for platform rules. |
| `items[].system` | boolean | yes | True for platform rules (numbers 1-8). They protect the infrastructure and cannot be changed or deleted. |
| `items[].state` | string: `pending`, `active`, `deleting`, `failed` | yes | `pending` until the rule is applied, `active` when it filters traffic, `deleting` while it is removed, `failed` when it could not be applied (delete it and try again). |
| `items[].error` | string or null: `apply_failed` | yes | `apply_failed` when the rule could not be applied; null otherwise. |
| `items[].created_at` | integer | yes | When the rule was added (Unix time, seconds, UTC) |
| `total` | integer | yes | Number of rules, platform rules included. |
| `max` | integer | yes | Maximum number of rules you can add to one Private Cloud. |
| `default_policy` | object | yes |  |
| `default_policy.ingress` | string | yes | What happens to inbound traffic that matches no rule: `deny`. |
| `default_policy.egress` | string | yes | What happens to outbound traffic that matches no rule: `deny`. |

Example:

```json
{
  "default_policy": {
    "egress": "deny",
    "ingress": "deny"
  },
  "items": [
    {
      "action": "allow",
      "cidr": "10.128.0.0/16",
      "created_at": 1792400000,
      "direction": "egress",
      "end_port": null,
      "error": null,
      "id": "0a9c3e51-7f24-4d68-8b1a-5c6e2d7f9013",
      "is_default": true,
      "note": "Platform: VPC network",
      "number": 1,
      "protocol": "all",
      "start_port": null,
      "state": "active",
      "system": true
    },
    {
      "action": "allow",
      "cidr": "0.0.0.0/0",
      "created_at": 1792400000,
      "direction": "ingress",
      "end_port": 22,
      "error": null,
      "id": "5d8b1f27-4c90-4a3e-9e62-1b7a0c4d8e55",
      "is_default": true,
      "note": "SSH",
      "number": 10,
      "protocol": "tcp",
      "start_port": 22,
      "state": "active",
      "system": false
    },
    {
      "action": "allow",
      "cidr": "0.0.0.0/0",
      "created_at": 1792401000,
      "direction": "ingress",
      "end_port": 443,
      "error": null,
      "id": "e4a07b9c-61d2-4c58-b3f1-2d8a9c5e7016",
      "is_default": false,
      "note": "HTTPS",
      "number": 100,
      "protocol": "tcp",
      "start_port": 443,
      "state": "active",
      "system": false
    }
  ],
  "max": 50,
  "total": 3
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/acl" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Add a Network ACL rule

`POST /v1/vpc/{id}/acl`

Adds a Network ACL rule. The rule is applied in the background: the call returns `202` with the rule in state `pending`, and it filters traffic once its state is `active`. Rules are evaluated in ascending order of `number` and the first match decides, so give a `deny` a lower number than the `allow` it must override. Without `number` the rule is numbered after your last rule below 900 in steps of 10; numbers 1-8 are reserved for platform rules and numbers 900-901 hold the default "allow all outbound" rules.

Validation: `direction` `ingress` or `egress`; `protocol` `tcp`, `udp`, `icmp` or `all`; for `tcp` and `udp` a `start_port` of 1-65535 and an `end_port` not below it (ports are ignored for `icmp` and `all`); `cidr` an IPv4 or IPv6 CIDR with prefix length; `action` `allow` or `deny`. Values are case-insensitive. An invalid rule answers `422 acl_invalid` with `field` naming the first wrong field. A Private Cloud holds at most `max` rules (`403 acl_limit`) and you can add at most 60 rules per hour (`429 rate_limited`).

**Required scope:** `vpc:write`.

Scope: `vpc:write` | CLI: `vpc acl add`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `direction` | string: `ingress`, `egress` | no | `ingress` for traffic entering the Private Cloud (the CIDR is the source), `egress` for traffic leaving it (the CIDR is the destination). Default `ingress`. |
| `protocol` | string: `tcp`, `udp`, `icmp`, `all` | yes | Protocol to match. |
| `start_port` | integer | no | First port, 1-65535. Required for `tcp` and `udp`; ignored for `icmp` and `all`. |
| `end_port` | integer | no | Last port, 1-65535, not below `start_port`. Defaults to `start_port` (a single port). Ignored for `icmp` and `all`. |
| `cidr` | string | yes | IPv4 or IPv6 range to match, with prefix length, e.g. `203.0.113.0/24`, `0.0.0.0/0` or `::/0`. IPv6 is lowercased. |
| `action` | string: `allow`, `deny` | no | What to do with matching traffic. Default `allow`. |
| `note` | string | no | Label shown in the list, up to 100 characters (control characters are removed, longer text is cut). |
| `number` | integer | no | Priority 1-9999; lower numbers are evaluated first. 1-8 are reserved. It must not be used by another rule. Omit it to let the API pick the next free number. |

Example:

```json
{
  "action": "allow",
  "cidr": "0.0.0.0/0",
  "direction": "ingress",
  "end_port": 443,
  "note": "HTTPS",
  "number": 100,
  "protocol": "tcp",
  "start_port": 443
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `rule` | VpcAclRule | yes |  |
| `rule.id` | string | yes | Rule identifier. Pass it to Delete an ACL rule. |
| `rule.number` | integer | yes | Priority of the rule, 1-9999. Rules are evaluated in ascending order of number and the first match decides. Numbers 1-8 belong to platform rules. |
| `rule.direction` | string: `ingress`, `egress` | yes | `ingress` filters traffic entering the Private Cloud, `egress` traffic leaving it. |
| `rule.protocol` | string: `tcp`, `udp`, `icmp`, `all` | yes | Protocol the rule matches. |
| `rule.start_port` | integer or null | yes | First port of the range for `tcp` / `udp`; null for `icmp` and `all`. |
| `rule.end_port` | integer or null | yes | Last port of the range for `tcp` / `udp`; null for `icmp` and `all`. |
| `rule.cidr` | string | yes | Remote address range the rule matches: the source for `ingress`, the destination for `egress`. IPv4 or IPv6 CIDR, e.g. `0.0.0.0/0` or `::/0`. |
| `rule.action` | string: `allow`, `deny` | yes | What happens to matching traffic. |
| `rule.note` | string or null | yes | Free-text label, at most 100 characters. |
| `rule.is_default` | boolean | yes | True for rules created together with the Private Cloud and for platform rules. |
| `rule.system` | boolean | yes | True for platform rules (numbers 1-8). They protect the infrastructure and cannot be changed or deleted. |
| `rule.state` | string: `pending`, `active`, `deleting`, `failed` | yes | `pending` until the rule is applied, `active` when it filters traffic, `deleting` while it is removed, `failed` when it could not be applied (delete it and try again). |
| `rule.error` | string or null: `apply_failed` | yes | `apply_failed` when the rule could not be applied; null otherwise. |
| `rule.created_at` | integer | yes | When the rule was added (Unix time, seconds, UTC) |
| `op` | VpcOpRef or null | yes |  |

Example:

```json
{
  "op": {
    "id": 45,
    "kind": "acl_sync",
    "state": "queued"
  },
  "rule": {
    "action": "allow",
    "cidr": "0.0.0.0/0",
    "created_at": 1792401000,
    "direction": "ingress",
    "end_port": 443,
    "error": null,
    "id": "e4a07b9c-61d2-4c58-b3f1-2d8a9c5e7016",
    "is_default": false,
    "note": "HTTPS",
    "number": 100,
    "protocol": "tcp",
    "start_port": 443,
    "state": "pending",
    "system": false
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object. |
| 403 | `acl_limit` | The Private Cloud already has the maximum number of rules. The error carries `max`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `acl_invalid` | `number` is already used by another rule (the error carries `field: "number"`). |
| 409 | `vpc_busy` | The Private Cloud is not `active` or `locked`. |
| 422 | `acl_invalid` | A field is wrong. The error carries `field`: `direction`, `protocol`, `action`, `cidr`, `start_port` (missing for tcp/udp), `port` (outside 1-65535 or end below start) or `number` (outside 1-9999 or reserved 1-8). |
| 429 | `rate_limited` | More than 60 rules were added in the last hour. The error carries `retry_after` (seconds). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpc/<id>/acl" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"allow","cidr":"0.0.0.0/0","direction":"ingress","end_port":443,"note":"HTTPS","number":100,"protocol":"tcp","start_port":443}'
```

---

#### Delete a Network ACL rule

`DELETE /v1/vpc/{id}/acl/{rule}`

Deletes a Network ACL rule, including the default rules created with the Private Cloud. The rule stops filtering traffic within a few seconds; the call returns `202` while it is removed in the background. Platform rules (`system: true`) cannot be deleted (`403 acl_system_rule`). Deleting is never rate limited, so you can always remove a dangerous rule at once.

**Required scope:** `vpc:write`.

Scope: `vpc:write` | CLI: `vpc acl delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |
| `rule` | string | yes | Network ACL rule identifier as returned by List ACL rules. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `deleted` | boolean | yes | Always `true`: the deletion was accepted. |

Example:

```json
{
  "deleted": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `acl_system_rule` | This is a platform rule and cannot be deleted. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vpc_busy` | The rule is already being deleted. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vpc/<id>/acl/<rule>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### VMs in the Private Cloud

`GET /v1/vpc/{id}/vms`

Lists the servers that are in the Private Cloud, newest first, with the tier each one is in. Servers you deleted are not listed. To put a server in a Private Cloud, choose the network and tier when you create it.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc vms`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string | yes | Server identifier (UUID) for the `/v1/vm/:id` calls. |
| `items[].hostname` | string | yes | Server hostname. |
| `items[].display_name` | string | yes | Server display name. |
| `items[].state` | string | yes | Server state, e.g. `provisioning`, `active`, `stopped`, `locked`. |
| `items[].cs_state` | string or null | yes | Power state reported by the compute platform, e.g. `Running`; null until known. |
| `items[].public_ip` | string or null | yes | Public IPv4 address, when the server has one. |
| `items[].private_ip` | string or null | yes | Private IPv4 address inside its tier. |
| `items[].ipv6` | string or null | yes | IPv6 address from the IPv6 /64 of its tier. |
| `items[].tier` | string | yes | Name of the tier the server is in. |
| `items[].cpu` | integer | yes | Virtual CPU cores. |
| `items[].ram_mb` | integer | yes | Memory in MiB. |
| `items[].disk_gb` | integer | yes | System disk in GiB. |
| `items[].joined_at` | integer | yes | When the server joined the Private Cloud (Unix time, seconds, UTC) |
| `total` | integer | yes | Number of servers listed. |

Example:

```json
{
  "items": [
    {
      "cpu": 2,
      "cs_state": "Running",
      "disk_gb": 60,
      "display_name": "web-1",
      "hostname": "web-1",
      "id": "9e41c7d2-0b38-4f5a-a6d4-3c8e1f2b7a90",
      "ipv6": "2001:db8:10:1::a",
      "joined_at": 1792402000,
      "private_ip": "10.128.1.10",
      "public_ip": "203.0.113.77",
      "ram_mb": 4096,
      "state": "active",
      "tier": "default"
    }
  ],
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/vms" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Public IPs of the Private Cloud

`GET /v1/vpc/{id}/ips`

Lists the public IPv4 addresses that belong to the Private Cloud: the address of the virtual router, used for outbound traffic of servers without their own address (`kind` `snat`), and the public address of each server that has one (`kind` `vm`). Traffic of all these addresses counts toward the plan bandwidth shown by [Get bandwidth](#operation/vpc_bandwidth).

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc ips`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].ip` | string | yes | Public IPv4 address. |
| `items[].kind` | string: `snat`, `vm` | yes | `snat`: the router address shared by the Private Cloud. `vm`: an address assigned to one server. |
| `items[].vm_id` | string or null | yes | Server identifier for `vm` addresses; null for `snat`. |
| `items[].hostname` | string or null | yes | Hostname of that server; null for `snat`. |
| `items[].nat` | string: `source_nat`, `static_nat` | yes | `source_nat`: outbound-only translation shared by the Private Cloud. `static_nat`: 1:1 address of one server. |
| `total` | integer | yes | Number of addresses. |

Example:

```json
{
  "items": [
    {
      "hostname": null,
      "ip": "203.0.113.25",
      "kind": "snat",
      "nat": "source_nat",
      "vm_id": null
    },
    {
      "hostname": "web-1",
      "ip": "203.0.113.77",
      "kind": "vm",
      "nat": "static_nat",
      "vm_id": "9e41c7d2-0b38-4f5a-a6d4-3c8e1f2b7a90"
    }
  ],
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/ips" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth chart (Mbps, plan limit)

`GET /v1/vpc/{id}/bandwidth`

Returns inbound and outbound traffic of all public addresses of the Private Cloud (router address, server addresses and the IPv6 prefixes of the tiers) as a time series in Mbit/s, with the bandwidth cap of the plan and utilisation statistics. Traffic is not metered or billed; the chart only helps you choose a plan. `series` holds one `[time, inbound_mbps, outbound_mbps]` point every `step` seconds; "inbound" is traffic towards your addresses, "outbound" traffic from them.

If measurements are temporarily unavailable `available` is `false` and the series is zero. The `1h` window is cached for about 20 seconds and limited to 20 calls per minute per account.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc bandwidth`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `24h`, `7d`, `30d` | no | Time window ending now. Points are 60 s apart for `1h`, 300 s for `24h`, 1800 s for `7d` and 3600 s for `30d`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `range` | string | yes | The window that was returned. |
| `step` | integer | yes | Seconds between points of `series`. |
| `from` | integer | yes | Start of the window (Unix time, seconds, UTC) |
| `to` | integer | yes | End of the window (Unix time, seconds, UTC) |
| `limit_mbps` | integer | yes | Bandwidth cap of the plan in Mbit/s (1 while the Private Cloud is locked). Use it as the reference line of a chart. |
| `unmetered` | boolean | yes | Always `true`: traffic is not billed. |
| `available` | boolean | yes | `false` when no measurement could be read for this window. |
| `ip_count` | integer | yes | Number of addresses and prefixes measured. |
| `series` | array of array of number | yes |  |
| `stats` | object | yes |  |
| `stats.peak_in_mbps` | number | yes | Highest inbound rate in the window, Mbit/s. |
| `stats.peak_out_mbps` | number | yes | Highest outbound rate in the window, Mbit/s. |
| `stats.avg_in_mbps` | number | yes | Average inbound rate, Mbit/s. |
| `stats.avg_out_mbps` | number | yes | Average outbound rate, Mbit/s. |
| `stats.peak_util_pct` | number | yes | Peak of the busier direction as a percentage of `limit_mbps`. |
| `stats.avg_util_pct` | number | yes | Average of the busier direction as a percentage of `limit_mbps`. |
| `stats.in_bytes` | integer | yes | Total inbound traffic in the window, bytes. |
| `stats.out_bytes` | integer | yes | Total outbound traffic in the window, bytes. |

Example:

```json
{
  "available": true,
  "from": 1792410000,
  "ip_count": 2,
  "limit_mbps": 100,
  "range": "24h",
  "series": [
    [
      1792410000,
      1.25,
      0.8
    ],
    [
      1792410300,
      3.5,
      2.1
    ],
    [
      1792410600,
      0.0,
      0.0
    ]
  ],
  "stats": {
    "avg_in_mbps": 3.12,
    "avg_out_mbps": 1.4,
    "avg_util_pct": 3.1,
    "in_bytes": 33696000000,
    "out_bytes": 15120000000,
    "peak_in_mbps": 42.5,
    "peak_out_mbps": 18.3,
    "peak_util_pct": 42.5
  },
  "step": 300,
  "to": 1792496400,
  "unmetered": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `range` is not one of `1h`, `24h`, `7d`, `30d` (the error carries `field: "range"`). |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 429 | `rate_limited` | More than 20 `1h` requests in a minute. The error carries `retry_after` (seconds). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Private Cloud operations

`GET /v1/vpc/{id}/ops`

Lists the operations of a Private Cloud (creation, plan changes, tier and ACL changes, deletion), newest first. Use it to follow an `op` returned by a write call: it is finished when `state` is `done`, `failed` or `cancelled`. At most one operation is open at a time.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc ops`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpcOp | yes |  |
| `items[].id` | integer | yes | Operation identifier. |
| `items[].kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does: `create`, `change_plan` (bandwidth plan), `tier_add`, `tier_del`, `acl_sync` (apply ACL changes), `suspend` / `resume` (applied when the Private Cloud is locked for unpaid bills / unlocked) or `delete`. |
| `items[].state` | string: `queued`, `running`, `done`, `failed`, `cancelled` | yes | Progress of the operation. `queued` and `running` are open; the other states are final. |
| `items[].step` | string | yes | Short name of the step being worked on, for example `queued`, `vpc`, `tier`, `acl_rule` or `done`. Informational. |
| `items[].public_error` | string or null | yes | Reason code when the operation failed (for example `capacity`, `timeout`, `no_public_ip`, `cancelled`, `internal`); null otherwise. |
| `items[].created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `items[].finished_at` | integer or null | yes | When the operation finished; null while it is still open (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "created_at": 1792401000,
      "finished_at": 1792401012,
      "id": 45,
      "kind": "acl_sync",
      "public_error": null,
      "state": "done",
      "step": "done"
    },
    {
      "created_at": 1792400000,
      "finished_at": 1792400180,
      "id": 41,
      "kind": "create",
      "public_error": null,
      "state": "done",
      "step": "done"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page` or `per_page` is not an integer. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/ops" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Private Cloud event log

`GET /v1/vpc/{id}/events`

Returns the activity log of a Private Cloud, newest first by default: who did what and when (orders, renames, plan changes, tier and ACL changes, locks and unlocks, deletion). `actor` is `you` for changes made with your account or API keys, `admin` for support staff and `system` for automatic actions such as billing.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `kind`, `actor` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Event identifier; increases with time. |
| `items[].at` | integer | yes | When it happened (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | Short event type, e.g. `create`, `update`, `plan_change`, `tier_add`, `acl_add`, `lock`, `delete`. |
| `items[].actor` | string: `you`, `admin`, `system` | yes | Who caused the event. |
| `items[].msg` | string | yes | Human-readable description in English. |
| `items[].key` | string or null | yes | Stable message code (for example `vpc.ready`); `null` for entries written before message codes existed. With `args` it lets you show the message in your own language. |
| `items[].args` | object | yes | Raw values to fill into the message named by `key` (string values). An empty object when `key` is `null`. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "actor": "you",
      "args": {
        "action": "allow",
        "cidr": "0.0.0.0/0",
        "dir": "ingress",
        "num": "100",
        "proto": "tcp"
      },
      "at": 1792401000,
      "id": 12,
      "key": "vpc.acl_added",
      "kind": "acl_add",
      "msg": "ACL rule #100 ingress tcp 0.0.0.0/0 allow"
    },
    {
      "actor": "you",
      "args": {
        "cycle": "monthly",
        "mbps": "100",
        "name": "prod-net"
      },
      "at": 1792400000,
      "id": 3,
      "key": "vpc.ordered",
      "kind": "create",
      "msg": "Ordered Private Cloud prod-net: 100 Mbps (monthly)"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page`, `per_page`, `sort` or `dir` is not valid. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Private Cloud billing

`GET /v1/vpc/{id}/billing`

Returns what this Private Cloud costs and the wallet entries it caused: the creation charge, hourly charges or renewals, plan-change charges and refunds. `spent_month_cents` and `spent_total_cents` are net amounts (charges minus refunds) for the current calendar month and for the whole life of the Private Cloud. Each item's `amount_cents` is signed: negative when money left your wallet, positive for a refund. Newest first by default.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc billing`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `amount_cents` | no | Field to sort by. `at` orders by time. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Wallet entry identifier. |
| `items[].at` | integer | yes | When the entry was posted (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | What it was for: `new` (order), `hour` (hourly charge), `cycle` (renewal), `plan` (plan change) or `refund`. |
| `items[].amount_cents` | integer | yes | Signed amount in US cents: negative = charged, positive = refunded. |
| `items[].memo` | string or null | yes | Description of the entry. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `pricing` | object | yes |  |
| `pricing.hourly_uusd` | integer | yes | Current price per hour in millionths of a US dollar. |
| `pricing.monthly_cents` | integer | yes | The same price for a 730-hour month in US cents. |
| `pricing.mbps` | integer | yes | Plan bandwidth in Mbit/s. |
| `billing` | object | yes |  |
| `billing.cycle` | string | yes | Billing cycle slug. |
| `billing.months` | integer | yes | Months in the cycle; 0 for hourly. |
| `billing.paid_until` | integer or null | yes | End of the paid period; null for hourly billing (Unix time, seconds, UTC) |
| `billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically. |
| `billing.cycle_cents` | integer | yes | Price of one cycle in US cents; 0 for hourly. |
| `billing.billed_until` | integer or null | yes | Time up to which hourly charges have been posted; null for prepaid cycles or before the first charge (Unix time, seconds, UTC) |
| `spent_month_cents` | integer | yes | Net amount spent in the current calendar month, US cents. |
| `spent_total_cents` | integer | yes | Net amount spent since the Private Cloud was ordered, US cents. |

Example:

```json
{
  "billing": {
    "auto_renew": true,
    "billed_until": null,
    "cycle": "monthly",
    "cycle_cents": 384,
    "months": 1,
    "paid_until": 1795000000
  },
  "items": [
    {
      "amount_cents": -384,
      "at": 1792400000,
      "id": 9021,
      "kind": "new",
      "memo": "Private Cloud prod-net - 100 Mbps (Monthly)"
    }
  ],
  "page": 1,
  "per_page": 25,
  "pricing": {
    "hourly_uusd": 5257,
    "mbps": 100,
    "monthly_cents": 384
  },
  "spent_month_cents": 384,
  "spent_total_cents": 384,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `page`, `per_page`, `sort` or `dir` is not valid. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/billing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Preview before deleting

`GET /v1/vpc/{id}/delete-preview`

Shows what [Delete a Private Cloud](#operation/vpc_delete) would do, without changing anything: how many servers and tiers are inside, the public IP that would be released, the wallet refund for unused prepaid time, and whether the deletion is allowed now. `confirm` is the exact text to send as the `confirm` field.

**Required scope:** `vpc:read`.

Scope: `vpc:read` | CLI: `vpc delete-preview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm_count` | integer | yes | Servers still in the Private Cloud. Must be 0 before deleting. |
| `tier_count` | integer | yes | Tiers that would be removed. |
| `public_ip` | string or null | yes | Public IPv4 address that would be released; null if none was assigned. |
| `refund_cents` | integer | yes | Estimated wallet refund for unused prepaid time in US cents (0 for hourly billing). |
| `can_delete` | boolean | yes | `true` when deleting is allowed now: state `active` or `locked`, no servers, and not locked by support. A running operation is not considered here but blocks the delete itself with `409 vpc_busy`. |
| `locked_by_admin` | boolean | yes | `true` when support locked the Private Cloud; it can only be deleted after support unlocks it. |
| `confirm` | string | yes | The exact name to send as `confirm`. |

Example:

```json
{
  "can_delete": true,
  "confirm": "prod-net",
  "locked_by_admin": false,
  "public_ip": "203.0.113.25",
  "refund_cents": 301,
  "tier_count": 1,
  "vm_count": 0
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpc/<id>/delete-preview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a Private Cloud (prepaid cycles charge the wallet)

`POST /v1/vpc`

Orders a new Private Cloud: a private /16 network with a default tier, a virtual router with one public IP address for outbound traffic, default Network ACL rules (SSH, RDP and ICMP in, everything out) and a dedicated unmetered bandwidth plan. The call returns `202` at once with the Private Cloud in state `provisioning` and an `op`; poll [Get a Private Cloud](#operation/vpc_get) until `state` is `active` (normally a few minutes) or `failed`.

A prepaid `cycle` (e.g. `monthly`) is charged from your wallet immediately. Hourly billing (the default) starts when the Private Cloud becomes active, but the order needs a balance that covers at least `min_hours` hours of the plan price. A creation that fails is refunded in full. Each account may own `limits.max_per_account` Private Clouds (default 1; more fail with `403 vpc_limit`) and may place at most 3 orders in 24 hours (`429 rate_limited`). Check conditions and price first with [Quote a Private Cloud](#operation/vpc_quote). Fails with `403 vpc_disabled` while Private Cloud is not enabled for your account.

**Required scope:** `vpc:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpc:create` | CLI: `vpc create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Name of the Private Cloud, 3-40 characters: lowercase letters, digits and hyphens, starting with a letter and not ending with a hyphen. Leading and trailing spaces are removed and capitals are lowercased. It must be unique among your Private Clouds. |
| `plan` | string | yes | Plan `slug` from the catalog, e.g. `100m`. The numeric plan `id` is accepted too. |
| `cycle` | string | no | Billing cycle slug from the catalog. Default `hourly`. Any other cycle is prepaid and charged now. |

Example:

```json
{
  "cycle": "monthly",
  "name": "prod-net",
  "plan": "100m"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vpc` | Vpc | yes |  |
| `vpc.id` | string | yes | Private Cloud identifier (UUID). Use it in the `:id` path parameter and as the network when creating servers. |
| `vpc.name` | string | yes | Name, unique within your account. |
| `vpc.note` | string or null | no | Free-text note, up to 500 characters. Only present on the detail view (Get, Create, Update, Change plan). |
| `vpc.state` | string: `provisioning`, `active`, `locked`, `deleting`, `deleted`, `failed` | yes | `provisioning`: being created. `active`: ready. `locked`: suspended for an unpaid bill or by support - bandwidth is cut to 1 Mbps until it is unlocked (see `lock`). `deleting`: being deleted. `deleted`: gone (still listed for 30 days). `failed`: creation failed (prepaid charges were refunded). |
| `vpc.zone` | Zone or null | yes |  |
| `vpc.cidr` | string | yes | Private IPv4 range of the Private Cloud, always a /16 inside 10.128.0.0/9, e.g. `10.128.0.0/16`. |
| `vpc.public_ip` | string or null | yes | Public IPv4 address used by the virtual router for outbound traffic (source NAT); null until the Private Cloud is ready. |
| `vpc.router` | string or null | yes | State of the virtual router, for example `Running`; null until the first health check. |
| `vpc.plan` | object | yes |  |
| `vpc.plan.id` | integer | yes | Plan identifier. |
| `vpc.plan.slug` | string or null | yes | Plan slug. |
| `vpc.plan.name` | string or null | yes | Plan display name. |
| `vpc.plan.mbps` | integer | yes | Bandwidth of the plan in Mbit/s. |
| `vpc.bandwidth` | object | yes |  |
| `vpc.bandwidth.mbps` | integer | yes | Dedicated bandwidth of the current plan in Mbit/s. |
| `vpc.bandwidth.unmetered` | boolean | yes | Always `true`: traffic is not metered, there is no transfer quota or overage charge. |
| `vpc.bandwidth.label` | string | yes | Short human-readable description of the bandwidth. |
| `vpc.bandwidth.effective_mbps` | integer | yes | Bandwidth applied right now. Equals `mbps`, except `1` while the Private Cloud is locked. |
| `vpc.ipv6` | array of object | yes |  |
| `vpc.ipv6[].tier` | string | yes | Tier name. |
| `vpc.ipv6[].cidr` | string | yes | IPv6 /64 subnet of that tier. |
| `vpc.tier_count` | integer | yes | Number of tiers. |
| `vpc.vm_count` | integer | yes | Number of servers in the Private Cloud. |
| `vpc.pricing` | object | yes |  |
| `vpc.pricing.hourly_uusd` | integer | yes | Price you pay per hour in millionths of a US dollar. It is fixed when you order or change plan. |
| `vpc.pricing.monthly_cents` | integer | yes | The same price for a month of 730 hours, in US cents. |
| `vpc.billing` | object | yes |  |
| `vpc.billing.cycle` | string | yes | Billing cycle slug, `hourly` or a prepaid cycle such as `monthly`. |
| `vpc.billing.months` | integer | yes | Months in the cycle; `0` for hourly billing. |
| `vpc.billing.paid_until` | integer or null | yes | End of the period already paid; null for hourly billing (Unix time, seconds, UTC) |
| `vpc.billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically from the wallet. |
| `vpc.billing.cycle_cents` | integer | yes | Price of one cycle in US cents; `0` for hourly billing. |
| `vpc.lock` | object or null | yes |  |
| `vpc.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why it is locked: `no_funds` (hourly bill unpaid), `expired` (prepaid period ended), `admin` or `abuse` (locked by support - it cannot be deleted until support unlocks it). |
| `vpc.lock.locked_at` | integer or null | yes | When it was locked (Unix time, seconds, UTC) |
| `vpc.lock.destroy_after` | integer or null | yes | When an unpaid Private Cloud without servers will be deleted automatically; null when no automatic deletion is scheduled (Unix time, seconds, UTC) |
| `vpc.op` | VpcOp or null | yes |  |
| `vpc.can` | object | yes |  |
| `vpc.can.change_plan` | boolean | yes | The bandwidth plan can be changed now (state `active`, no operation running). |
| `vpc.can.add_tier` | boolean | yes | A tier can be added now (state `active`, no operation running; the tier limit is checked when you add). |
| `vpc.can.acl` | boolean | yes | ACL rules can be added and deleted (state `active` or `locked`). |
| `vpc.can.create_vm` | boolean | yes | Servers can be created in this Private Cloud (state `active`). |
| `vpc.can.delete` | boolean | yes | The Private Cloud can be deleted now: state `active` or `locked`, no operation running, no servers, and not locked by support. |
| `vpc.public_error` | string or null | yes | Reason code when `state` is `failed` (for example `capacity`, `timeout`, `no_public_ip`, `internal`); null otherwise. |
| `vpc.created_at` | integer | yes | When it was ordered (Unix time, seconds, UTC) |
| `vpc.ready_at` | integer or null | yes | When it became active; null before that (Unix time, seconds, UTC) |
| `vpc.updated_at` | integer | yes | Last change (Unix time, seconds, UTC) |
| `vpc.tiers` | array of VpcTier | no |  |
| `vpc.tiers[].id` | string | yes | Tier identifier. |
| `vpc.tiers[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `vpc.tiers[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `vpc.tiers[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `vpc.tiers[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `vpc.tiers[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `vpc.tiers[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `vpc.tiers[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `vpc.tiers[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `vpc.tiers[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `vpc.tiers[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `vpc.tiers[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |
| `op` | VpcOpRef | yes |  |
| `op.id` | integer | yes | Operation identifier. It also appears in List operations. |
| `op.kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does. |
| `op.state` | string: `queued` | yes | State when the call returned. Operations always start `queued`. |

Example:

```json
{
  "op": {
    "id": 41,
    "kind": "create",
    "state": "queued"
  },
  "vpc": {
    "bandwidth": {
      "effective_mbps": 100,
      "label": "Unmetered traffic · 100 Mbps dedicated",
      "mbps": 100,
      "unmetered": true
    },
    "billing": {
      "auto_renew": true,
      "cycle": "monthly",
      "cycle_cents": 384,
      "months": 1,
      "paid_until": 1795000000
    },
    "can": {
      "acl": false,
      "add_tier": false,
      "change_plan": false,
      "create_vm": false,
      "delete": false
    },
    "cidr": "10.128.0.0/16",
    "created_at": 1792400000,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": [],
    "lock": null,
    "name": "prod-net",
    "note": null,
    "op": {
      "created_at": 1792400000,
      "finished_at": null,
      "id": 41,
      "kind": "create",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "plan": {
      "id": 2,
      "mbps": 100,
      "name": "100 Mbps",
      "slug": "100m"
    },
    "pricing": {
      "hourly_uusd": 5257,
      "monthly_cents": 384
    },
    "public_error": null,
    "public_ip": null,
    "ready_at": null,
    "router": null,
    "state": "provisioning",
    "tier_count": 1,
    "tiers": [
      {
        "can_delete": false,
        "cidr": "10.128.1.0/24",
        "created_at": 1792400000,
        "gateway": "10.128.1.1",
        "id": "7b1e2c44-52d0-4f6b-8a3e-90d1c6a5e2f1",
        "index": 1,
        "ipv6_cidr": null,
        "ipv6_gateway": null,
        "is_default": true,
        "name": "default",
        "state": "provisioning",
        "vm_count": 0
      }
    ],
    "updated_at": 1792400000,
    "vm_count": 0,
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, `plan` is missing or not a string or number (the error carries `field: "plan"`), or `cycle` is not a known or enabled billing cycle (`detail`). |
| 400 | `name_invalid` | `name` does not follow the naming rules. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is below the balance the order needs. The error carries `need_cents` and `balance_cents` (US cents). |
| 403 | `vpc_disabled` | Private Cloud is not enabled on this site for your account. |
| 403 | `vpc_limit` | You already own the maximum number of Private Clouds. The error carries `max`. |
| 403 | `email_unverified` | Verify your e-mail address first. |
| 403 | `limit_reached` | The site has reached its own resource limit; contact support. |
| 409 | `name_taken` | You already have a Private Cloud with this name. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `plan_unavailable` | The plan does not exist or is not on sale. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `sales_disabled` | New orders are paused on this site. |
| 423 | `site_unavailable` | The site is not accepting orders at the moment. |
| 429 | `rate_limited` | You already placed 3 orders in the last 24 hours. The error carries `retry_after` (seconds). |
| 503 | `capacity` | The platform has no room for another Private Cloud right now. |
| 503 | `cidr_exhausted` | No network ranges are left for new Private Clouds; contact support. |
| 503 | `provider_unavailable` | The site operator cannot accept new orders at the moment. Retry later. |
| 503 | `tenant_unavailable` | Your account is not ready yet. Retry in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpc" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"monthly","name":"prod-net","plan":"100m"}'
```

---

#### Change bandwidth plan (costs money)

`POST /v1/vpc/{id}/plan`

Changes the dedicated bandwidth plan of the Private Cloud. The new bandwidth is applied to every tier in the background (the Private Cloud shows an open `change_plan` operation until it is done). On a prepaid cycle the price difference for the remaining paid period is charged from your wallet (upgrade) or refunded to it (downgrade) at once; on hourly billing the new price applies from the next billed hour. The response reports `charged_cents` and `refunded_cents`.

Preview the amounts with [Quote a plan change](#operation/vpc_plan_quote). The Private Cloud must be `active` with no other operation running, you may change plan at most 6 times in 24 hours, and the call fails with `403 vpc_disabled` while Private Cloud is not enabled for your account.

**Required scope:** `vpc:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpc:create` | CLI: `vpc plan-change` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan` | string | yes | Target plan `slug` from the catalog, e.g. `500m`. The numeric plan `id` is accepted too. It must differ from the current plan. |

Example:

```json
{
  "plan": "500m"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vpc` | Vpc | yes |  |
| `vpc.id` | string | yes | Private Cloud identifier (UUID). Use it in the `:id` path parameter and as the network when creating servers. |
| `vpc.name` | string | yes | Name, unique within your account. |
| `vpc.note` | string or null | no | Free-text note, up to 500 characters. Only present on the detail view (Get, Create, Update, Change plan). |
| `vpc.state` | string: `provisioning`, `active`, `locked`, `deleting`, `deleted`, `failed` | yes | `provisioning`: being created. `active`: ready. `locked`: suspended for an unpaid bill or by support - bandwidth is cut to 1 Mbps until it is unlocked (see `lock`). `deleting`: being deleted. `deleted`: gone (still listed for 30 days). `failed`: creation failed (prepaid charges were refunded). |
| `vpc.zone` | Zone or null | yes |  |
| `vpc.cidr` | string | yes | Private IPv4 range of the Private Cloud, always a /16 inside 10.128.0.0/9, e.g. `10.128.0.0/16`. |
| `vpc.public_ip` | string or null | yes | Public IPv4 address used by the virtual router for outbound traffic (source NAT); null until the Private Cloud is ready. |
| `vpc.router` | string or null | yes | State of the virtual router, for example `Running`; null until the first health check. |
| `vpc.plan` | object | yes |  |
| `vpc.plan.id` | integer | yes | Plan identifier. |
| `vpc.plan.slug` | string or null | yes | Plan slug. |
| `vpc.plan.name` | string or null | yes | Plan display name. |
| `vpc.plan.mbps` | integer | yes | Bandwidth of the plan in Mbit/s. |
| `vpc.bandwidth` | object | yes |  |
| `vpc.bandwidth.mbps` | integer | yes | Dedicated bandwidth of the current plan in Mbit/s. |
| `vpc.bandwidth.unmetered` | boolean | yes | Always `true`: traffic is not metered, there is no transfer quota or overage charge. |
| `vpc.bandwidth.label` | string | yes | Short human-readable description of the bandwidth. |
| `vpc.bandwidth.effective_mbps` | integer | yes | Bandwidth applied right now. Equals `mbps`, except `1` while the Private Cloud is locked. |
| `vpc.ipv6` | array of object | yes |  |
| `vpc.ipv6[].tier` | string | yes | Tier name. |
| `vpc.ipv6[].cidr` | string | yes | IPv6 /64 subnet of that tier. |
| `vpc.tier_count` | integer | yes | Number of tiers. |
| `vpc.vm_count` | integer | yes | Number of servers in the Private Cloud. |
| `vpc.pricing` | object | yes |  |
| `vpc.pricing.hourly_uusd` | integer | yes | Price you pay per hour in millionths of a US dollar. It is fixed when you order or change plan. |
| `vpc.pricing.monthly_cents` | integer | yes | The same price for a month of 730 hours, in US cents. |
| `vpc.billing` | object | yes |  |
| `vpc.billing.cycle` | string | yes | Billing cycle slug, `hourly` or a prepaid cycle such as `monthly`. |
| `vpc.billing.months` | integer | yes | Months in the cycle; `0` for hourly billing. |
| `vpc.billing.paid_until` | integer or null | yes | End of the period already paid; null for hourly billing (Unix time, seconds, UTC) |
| `vpc.billing.auto_renew` | boolean | yes | Whether a prepaid cycle renews automatically from the wallet. |
| `vpc.billing.cycle_cents` | integer | yes | Price of one cycle in US cents; `0` for hourly billing. |
| `vpc.lock` | object or null | yes |  |
| `vpc.lock.reason` | string or null: `no_funds`, `expired`, `admin`, `abuse` | yes | Why it is locked: `no_funds` (hourly bill unpaid), `expired` (prepaid period ended), `admin` or `abuse` (locked by support - it cannot be deleted until support unlocks it). |
| `vpc.lock.locked_at` | integer or null | yes | When it was locked (Unix time, seconds, UTC) |
| `vpc.lock.destroy_after` | integer or null | yes | When an unpaid Private Cloud without servers will be deleted automatically; null when no automatic deletion is scheduled (Unix time, seconds, UTC) |
| `vpc.op` | VpcOp or null | yes |  |
| `vpc.can` | object | yes |  |
| `vpc.can.change_plan` | boolean | yes | The bandwidth plan can be changed now (state `active`, no operation running). |
| `vpc.can.add_tier` | boolean | yes | A tier can be added now (state `active`, no operation running; the tier limit is checked when you add). |
| `vpc.can.acl` | boolean | yes | ACL rules can be added and deleted (state `active` or `locked`). |
| `vpc.can.create_vm` | boolean | yes | Servers can be created in this Private Cloud (state `active`). |
| `vpc.can.delete` | boolean | yes | The Private Cloud can be deleted now: state `active` or `locked`, no operation running, no servers, and not locked by support. |
| `vpc.public_error` | string or null | yes | Reason code when `state` is `failed` (for example `capacity`, `timeout`, `no_public_ip`, `internal`); null otherwise. |
| `vpc.created_at` | integer | yes | When it was ordered (Unix time, seconds, UTC) |
| `vpc.ready_at` | integer or null | yes | When it became active; null before that (Unix time, seconds, UTC) |
| `vpc.updated_at` | integer | yes | Last change (Unix time, seconds, UTC) |
| `vpc.tiers` | array of VpcTier | no |  |
| `vpc.tiers[].id` | string | yes | Tier identifier. |
| `vpc.tiers[].name` | string | yes | Tier name, 2-32 characters of lowercase letters, digits and hyphens. |
| `vpc.tiers[].index` | integer | yes | Position of the tier in the Private Cloud, 1-254. The tier subnet is the `/24` of the same number inside the Private Cloud range; the default tier has index 1. |
| `vpc.tiers[].cidr` | string | yes | IPv4 subnet of the tier, e.g. `10.128.2.0/24`. |
| `vpc.tiers[].gateway` | string | yes | IPv4 gateway address of the tier (the `.1` address of the subnet). |
| `vpc.tiers[].is_default` | boolean | yes | True for the tier created with the Private Cloud. It cannot be deleted. |
| `vpc.tiers[].ipv6_cidr` | string or null | yes | IPv6 `/64` subnet of the tier; null until the tier is ready. |
| `vpc.tiers[].ipv6_gateway` | string or null | yes | IPv6 gateway address of the tier; null until the tier is ready. |
| `vpc.tiers[].state` | string: `provisioning`, `active`, `deleting` | yes | `provisioning` while the tier is being created, `active` when servers can use it, `deleting` while it is removed. |
| `vpc.tiers[].vm_count` | integer | yes | Number of servers currently in the tier. |
| `vpc.tiers[].created_at` | integer | yes | When the tier was requested (Unix time, seconds, UTC) |
| `vpc.tiers[].can_delete` | boolean | yes | True when the tier can be deleted now: it is active, not the default tier and has no servers. |
| `op` | VpcOpRef | yes |  |
| `op.id` | integer | yes | Operation identifier. It also appears in List operations. |
| `op.kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does. |
| `op.state` | string: `queued` | yes | State when the call returned. Operations always start `queued`. |
| `charged_cents` | integer | yes | Amount charged from the wallet now, in US cents (0 when nothing is due or for hourly billing). |
| `refunded_cents` | integer | yes | Amount refunded to the wallet now, in US cents. |

Example:

```json
{
  "charged_cents": 1920,
  "op": {
    "id": 52,
    "kind": "change_plan",
    "state": "queued"
  },
  "refunded_cents": 0,
  "vpc": {
    "bandwidth": {
      "effective_mbps": 500,
      "label": "Unmetered traffic · 500 Mbps dedicated",
      "mbps": 500,
      "unmetered": true
    },
    "billing": {
      "auto_renew": true,
      "cycle": "monthly",
      "cycle_cents": 2302,
      "months": 1,
      "paid_until": 1795000000
    },
    "can": {
      "acl": true,
      "add_tier": false,
      "change_plan": false,
      "create_vm": true,
      "delete": false
    },
    "cidr": "10.128.0.0/16",
    "created_at": 1792400000,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "ipv6": [
      {
        "cidr": "2001:db8:10:1::/64",
        "tier": "default"
      }
    ],
    "lock": null,
    "name": "prod-net",
    "note": "Production network",
    "op": {
      "created_at": 1792410000,
      "finished_at": null,
      "id": 52,
      "kind": "change_plan",
      "public_error": null,
      "state": "queued",
      "step": "queued"
    },
    "plan": {
      "id": 3,
      "mbps": 500,
      "name": "500 Mbps",
      "slug": "500m"
    },
    "pricing": {
      "hourly_uusd": 31539,
      "monthly_cents": 2302
    },
    "public_error": null,
    "public_ip": "203.0.113.25",
    "ready_at": 1792400180,
    "router": "Running",
    "state": "active",
    "tier_count": 1,
    "tiers": [
      {
        "can_delete": false,
        "cidr": "10.128.1.0/24",
        "created_at": 1792400000,
        "gateway": "10.128.1.1",
        "id": "7b1e2c44-52d0-4f6b-8a3e-90d1c6a5e2f1",
        "index": 1,
        "ipv6_cidr": "2001:db8:10:1::/64",
        "ipv6_gateway": "2001:db8:10:1::1",
        "is_default": true,
        "name": "default",
        "state": "active",
        "vm_count": 2
      }
    ],
    "updated_at": 1792410000,
    "vm_count": 2,
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, `plan` is missing (the error carries `field: "plan"`), or the billing cycle of the Private Cloud can no longer be priced (`detail`). |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is below `need_cents` of the plan quote. The error carries `need_cents` and `balance_cents` (US cents). |
| 403 | `vpc_disabled` | Private Cloud is not enabled on this site for your account. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vpc_busy` | Another operation is running, or the Private Cloud is not `active`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `plan_unavailable` | The plan does not exist or is not on sale. |
| 422 | `bad_input` | `plan` is the plan the Private Cloud already has (`detail: "same plan"`). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vpc_locked` | The Private Cloud is locked; settle the bill or contact support first. |
| 429 | `rate_limited` | You already changed the plan 6 times in the last 24 hours. The error carries `retry_after` (seconds). |
| 503 | `provider_unavailable` | The site operator cannot accept the change at the moment. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpc/<id>/plan" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"plan":"500m"}'
```

---

#### Delete the Private Cloud (no VMs left)

`DELETE /v1/vpc/{id}`

Deletes a Private Cloud with its tiers and ACL rules, and releases its public IP address. Every server in it must be deleted first (`409 vpc_has_vms`), and you confirm by sending the exact name of the Private Cloud. The call returns `202` and the Private Cloud moves to `deleting`, then `deleted`.

Unused time of a prepaid period is refunded to your wallet when the deletion finishes; `refund_cents_estimate` is the amount calculated now (always 0 for hourly billing). Use [Preview before deleting](#operation/vpc_delete_preview) to see what will be removed. A Private Cloud locked by support (`lock.reason` of `admin` or `abuse`) cannot be deleted.

**Required scope:** `vpc:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpc:destroy` | CLI: `vpc delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Private Cloud identifier as returned by List Private Clouds. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | string | yes | The exact name of the Private Cloud, as a safeguard against deleting the wrong one. |

Example:

```json
{
  "confirm": "prod-net"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `deleted` | boolean | yes | Always `true`: the deletion was accepted and is in progress. |
| `refund_cents_estimate` | integer | yes | Wallet refund for the unused prepaid time, in US cents, calculated at the time of the request. The final amount is credited when the deletion completes. |
| `op` | VpcOpRef | yes |  |
| `op.id` | integer | yes | Operation identifier. It also appears in List operations. |
| `op.kind` | string: `create`, `change_plan`, `tier_add`, `tier_del`, `acl_sync`, `suspend`, `resume`, `delete` | yes | What the operation does. |
| `op.state` | string: `queued` | yes | State when the call returned. Operations always start `queued`. |

Example:

```json
{
  "deleted": true,
  "op": {
    "id": 58,
    "kind": "delete",
    "state": "queued"
  },
  "refund_cents_estimate": 301
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vpc_busy` | Another operation is running, or the Private Cloud is not `active` or `locked`. |
| 409 | `vpc_has_vms` | Servers are still in the Private Cloud. Delete them first. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `bad_input` | `confirm` is missing or is not the name of the Private Cloud (the error carries `field: "confirm"`). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vpc_locked` | Support locked the Private Cloud. It can be deleted after support unlocks it. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vpc/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"prod-net"}'
```

---

### Bandwidth

Monthly traffic quota of your services and the Add-ons that raise it. Every server, container cluster, object-storage account and VPN plan has a quota per billing period; unmetered services (for example servers inside a Private Cloud network) have none. Reading is free. Buying an Add-on adds terabytes to the current billing period of one service, charges your wallet and requires an `Idempotency-Key`. In this section 1 TB means 2^40 bytes and 1 GB means 2^30 bytes.

#### Bandwidth totals across services

`GET /v1/bandwidth/summary`

Returns the traffic totals of all your services for their current billing periods, together with the Add-on price and the policy applied when a service runs out of quota. Use it for a dashboard header; call List bandwidth objects for the breakdown per service. `limit_bytes` only adds up services that have a limit, while unmetered or unlimited services still contribute to `used_bytes`. The call is free and always reflects the current period of each service.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth summary`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `totals` | BandwidthTotals | yes |  |
| `totals.used_bytes` | integer | yes | Bytes counted against limits, summed over all services. |
| `totals.limit_bytes` | integer | yes | Sum of the limits (quota plus Add-ons) of the services that have a limit. |
| `totals.addon_bytes` | integer | yes | Part of the limits that comes from Add-ons bought for the current periods. |
| `totals.remaining_bytes` | integer | yes | `limit_bytes` minus `used_bytes`, never below 0. |
| `totals.over` | integer | yes | Number of services that used 100% or more of their limit. |
| `totals.warn` | integer | yes | Number of services between 80% and 100% of their limit. |
| `totals.counts` | object | yes | Number of services per kind, for example `{"vm": 3, "s3": 1}`. Kinds you do not use are absent. |
| `totals.objects` | integer | yes | Total number of services. |
| `price` | BandwidthPrice | yes |  |
| `price.tb_cents` | integer | no | Price of one terabyte of Add-on in US cents on this site. Absent when no price can be quoted right now (see `error`). |
| `price.error` | string: `fx_unavailable`, `price_unavailable` | no | Present instead of `tb_cents` when the price cannot be computed at the moment; Add-ons cannot be bought until it clears. |
| `price.max_tb` | integer | yes | Largest number of terabytes a single purchase may add. |
| `policy` | string: `notify`, `throttle`, `suspend` | yes | What the site does to a service that has used its whole quota. With `suspend`, servers and clusters are locked (and object-storage access is paused) until you buy an Add-on or the next period starts; with any other value the service keeps running and you are only notified at 80% and 100% of the quota. |
| `count_mode` | string: `both`, `out` | yes | Which direction counts for servers and clusters: `both` counts inbound plus outbound traffic, `out` counts outbound traffic only. |
| `now` | integer | yes | Time of the response (Unix time, seconds, UTC) |

Example:

```json
{
  "count_mode": "both",
  "now": 1792000000,
  "policy": "suspend",
  "price": {
    "max_tb": 50,
    "tb_cents": 384
  },
  "totals": {
    "addon_bytes": 1099511627776,
    "counts": {
      "s3": 1,
      "vm": 1
    },
    "limit_bytes": 3405909065728,
    "objects": 2,
    "over": 0,
    "remaining_bytes": 2972117368832,
    "used_bytes": 433791696896,
    "warn": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/summary" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth per service (paged, sortable)

`GET /v1/bandwidth/objects`

Lists every service of your account that has a bandwidth quota (servers, container clusters, your object storage and VPN plans) with its usage in the current billing period. The list is filtered, sorted and paged on the server. `totals` always covers all your services, whatever the filters, so it can be shown next to a filtered list. Use the `kind` and `ref` of an item to call the per-service endpoints.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string: `vm`, `k8s`, `s3`, `vpn` | no | Return only services of this kind. Unknown values are ignored. |
| `q` | string | no | Case-insensitive text to look for in the service name, its secondary label (for example the public IP address) and its `ref`. |
| `sort` | string: `used`, `pct`, `remaining`, `name`, `reset`, `kind` | no | Sort key: `used` bytes used, `pct` percentage of the limit used (services without a limit sort last), `remaining` bytes left (services without a limit sort first), `name`, `reset` end of the current period, `kind`. Unknown values behave like `used`. |
| `order` | string: `asc`, `desc` | no | Sort direction. Defaults to `desc`, except `asc` for `sort=name` and `sort=reset`. `dir` is accepted as an alias. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BandwidthObject | yes |  |
| `items[].kind` | string: `vm`, `k8s`, `s3`, `vpn` | yes | Kind of service: `vm` server, `k8s` container cluster, `s3` object storage (one entry per account), `vpn` VPN plan. |
| `items[].ref` | string | yes | Identifier of the service within its kind. Use it as `ref` in the other bandwidth calls. |
| `items[].name` | string | yes | Display name of the service. |
| `items[].sub` | string | yes | Short secondary label: the public IP address of a server or cluster, a one-line summary for the other kinds. May be empty. |
| `items[].state` | string | yes | State of the service, for example `active` or `locked` (a locked service cannot be used until the lock is lifted). |
| `items[].account_id` | integer | yes | Identifier of the account that owns the service (always your own account). |
| `items[].period` | object | yes | Current billing period of the service. |
| `items[].period.start` | integer | yes | Start of the current billing period (Unix time, seconds, UTC) |
| `items[].period.end` | integer | yes | End of the current billing period (exclusive); the quota resets at this moment (Unix time, seconds, UTC) |
| `items[].period.kind` | string: `anchored_month`, `calendar_month`, `vpn_cycle` | yes | How the period is defined: `anchored_month` is a month counted from the creation of the server or cluster, `calendar_month` is a calendar month in UTC+7 (object storage), `vpn_cycle` follows the billing cycle of the VPN plan. |
| `items[].quota_bytes` | integer or null | yes | Included quota for the period in bytes, or null when the service has no limit. For servers it is reduced in proportion to the time the server spent unmetered; for clusters it grows with the number of workers. |
| `items[].addon_bytes` | integer | yes | Bytes added by Add-ons bought for the current period. |
| `items[].addon_tb` | integer | yes | Terabytes added by Add-ons bought for the current period. |
| `items[].limit_bytes` | integer or null | yes | `quota_bytes` plus `addon_bytes`, or null when the service has no limit. |
| `items[].used_bytes` | integer | yes | Bytes counted against the limit in the current period (see `count`). For `s3` this is the part of your downloads covered by the free quota; downloads beyond it are billed pay-as-you-go and only show in `total`. |
| `items[].remaining_bytes` | integer or null | yes | `limit_bytes` minus `used_bytes`, or null when there is no limit. Negative when the limit is exceeded. |
| `items[].pct` | number or null | yes | Percentage of the limit used, rounded to one decimal, or null when there is no limit. Can exceed 100. |
| `items[].total` | object | yes | Raw traffic of the current period, including traffic that is not counted against the limit (for example traffic while the service was unmetered). |
| `items[].total.in` | integer | yes | Bytes received by the service in the period, counted or not. |
| `items[].total.out` | integer | yes | Bytes sent by the service in the period, counted or not. For `s3` this is the total download. |
| `items[].total.total` | integer | yes | `in` plus `out`. |
| `items[].unmetered` | object or null | yes | Set while the service is inside an unmetered network; no quota applies then and no Add-on can be bought. |
| `items[].unmetered.label` | string | yes | Name of the unmetered network the service currently sits in. |
| `items[].unmetered.mbps` | integer | yes | Committed speed of that network in Mbps. |
| `items[].metered_frac` | number | yes | Share of the period (0 to 1) during which the service was metered. Below 1 when it spent part of the period unmetered. |
| `items[].workers_avg` | number or null | yes | Container clusters only: average number of worker nodes over the period, weighted by time. Null for the other kinds. |
| `items[].can_buy` | boolean | yes | Whether an Add-on can be bought for this service right now. When false, `buy_block` tells why. |
| `items[].buy_block` | string or null: `vpn_use_upgrade`, `unmetered`, `not_active` | yes | Why no Add-on can be bought: `vpn_use_upgrade` VPN plans raise their bandwidth from the plan itself, `unmetered` the service has no limit, `not_active` the service is not in a state that allows purchases. Null when `can_buy` is true. |
| `items[].count` | string: `edge`, `download`, `rx_tx` | yes | How usage is measured: `edge` traffic crossing the network edge of the server or cluster, `download` object-storage downloads, `rx_tx` bytes received plus sent by the VPN plan. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `totals` | BandwidthTotals | yes |  |
| `totals.used_bytes` | integer | yes | Bytes counted against limits, summed over all services. |
| `totals.limit_bytes` | integer | yes | Sum of the limits (quota plus Add-ons) of the services that have a limit. |
| `totals.addon_bytes` | integer | yes | Part of the limits that comes from Add-ons bought for the current periods. |
| `totals.remaining_bytes` | integer | yes | `limit_bytes` minus `used_bytes`, never below 0. |
| `totals.over` | integer | yes | Number of services that used 100% or more of their limit. |
| `totals.warn` | integer | yes | Number of services between 80% and 100% of their limit. |
| `totals.counts` | object | yes | Number of services per kind, for example `{"vm": 3, "s3": 1}`. Kinds you do not use are absent. |
| `totals.objects` | integer | yes | Total number of services. |

Example:

```json
{
  "items": [
    {
      "account_id": 1042,
      "addon_bytes": 1099511627776,
      "addon_tb": 1,
      "buy_block": null,
      "can_buy": true,
      "count": "edge",
      "kind": "vm",
      "limit_bytes": 3298534883328,
      "metered_frac": 1.0,
      "name": "web-1",
      "pct": 12.5,
      "period": {
        "end": 1792972800,
        "kind": "anchored_month",
        "start": 1790380800
      },
      "quota_bytes": 2199023255552,
      "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "remaining_bytes": 2886218022912,
      "state": "active",
      "sub": "203.0.113.10",
      "total": {
        "in": 96636764160,
        "out": 315680096256,
        "total": 412316860416
      },
      "unmetered": null,
      "used_bytes": 412316860416,
      "workers_avg": null
    },
    {
      "account_id": 1042,
      "addon_bytes": 0,
      "addon_tb": 0,
      "buy_block": null,
      "can_buy": true,
      "count": "download",
      "kind": "s3",
      "limit_bytes": 107374182400,
      "metered_frac": 1.0,
      "name": "Object Storage",
      "pct": 20.0,
      "period": {
        "end": 1793466000,
        "kind": "calendar_month",
        "start": 1790787600
      },
      "quota_bytes": 107374182400,
      "ref": "1042",
      "remaining_bytes": 85899345920,
      "state": "active",
      "sub": "1 S3 account(s)",
      "total": {
        "in": 5368709120,
        "out": 21474836480,
        "total": 26843545600
      },
      "unmetered": null,
      "used_bytes": 21474836480,
      "workers_avg": null
    }
  ],
  "page": 1,
  "per_page": 20,
  "total": 2,
  "totals": {
    "addon_bytes": 1099511627776,
    "counts": {
      "s3": 1,
      "vm": 1
    },
    "limit_bytes": 3405909065728,
    "objects": 2,
    "over": 0,
    "remaining_bytes": 2972117368832,
    "used_bytes": 433791696896,
    "warn": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/objects" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth of one service

`GET /v1/bandwidth/objects/{kind}/{ref}`

Returns the bandwidth of one service: quota, Add-ons of the current period, usage, the Add-on price and the policy that applies when the quota is used up. Pass `series` to get the traffic chart data in the same call instead of calling Get the traffic series. `kind` and `ref` come from List bandwidth objects. A service that does not exist, is not active or belongs to another account answers 404.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string | yes | Kind of service the bandwidth belongs to: `vm` (server), `k8s` (container cluster), `s3` (object storage) or `vpn` (VPN plan). Taken from the `kind` field of List bandwidth objects. |
| `ref` | string | yes | Identifier of the service within its kind: the server UUID for `vm`, the cluster UUID for `k8s`, a numeric identifier for `s3` (one per account) and the plan number for `vpn`. Taken from the `ref` field of List bandwidth objects. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `series` | string: `24h`, `7d`, `30d`, `period` | no | Also return the traffic series for this range in the `series` field. `24h` gives hourly points, the others daily points. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `kind` | string: `vm`, `k8s`, `s3`, `vpn` | yes | Kind of service: `vm` server, `k8s` container cluster, `s3` object storage (one entry per account), `vpn` VPN plan. |
| `ref` | string | yes | Identifier of the service within its kind. Use it as `ref` in the other bandwidth calls. |
| `name` | string | yes | Display name of the service. |
| `sub` | string | yes | Short secondary label: the public IP address of a server or cluster, a one-line summary for the other kinds. May be empty. |
| `state` | string | yes | State of the service, for example `active` or `locked` (a locked service cannot be used until the lock is lifted). |
| `account_id` | integer | yes | Identifier of the account that owns the service (always your own account). |
| `period` | object | yes | Current billing period of the service. |
| `period.start` | integer | yes | Start of the current billing period (Unix time, seconds, UTC) |
| `period.end` | integer | yes | End of the current billing period (exclusive); the quota resets at this moment (Unix time, seconds, UTC) |
| `period.kind` | string: `anchored_month`, `calendar_month`, `vpn_cycle` | yes | How the period is defined: `anchored_month` is a month counted from the creation of the server or cluster, `calendar_month` is a calendar month in UTC+7 (object storage), `vpn_cycle` follows the billing cycle of the VPN plan. |
| `quota_bytes` | integer or null | yes | Included quota for the period in bytes, or null when the service has no limit. For servers it is reduced in proportion to the time the server spent unmetered; for clusters it grows with the number of workers. |
| `addon_bytes` | integer | yes | Bytes added by Add-ons bought for the current period. |
| `addon_tb` | integer | yes | Terabytes added by Add-ons bought for the current period. |
| `limit_bytes` | integer or null | yes | `quota_bytes` plus `addon_bytes`, or null when the service has no limit. |
| `used_bytes` | integer | yes | Bytes counted against the limit in the current period (see `count`). For `s3` this is the part of your downloads covered by the free quota; downloads beyond it are billed pay-as-you-go and only show in `total`. |
| `remaining_bytes` | integer or null | yes | `limit_bytes` minus `used_bytes`, or null when there is no limit. Negative when the limit is exceeded. |
| `pct` | number or null | yes | Percentage of the limit used, rounded to one decimal, or null when there is no limit. Can exceed 100. |
| `total` | object | yes | Raw traffic of the current period, including traffic that is not counted against the limit (for example traffic while the service was unmetered). |
| `total.in` | integer | yes | Bytes received by the service in the period, counted or not. |
| `total.out` | integer | yes | Bytes sent by the service in the period, counted or not. For `s3` this is the total download. |
| `total.total` | integer | yes | `in` plus `out`. |
| `unmetered` | object or null | yes | Set while the service is inside an unmetered network; no quota applies then and no Add-on can be bought. |
| `unmetered.label` | string | yes | Name of the unmetered network the service currently sits in. |
| `unmetered.mbps` | integer | yes | Committed speed of that network in Mbps. |
| `metered_frac` | number | yes | Share of the period (0 to 1) during which the service was metered. Below 1 when it spent part of the period unmetered. |
| `workers_avg` | number or null | yes | Container clusters only: average number of worker nodes over the period, weighted by time. Null for the other kinds. |
| `can_buy` | boolean | yes | Whether an Add-on can be bought for this service right now. When false, `buy_block` tells why. |
| `buy_block` | string or null: `vpn_use_upgrade`, `unmetered`, `not_active` | yes | Why no Add-on can be bought: `vpn_use_upgrade` VPN plans raise their bandwidth from the plan itself, `unmetered` the service has no limit, `not_active` the service is not in a state that allows purchases. Null when `can_buy` is true. |
| `count` | string: `edge`, `download`, `rx_tx` | yes | How usage is measured: `edge` traffic crossing the network edge of the server or cluster, `download` object-storage downloads, `rx_tx` bytes received plus sent by the VPN plan. |
| `addons` | array of BandwidthAddon | yes | Add-ons bought for the current period of this service, newest first (at most 50). |
| `addons[].id` | integer | yes | Add-on identifier. |
| `addons[].kind` | string: `vm`, `k8s`, `s3`, `vpn` | yes | Kind of the service the Add-on belongs to. |
| `addons[].ref` | string | yes | Identifier of the service within its kind. |
| `addons[].account_id` | integer | yes | Account that bought the Add-on (your own account). |
| `addons[].period_start` | integer | yes | Start of the billing period the Add-on is valid for (Unix time, seconds, UTC) |
| `addons[].period_end` | integer | yes | End of the billing period the Add-on is valid for (exclusive). The Add-on expires then; the next period starts with the base quota again (Unix time, seconds, UTC) |
| `addons[].tb` | integer | yes | Terabytes added (1 TB = 2^40 bytes). |
| `addons[].amount_cents` | integer | yes | Amount charged in US cents. 0 for Add-ons granted free of charge by support. |
| `addons[].status` | string: `pending`, `active`, `granted`, `failed` | yes | `active` bought and in force; `granted` given free of charge by support and in force; `pending` and `failed` belong to an interrupted purchase and add no quota. |
| `addons[].invoice_id` | integer or null | yes | Receipt invoice of the purchase, null when there is none. |
| `addons[].created_at` | integer | yes | When the Add-on was bought (Unix time, seconds, UTC) |
| `price` | BandwidthPrice | yes |  |
| `price.tb_cents` | integer | no | Price of one terabyte of Add-on in US cents on this site. Absent when no price can be quoted right now (see `error`). |
| `price.error` | string: `fx_unavailable`, `price_unavailable` | no | Present instead of `tb_cents` when the price cannot be computed at the moment; Add-ons cannot be bought until it clears. |
| `price.max_tb` | integer | yes | Largest number of terabytes a single purchase may add. |
| `policy` | string: `notify`, `throttle`, `suspend` | yes | What the site does to a service that has used its whole quota. With `suspend`, servers and clusters are locked (and object-storage access is paused) until you buy an Add-on or the next period starts; with any other value the service keeps running and you are only notified at 80% and 100% of the quota. |
| `suspend_active` | boolean | yes | Whether the `suspend` policy is being enforced right now. It can be false for a while after the policy is switched on, during which usage is only notified. |
| `count_mode` | string: `both`, `out` | yes | Which direction counts for servers and clusters: `both` counts inbound plus outbound traffic, `out` counts outbound traffic only. |
| `series` | BandwidthSeries | no |  |
| `series.range` | string | yes | The range that was requested: `24h`, `7d`, `30d` or `period`. |
| `series.bucket` | integer | yes | Length of each point in seconds: 3600 for `24h`, 86400 (one day) for the other ranges. |
| `series.from` | integer | yes | Start of the covered window, rounded down to the hour (Unix time, seconds, UTC) |
| `series.to` | integer | yes | End of the covered window (the time of the request) (Unix time, seconds, UTC) |
| `series.points` | array of object | yes | Traffic per bucket in time order. Buckets without traffic are omitted. Always empty for `vpn`. |
| `series.points[].t` | integer | yes | Start of the bucket. Daily buckets start at midnight UTC+7 (Unix time, seconds, UTC) |
| `series.points[].in` | integer | yes | Bytes received during the bucket. For `s3` this is the upload. |
| `series.points[].out` | integer | yes | Bytes sent during the bucket. For `s3` this is the download. |
| `series.points[].total` | integer | yes | `in` plus `out`. |

Example:

```json
{
  "account_id": 1042,
  "addon_bytes": 1099511627776,
  "addon_tb": 1,
  "addons": [
    {
      "account_id": 1042,
      "amount_cents": 384,
      "created_at": 1791500000,
      "id": 17,
      "invoice_id": 9021,
      "kind": "vm",
      "period_end": 1792972800,
      "period_start": 1790380800,
      "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "status": "active",
      "tb": 1
    }
  ],
  "buy_block": null,
  "can_buy": true,
  "count": "edge",
  "count_mode": "both",
  "kind": "vm",
  "limit_bytes": 3298534883328,
  "metered_frac": 1.0,
  "name": "web-1",
  "pct": 12.5,
  "period": {
    "end": 1792972800,
    "kind": "anchored_month",
    "start": 1790380800
  },
  "policy": "suspend",
  "price": {
    "max_tb": 50,
    "tb_cents": 384
  },
  "quota_bytes": 2199023255552,
  "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "remaining_bytes": 2886218022912,
  "series": {
    "bucket": 86400,
    "from": 1791392400,
    "points": [
      {
        "in": 6442450944,
        "out": 21474836480,
        "t": 1791392400,
        "total": 27917287424
      },
      {
        "in": 8589934592,
        "out": 32212254720,
        "t": 1791478800,
        "total": 40802189312
      },
      {
        "in": 5368709120,
        "out": 18253611008,
        "t": 1791565200,
        "total": 23622320128
      }
    ],
    "range": "7d",
    "to": 1792000000
  },
  "state": "active",
  "sub": "203.0.113.10",
  "suspend_active": true,
  "total": {
    "in": 96636764160,
    "out": 315680096256,
    "total": 412316860416
  },
  "unmetered": null,
  "used_bytes": 412316860416,
  "workers_avg": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | `kind` is not one of `vm`, `k8s`, `s3`, `vpn`, or the service does not exist, is not active or belongs to another account. |
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/objects/<kind>/<ref>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Hourly/daily traffic of one service

`GET /v1/bandwidth/objects/{kind}/{ref}/series`

Returns the traffic of one service over time, ready for a chart. `24h` gives hourly points for the last 24 hours; `7d` and `30d` give daily points (days start at midnight UTC+7); `period` (the default) gives daily points from the start of the current billing period. Server and cluster traffic is measured at the network edge, object storage reports uploads (`in`) and downloads (`out`), and VPN plans have no series (`points` is empty). Buckets without traffic are not returned.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth series`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string | yes | Kind of service the bandwidth belongs to: `vm` (server), `k8s` (container cluster), `s3` (object storage) or `vpn` (VPN plan). Taken from the `kind` field of List bandwidth objects. |
| `ref` | string | yes | Identifier of the service within its kind: the server UUID for `vm`, the cluster UUID for `k8s`, a numeric identifier for `s3` (one per account) and the plan number for `vpn`. Taken from the `ref` field of List bandwidth objects. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `24h`, `7d`, `30d`, `period` | no | Window to return. Unrecognised values behave like `period`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `range` | string | yes | The range that was requested: `24h`, `7d`, `30d` or `period`. |
| `bucket` | integer | yes | Length of each point in seconds: 3600 for `24h`, 86400 (one day) for the other ranges. |
| `from` | integer | yes | Start of the covered window, rounded down to the hour (Unix time, seconds, UTC) |
| `to` | integer | yes | End of the covered window (the time of the request) (Unix time, seconds, UTC) |
| `points` | array of object | yes | Traffic per bucket in time order. Buckets without traffic are omitted. Always empty for `vpn`. |
| `points[].t` | integer | yes | Start of the bucket. Daily buckets start at midnight UTC+7 (Unix time, seconds, UTC) |
| `points[].in` | integer | yes | Bytes received during the bucket. For `s3` this is the upload. |
| `points[].out` | integer | yes | Bytes sent during the bucket. For `s3` this is the download. |
| `points[].total` | integer | yes | `in` plus `out`. |

Example:

```json
{
  "bucket": 86400,
  "from": 1791392400,
  "points": [
    {
      "in": 6442450944,
      "out": 21474836480,
      "t": 1791392400,
      "total": 27917287424
    },
    {
      "in": 8589934592,
      "out": 32212254720,
      "t": 1791478800,
      "total": 40802189312
    },
    {
      "in": 5368709120,
      "out": 18253611008,
      "t": 1791565200,
      "total": 23622320128
    }
  ],
  "range": "7d",
  "to": 1792000000
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | `kind` is not one of `vm`, `k8s`, `s3`, `vpn`, or the service does not exist, is not active or belongs to another account. |
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/objects/<kind>/<ref>/series" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a Bandwidth Add-on

`GET /v1/bandwidth/objects/{kind}/{ref}/quote`

Prices an Add-on of `tb` terabytes for one service without buying anything. The Add-on is valid for the current billing period only (`period_end`) and the price is flat per terabyte. Take `amount_cents` from the response and send it as `expect_cents` when you buy, so a price change between the two calls cannot surprise you. Quotes are refused for services that cannot buy Add-ons: VPN plans, unmetered services and services that are not active.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth quote`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string | yes | Kind of service the bandwidth belongs to: `vm` (server), `k8s` (container cluster), `s3` (object storage) or `vpn` (VPN plan). Taken from the `kind` field of List bandwidth objects. |
| `ref` | string | yes | Identifier of the service within its kind: the server UUID for `vm`, the cluster UUID for `k8s`, a numeric identifier for `s3` (one per account) and the plan number for `vpn`. Taken from the `ref` field of List bandwidth objects. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `tb` | integer | no | Number of terabytes to price, from 1 up to the site maximum (`price.max_tb`). Defaults to 1; a value that is not an integer is replaced by 1. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `tb` | integer | yes | Terabytes priced. |
| `amount_cents` | integer | yes | Total price of the purchase in US cents. Pass it as `expect_cents` when buying. |
| `unit_cents` | integer | yes | Price of one terabyte in US cents. |
| `amount_vnd` | integer | yes | Informational equivalent of `amount_cents` in Vietnamese dong at the current exchange rate. You are always charged in US cents. |
| `period_start` | integer | yes | Start of the billing period the Add-on would be valid for (Unix time, seconds, UTC) |
| `period_end` | integer | yes | End of that billing period (exclusive) (Unix time, seconds, UTC) |
| `limit_after_bytes` | integer | yes | The limit of the service after the purchase, in bytes. |
| `remaining_after_bytes` | integer | yes | Bytes left after the purchase (`limit_after_bytes` minus current usage). Can still be negative if usage is far above the limit. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "amount_cents": 768,
  "amount_vnd": 199680,
  "balance_cents": 2500,
  "limit_after_bytes": 4398046511104,
  "period_end": 1792972800,
  "period_start": 1790380800,
  "remaining_after_bytes": 3985729650688,
  "tb": 2,
  "unit_cents": 384
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | `kind` is not one of `vm`, `k8s`, `s3`, `vpn`, or the service does not exist, is not active or belongs to another account. |
| 422 | `bw_bad_tb` | `tb` is below 1 or above the site maximum (`price.max_tb`). |
| 422 | `bw_addon_not_supported` | VPN plans cannot buy Add-ons; raise their bandwidth from the VPN plan itself. |
| 422 | `bw_unmetered` | The service is unmetered, so there is no quota to extend. |
| 422 | `bw_not_active` | The service is not in a state that allows Add-ons (for example it is still being created, or it is locked for a reason other than its quota). |
| 422 | `fx_unavailable` | The price cannot be computed right now. Retry later. |
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/objects/<kind>/<ref>/quote" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Buy a Bandwidth Add-on (charges the wallet)

`POST /v1/bandwidth/objects/{kind}/{ref}/addons`

Buys an Add-on of `tb` terabytes for one service and charges your wallet immediately. The Add-on raises the limit of the current billing period only and expires at `period_end`; it is not refunded and does not carry over. Send `expect_cents` from Quote an Add-on: if the price or the billing period changed since, nothing is charged and the call fails with 409 `bw_price_changed`. A server or cluster that was locked because it used up its quota is unlocked automatically after the purchase. The `Idempotency-Key` for this call must be 8 to 80 characters of letters, digits, `-`, `_` and `:`; repeating a purchase with the same key and body returns the original Add-on (status 200, `replay` true) without charging again, while the same key with a different body fails with 409 `idempotency_key_reused`. Servers whose billing is still handled by another provider cannot buy Add-ons here (409). At most 10 purchases per minute are accepted.

**Required scope:** `bandwidth:buy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `bandwidth:buy` | CLI: `bandwidth buy` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string | yes | Kind of service the bandwidth belongs to: `vm` (server), `k8s` (container cluster), `s3` (object storage) or `vpn` (VPN plan). Taken from the `kind` field of List bandwidth objects. |
| `ref` | string | yes | Identifier of the service within its kind: the server UUID for `vm`, the cluster UUID for `k8s`, a numeric identifier for `s3` (one per account) and the plan number for `vpn`. Taken from the `ref` field of List bandwidth objects. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `tb` | integer | yes | Number of terabytes to add (1 TB = 2^40 bytes). An integer from 1 up to the site maximum (`price.max_tb` in Get bandwidth of a service, 50 by default). |
| `expect_cents` | integer | yes | The total price you expect to pay in US cents, taken from `amount_cents` of Quote an Add-on. Required: without it, or if it differs from the current price, the purchase is refused with 409 `bw_price_changed`. |

Example:

```json
{
  "expect_cents": 768,
  "tb": 2
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `addon` | BandwidthAddon | yes |  |
| `addon.id` | integer | yes | Add-on identifier. |
| `addon.kind` | string: `vm`, `k8s`, `s3`, `vpn` | yes | Kind of the service the Add-on belongs to. |
| `addon.ref` | string | yes | Identifier of the service within its kind. |
| `addon.account_id` | integer | yes | Account that bought the Add-on (your own account). |
| `addon.period_start` | integer | yes | Start of the billing period the Add-on is valid for (Unix time, seconds, UTC) |
| `addon.period_end` | integer | yes | End of the billing period the Add-on is valid for (exclusive). The Add-on expires then; the next period starts with the base quota again (Unix time, seconds, UTC) |
| `addon.tb` | integer | yes | Terabytes added (1 TB = 2^40 bytes). |
| `addon.amount_cents` | integer | yes | Amount charged in US cents. 0 for Add-ons granted free of charge by support. |
| `addon.status` | string: `pending`, `active`, `granted`, `failed` | yes | `active` bought and in force; `granted` given free of charge by support and in force; `pending` and `failed` belong to an interrupted purchase and add no quota. |
| `addon.invoice_id` | integer or null | yes | Receipt invoice of the purchase, null when there is none. |
| `addon.created_at` | integer | yes | When the Add-on was bought (Unix time, seconds, UTC) |
| `bandwidth` | BandwidthObject or null | no |  |
| `balance_cents` | integer | yes | Your wallet balance in US cents after the purchase. |
| `replay` | boolean | no | True when this is the answer to a repeated request (the response status is then 200 and `bandwidth` is absent). |

Example:

```json
{
  "addon": {
    "account_id": 1042,
    "amount_cents": 768,
    "created_at": 1791500000,
    "id": 18,
    "invoice_id": 9021,
    "kind": "vm",
    "period_end": 1792972800,
    "period_start": 1790380800,
    "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "status": "active",
    "tb": 2
  },
  "balance_cents": 1732,
  "bandwidth": {
    "account_id": 1042,
    "addon_bytes": 2199023255552,
    "addon_tb": 2,
    "buy_block": null,
    "can_buy": true,
    "count": "edge",
    "kind": "vm",
    "limit_bytes": 4398046511104,
    "metered_frac": 1.0,
    "name": "web-1",
    "pct": 9.4,
    "period": {
      "end": 1792972800,
      "kind": "anchored_month",
      "start": 1790380800
    },
    "quota_bytes": 2199023255552,
    "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "remaining_bytes": 3985729650688,
    "state": "active",
    "sub": "203.0.113.10",
    "total": {
      "in": 96636764160,
      "out": 315680096256,
      "total": 412316860416
    },
    "unmetered": null,
    "used_bytes": 412316860416,
    "workers_avg": null
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_invalid` | The `Idempotency-Key` is not 8 to 80 characters of letters, digits, `-`, `_` and `:`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Your wallet balance is lower than the price. The error also carries `need_cents` and `balance_cents`; top up and retry. |
| 404 | `not_found` | `kind` is not one of `vm`, `k8s`, `s3`, `vpn`, or the service does not exist, is not active or belongs to another account. |
| 409 | `bw_price_changed` | The price changed, or the service moved to a new billing period or changed state, since your quote. The error carries the current `amount_cents`; quote again and retry. |
| 409 | `idempotency_key_reused` | This `Idempotency-Key` was already used with a different `tb` or `expect_cents`. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `bw_bad_tb` | `tb` is not an integer between 1 and the site maximum. |
| 422 | `bw_addon_not_supported` | VPN plans cannot buy Add-ons; raise their bandwidth from the VPN plan itself. |
| 422 | `bw_unmetered` | The service is unmetered, so there is no quota to extend. |
| 422 | `bw_not_active` | The service is not in a state that allows Add-ons (for example it is still being created, or it is locked for a reason other than its quota). |
| 422 | `fx_unavailable` | The price cannot be computed right now. Retry later. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `site_unavailable` | The site is temporarily not accepting new purchases. |
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |
| 503 | `provider_unavailable` | The provider of this site cannot accept new purchases right now. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/bandwidth/objects/<kind>/<ref>/addons" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"expect_cents":768,"tb":2}'
```

---

#### Bandwidth Add-on purchase history

`GET /v1/bandwidth/addons`

Lists the Add-ons you bought or were granted, for all services and all periods, newest first. Each entry shows the service it belongs to, the period it was valid for, the terabytes added and the amount charged. It is a purchase history: to see what is in force now, read `addons` in Get bandwidth of a service.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `bandwidth addons`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BandwidthAddon | yes |  |
| `items[].id` | integer | yes | Add-on identifier. |
| `items[].kind` | string: `vm`, `k8s`, `s3`, `vpn` | yes | Kind of the service the Add-on belongs to. |
| `items[].ref` | string | yes | Identifier of the service within its kind. |
| `items[].account_id` | integer | yes | Account that bought the Add-on (your own account). |
| `items[].period_start` | integer | yes | Start of the billing period the Add-on is valid for (Unix time, seconds, UTC) |
| `items[].period_end` | integer | yes | End of the billing period the Add-on is valid for (exclusive). The Add-on expires then; the next period starts with the base quota again (Unix time, seconds, UTC) |
| `items[].tb` | integer | yes | Terabytes added (1 TB = 2^40 bytes). |
| `items[].amount_cents` | integer | yes | Amount charged in US cents. 0 for Add-ons granted free of charge by support. |
| `items[].status` | string: `pending`, `active`, `granted`, `failed` | yes | `active` bought and in force; `granted` given free of charge by support and in force; `pending` and `failed` belong to an interrupted purchase and add no quota. |
| `items[].invoice_id` | integer or null | yes | Receipt invoice of the purchase, null when there is none. |
| `items[].created_at` | integer | yes | When the Add-on was bought (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "account_id": 1042,
      "amount_cents": 768,
      "created_at": 1791500000,
      "id": 18,
      "invoice_id": 9021,
      "kind": "vm",
      "period_end": 1792972800,
      "period_start": 1790380800,
      "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "status": "active",
      "tb": 2
    },
    {
      "account_id": 1042,
      "amount_cents": 384,
      "created_at": 1791500000,
      "id": 17,
      "invoice_id": 9021,
      "kind": "vm",
      "period_end": 1792972800,
      "period_start": 1790380800,
      "ref": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "status": "active",
      "tb": 1
    }
  ],
  "page": 1,
  "per_page": 20,
  "total": 2
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Bandwidth reporting and Add-ons are switched off on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/bandwidth/addons" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Images

Operating system images and ISO images of your account. Import an image from a URL, create one from a stopped server, rename it, delete it, or attach and detach an ISO. A template image that is `Ready` can be used as the operating system when you create a server. Stored images are billed per GB-hour from the moment they are ready. Image management can be switched off on a site; every call in this section then fails with 501 `feature_disabled`.

#### Public OS images on sale

`GET /v1/images/public`

Lists the operating system images that the site provides to everybody, with the regions where each one is available. They are the same images as `templates` in the VM catalog, in a lighter form meant for pickers shown next to your own images. Your private images are not included; see List images. The list is not paged: `total` is the number of entries returned.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `image public`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of ImagePublicOs | yes |  |
| `items[].id` | integer | yes | Operating system image identifier. Pass it as `template_id` when creating a server. |
| `items[].name` | string | yes | Display name, for example `Ubuntu 24.04 LTS`. |
| `items[].os_family` | string | yes | `linux`, `windows`, `bsd` ... |
| `items[].os_version` | string or null | yes | Version label, when known. |
| `items[].username` | string | yes | Default administrator account name of the image. |
| `items[].size_gb` | integer or null | yes | Minimum system disk the image needs, in GB, when known. |
| `items[].zones` | array of Zone | yes | Regions where the image is available. |
| `items[].zones[].id` | integer | yes | Region identifier. Pass it as `zone_id` when creating resources. |
| `items[].zones[].slug` | string | yes | Short name, e.g. `hcm-1`. |
| `items[].zones[].name` | string | yes | Display name. |
| `items[].zones[].name_en` | string or null | no | English display name. |
| `items[].zones[].country` | string | no | ISO country code. |
| `items[].zones[].city` | string or null | no | City. |
| `total` | integer | yes | Number of entries in `items`. |

Example:

```json
{
  "items": [
    {
      "id": 11,
      "name": "Ubuntu 24.04 LTS",
      "os_family": "linux",
      "os_version": "24.04",
      "size_gb": 10,
      "username": "ubuntu",
      "zones": [
        {
          "city": "Ho Chi Minh City",
          "country": "VN",
          "id": 1,
          "name": "Ho Chi Minh City",
          "name_en": "Ho Chi Minh City",
          "slug": "hcm-1"
        }
      ]
    }
  ],
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl "https://api.onie.net/v1/images/public" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### OS types

`GET /v1/images/os-types`

Lists the operating system types you can choose when importing an image. Pass the `id` of one entry as `os_type_id` to Import an image; it selects the virtual hardware profile used for the image, so pick the closest match to the guest system. The list is sorted by name and cached for up to an hour. If it cannot be fetched right now the call fails with 502 and can be retried.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `image os-types`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string | yes | Identifier to pass as `os_type_id`. |
| `items[].name` | string | yes | Name of the operating system type, for example `Other Linux (64-bit)`. |

Example:

```json
{
  "items": [
    {
      "id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
      "name": "Other Linux (64-bit)"
    },
    {
      "id": "5a3f7c80-bf73-11f0-8c3a-00163eb1d097",
      "name": "Windows Server 2022"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |
| 502 | `cloudstack_error` | The list of operating system types could not be fetched from the platform right now. Retry later. |

**Example request**

```bash
curl "https://api.onie.net/v1/images/os-types" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Image storage price per GB

`GET /v1/images/quote`

Prices the storage of an image of a given size without creating anything. Images are billed hourly from the moment they are `Ready`: the size is rounded up to whole GB (1 GB = 2^30 bytes) and multiplied by the hourly rate. Rates are given in millionths of a US dollar so that small amounts stay exact; `cents_per_hour` and `cents_per_month` are the same prices rounded to whole cents for display. ISO images and templates are priced the same way.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `image quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `size_gb` | integer | no | Size to price in GB, from 1 to 1024. Defaults to 1; values outside the range are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `size_gb` | integer | yes | Size priced, in whole GB. |
| `rate_uusd_gb_hour` | integer | yes | Hourly storage rate in millionths of a US dollar per GB. |
| `uusd_per_hour` | integer | yes | Hourly cost for `size_gb` in millionths of a US dollar. |
| `cents_per_hour` | integer | yes | Hourly cost in US cents, rounded to the nearest cent (often 0 for small images). |
| `cents_per_month` | integer | yes | Monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `hours_per_month` | integer | yes | Hours per month used for the monthly figure (730 by default). |

Example:

```json
{
  "cents_per_hour": 0,
  "cents_per_month": 25,
  "hours_per_month": 730,
  "rate_uusd_gb_hour": 17,
  "size_gb": 20,
  "uusd_per_hour": 340
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl "https://api.onie.net/v1/images/quote" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List your images and ISOs (paged, sortable)

`GET /v1/images`

Lists the OS images and ISO images stored in your account, newest first by default. A new image moves from `Queued` through `Downloading` (or `Creating` when made from a server) to `Ready`; `Error` means it failed and `error_code` tells why, and `Deleting` is shown while removal is in progress. Besides the page of items the response returns your limits and the unit price, so one call is enough to show usage bars and cost estimates. Note that the pagination fields are inside `meta`, not at the top level.

**Required scope:** `image:read`.

Scope: `image:read` | CLI: `image list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `name`, `size_bytes`, `state`, `kind`, `paid_cents` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `kind` | string: `template`, `iso` | no | Return only images of this kind. Other values are ignored. |
| `state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | no | Return only images in this state. Other values are ignored. |
| `q` | string | no | Text to look for in the image name (case-insensitive substring, first 64 characters used). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Image | yes |  |
| `items[].id` | integer | yes | Image identifier. Use it as `iid` in the other image calls. |
| `items[].kind` | string: `template`, `iso` | yes | `template` is a bootable operating system disk used to create servers; `iso` is an installation or rescue disc that can be attached to a server. |
| `items[].source` | string: `url`, `vm` | yes | How the image was made: imported from a `url`, or created from one of your servers (`vm`). |
| `items[].name` | string | yes | Name you gave the image. |
| `items[].description` | string or null | yes | Free-text description, or null. |
| `items[].zone_id` | integer | yes | Region where the image is stored. Servers can only use images of their own region. |
| `items[].template_id` | integer or null | yes | Templates only: identifier to pass as `template_id` when creating a server from this image. Null until the image is `Ready`, and always null for ISOs. |
| `items[].url` | string or null | yes | Download URL the image was imported from, as normalised by the server. Null for images created from a server. |
| `items[].format` | string or null | yes | Disk format: `QCOW2` for templates, `ISO` for ISO images. |
| `items[].os_type_id` | string or null | yes | Operating system type chosen at import (an `id` from List OS types). |
| `items[].os_type_name` | string or null | yes | Name of that operating system type. |
| `items[].bootable` | boolean | yes | ISO only: whether the ISO can be booted. Always true for templates. |
| `items[].password_enabled` | boolean | yes | Templates only: whether servers created from this image support password reset. False for ISOs. |
| `items[].checksum` | string or null | yes | Checksum you supplied, normalised to the form `{SHA-256}` followed by the lowercase hex digest. Null when none was given. |
| `items[].src_vm_id` | string or null | yes | For images created from a server: UUID of that server. Otherwise null. |
| `items[].username` | string or null | yes | For images created from a server: the login user name servers created from the image start with. Otherwise null. |
| `items[].state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | yes | Processing state. `Queued` waiting to start, `Downloading` being fetched from the URL, `Creating` being copied from a server, `Ready` usable and billed, `Error` failed (see `error_code`), `Deleting` being removed. |
| `items[].busy` | boolean | yes | True while `state` is `Queued`, `Downloading`, `Creating` or `Deleting`. A busy image cannot be deleted or changed in storage. |
| `items[].progress` | integer | yes | Download or copy progress in percent, 0 to 100. |
| `items[].size_bytes` | integer | yes | Real size on storage in bytes, known once the image is `Ready`; 0 before that. |
| `items[].virtual_size_bytes` | integer | yes | Size of the virtual disk in bytes, known once the image is `Ready`; 0 before that. |
| `items[].declared_bytes` | integer | yes | Size announced by the source before the transfer (the file size from the URL, or the disk size of the source server); 0 when unknown. |
| `items[].size_gb` | integer | yes | Billed size: `size_bytes` rounded up to whole GB (1 GB = 2^30 bytes); 0 until the image is `Ready`. |
| `items[].rate_uusd_gb_hour` | integer | yes | Hourly storage rate locked in for this image, in millionths of a US dollar per GB. It can only go down over time. |
| `items[].uusd_per_hour` | integer | yes | Current hourly cost of the image in millionths of a US dollar (`size_gb` times the rate). |
| `items[].cents_per_month` | integer | yes | Estimated monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `items[].hours_per_month` | integer | yes | Hours per month used for the monthly estimate (730 by default). |
| `items[].paid_cents` | integer | yes | Total amount charged for storing this image so far, in US cents. |
| `items[].debt_since` | integer or null | yes | Set while your wallet could not cover the storage charge: since when the image has been unpaid. Images unpaid for long enough are deleted automatically (Unix time, seconds, UTC) |
| `items[].locked` | boolean | yes | True when support has locked the image. A locked image is not billed and cannot be attached. |
| `items[].locked_at` | integer or null | yes | When the image was locked (Unix time, seconds, UTC) |
| `items[].lock_reason` | string or null | yes | Reason given for the lock. |
| `items[].last_error` | string or null | yes | Human-readable explanation of the failure when `state` is `Error`; null otherwise. |
| `items[].error_code` | string or null | yes | Machine-readable failure reason when `state` is `Error`, for example `invalid_url`, `blocked_url`, `url_redirect`, `url_unreachable`, `too_large`, `invalid_image`, `checksum_mismatch` or `download_failed`; other values may appear. Null when there is no error. |
| `items[].created_at` | integer | yes | When the image was created (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | When the image last changed (Unix time, seconds, UTC) |
| `items[].ready_at` | integer or null | yes | When the image became `Ready`; null before that (Unix time, seconds, UTC) |
| `items[].vm_count` | integer | no | Templates only: number of your servers that currently use this image. Absent for ISOs and for images that are not `Ready` yet. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Number of images matching the filters, across all pages. |
| `meta.page` | integer | yes | Current page number (1-based). |
| `meta.per_page` | integer | yes | Page size applied (clamped to 100). |
| `meta.last_page` | integer | yes | Number of the last page (0 when there are no matches). |
| `meta.sort` | string: `created_at`, `name`, `size_bytes`, `state`, `kind`, `paid_cents` | yes | Sort key applied. |
| `meta.dir` | string: `asc`, `desc` | yes | Sort direction applied. |
| `limits` | ImageLimits | yes |  |
| `limits.count` | integer | yes | Number of images you have now. |
| `limits.gb` | integer | yes | Storage counted against your limit, in whole GB. Images that are still downloading count with their announced size, or with the maximum size when it is unknown. |
| `limits.max_count` | integer | yes | Maximum number of images per account. |
| `limits.max_gb` | integer | yes | Maximum total storage per account, in GB. |
| `limits.iso_max_gb` | integer | yes | Maximum size of one ISO image, in GB. |
| `limits.template_max_gb` | integer | yes | Maximum size of one template image, in GB. |
| `price` | ImagePrice | yes |  |
| `price.size_gb` | integer | yes | Size priced, in whole GB. |
| `price.rate_uusd_gb_hour` | integer | yes | Hourly storage rate in millionths of a US dollar per GB. |
| `price.uusd_per_hour` | integer | yes | Hourly cost for `size_gb` in millionths of a US dollar. |
| `price.cents_per_hour` | integer | yes | Hourly cost in US cents, rounded to the nearest cent (often 0 for small images). |
| `price.cents_per_month` | integer | yes | Monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `price.hours_per_month` | integer | yes | Hours per month used for the monthly figure (730 by default). |

Example:

```json
{
  "items": [
    {
      "bootable": true,
      "busy": false,
      "cents_per_month": 4,
      "checksum": "{SHA-256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "created_at": 1791800000,
      "debt_since": null,
      "declared_bytes": 2362232832,
      "description": "Hardened base image",
      "error_code": null,
      "format": "QCOW2",
      "hours_per_month": 730,
      "id": 12,
      "kind": "template",
      "last_error": null,
      "lock_reason": null,
      "locked": false,
      "locked_at": null,
      "name": "Ubuntu 24.04 golden",
      "os_type_id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
      "os_type_name": "Other Linux (64-bit)",
      "paid_cents": 2,
      "password_enabled": true,
      "progress": 100,
      "rate_uusd_gb_hour": 17,
      "ready_at": 1791800900,
      "size_bytes": 2362232832,
      "size_gb": 3,
      "source": "url",
      "src_vm_id": null,
      "state": "Ready",
      "template_id": 57,
      "updated_at": 1791800900,
      "url": "https://images.example.com/ubuntu-24.04.qcow2",
      "username": null,
      "uusd_per_hour": 51,
      "virtual_size_bytes": 10737418240,
      "vm_count": 1,
      "zone_id": 1
    }
  ],
  "limits": {
    "count": 1,
    "gb": 3,
    "iso_max_gb": 10,
    "max_count": 10,
    "max_gb": 200,
    "template_max_gb": 50
  },
  "meta": {
    "dir": "desc",
    "last_page": 1,
    "page": 1,
    "per_page": 20,
    "sort": "created_at",
    "total": 1
  },
  "price": {
    "cents_per_hour": 0,
    "cents_per_month": 1,
    "hours_per_month": 730,
    "rate_uusd_gb_hour": 17,
    "size_gb": 1,
    "uusd_per_hour": 17
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl "https://api.onie.net/v1/images" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one image

`GET /v1/images/{iid}`

Returns one image with its state, progress, size, cost, region, the number of servers using it and, for images made from a server, the name of the source server. Use it to follow an image after Import an image or Create an image from a server: poll until `state` is `Ready` or `Error`. An image that does not exist or belongs to another account answers 404.

**Required scope:** `image:read`.

Scope: `image:read` | CLI: `image get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `iid` | string | yes | Numeric image identifier, as returned in the `id` field of List images. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Image identifier. Use it as `iid` in the other image calls. |
| `kind` | string: `template`, `iso` | yes | `template` is a bootable operating system disk used to create servers; `iso` is an installation or rescue disc that can be attached to a server. |
| `source` | string: `url`, `vm` | yes | How the image was made: imported from a `url`, or created from one of your servers (`vm`). |
| `name` | string | yes | Name you gave the image. |
| `description` | string or null | yes | Free-text description, or null. |
| `zone_id` | integer | yes | Region where the image is stored. Servers can only use images of their own region. |
| `template_id` | integer or null | yes | Templates only: identifier to pass as `template_id` when creating a server from this image. Null until the image is `Ready`, and always null for ISOs. |
| `url` | string or null | yes | Download URL the image was imported from, as normalised by the server. Null for images created from a server. |
| `format` | string or null | yes | Disk format: `QCOW2` for templates, `ISO` for ISO images. |
| `os_type_id` | string or null | yes | Operating system type chosen at import (an `id` from List OS types). |
| `os_type_name` | string or null | yes | Name of that operating system type. |
| `bootable` | boolean | yes | ISO only: whether the ISO can be booted. Always true for templates. |
| `password_enabled` | boolean | yes | Templates only: whether servers created from this image support password reset. False for ISOs. |
| `checksum` | string or null | yes | Checksum you supplied, normalised to the form `{SHA-256}` followed by the lowercase hex digest. Null when none was given. |
| `src_vm_id` | string or null | yes | For images created from a server: UUID of that server. Otherwise null. |
| `username` | string or null | yes | For images created from a server: the login user name servers created from the image start with. Otherwise null. |
| `state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | yes | Processing state. `Queued` waiting to start, `Downloading` being fetched from the URL, `Creating` being copied from a server, `Ready` usable and billed, `Error` failed (see `error_code`), `Deleting` being removed. |
| `busy` | boolean | yes | True while `state` is `Queued`, `Downloading`, `Creating` or `Deleting`. A busy image cannot be deleted or changed in storage. |
| `progress` | integer | yes | Download or copy progress in percent, 0 to 100. |
| `size_bytes` | integer | yes | Real size on storage in bytes, known once the image is `Ready`; 0 before that. |
| `virtual_size_bytes` | integer | yes | Size of the virtual disk in bytes, known once the image is `Ready`; 0 before that. |
| `declared_bytes` | integer | yes | Size announced by the source before the transfer (the file size from the URL, or the disk size of the source server); 0 when unknown. |
| `size_gb` | integer | yes | Billed size: `size_bytes` rounded up to whole GB (1 GB = 2^30 bytes); 0 until the image is `Ready`. |
| `rate_uusd_gb_hour` | integer | yes | Hourly storage rate locked in for this image, in millionths of a US dollar per GB. It can only go down over time. |
| `uusd_per_hour` | integer | yes | Current hourly cost of the image in millionths of a US dollar (`size_gb` times the rate). |
| `cents_per_month` | integer | yes | Estimated monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `hours_per_month` | integer | yes | Hours per month used for the monthly estimate (730 by default). |
| `paid_cents` | integer | yes | Total amount charged for storing this image so far, in US cents. |
| `debt_since` | integer or null | yes | Set while your wallet could not cover the storage charge: since when the image has been unpaid. Images unpaid for long enough are deleted automatically (Unix time, seconds, UTC) |
| `locked` | boolean | yes | True when support has locked the image. A locked image is not billed and cannot be attached. |
| `locked_at` | integer or null | yes | When the image was locked (Unix time, seconds, UTC) |
| `lock_reason` | string or null | yes | Reason given for the lock. |
| `last_error` | string or null | yes | Human-readable explanation of the failure when `state` is `Error`; null otherwise. |
| `error_code` | string or null | yes | Machine-readable failure reason when `state` is `Error`, for example `invalid_url`, `blocked_url`, `url_redirect`, `url_unreachable`, `too_large`, `invalid_image`, `checksum_mismatch` or `download_failed`; other values may appear. Null when there is no error. |
| `created_at` | integer | yes | When the image was created (Unix time, seconds, UTC) |
| `updated_at` | integer | yes | When the image last changed (Unix time, seconds, UTC) |
| `ready_at` | integer or null | yes | When the image became `Ready`; null before that (Unix time, seconds, UTC) |
| `vm_count` | integer | yes | Number of your servers that currently use this image (0 for ISOs and for images that are not ready). |
| `zone` | Zone or null | yes |  |
| `src_vm_name` | string or null | no | For images created from a server: the current name of that server, or null if it no longer exists. |

Example:

```json
{
  "bootable": true,
  "busy": false,
  "cents_per_month": 4,
  "checksum": "{SHA-256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "created_at": 1791800000,
  "debt_since": null,
  "declared_bytes": 2362232832,
  "description": "Hardened base image",
  "error_code": null,
  "format": "QCOW2",
  "hours_per_month": 730,
  "id": 12,
  "kind": "template",
  "last_error": null,
  "lock_reason": null,
  "locked": false,
  "locked_at": null,
  "name": "Ubuntu 24.04 golden",
  "os_type_id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
  "os_type_name": "Other Linux (64-bit)",
  "paid_cents": 2,
  "password_enabled": true,
  "progress": 100,
  "rate_uusd_gb_hour": 17,
  "ready_at": 1791800900,
  "size_bytes": 2362232832,
  "size_gb": 3,
  "source": "url",
  "src_vm_id": null,
  "state": "Ready",
  "template_id": 57,
  "updated_at": 1791800900,
  "url": "https://images.example.com/ubuntu-24.04.qcow2",
  "username": null,
  "uusd_per_hour": 51,
  "virtual_size_bytes": 10737418240,
  "vm_count": 1,
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "slug": "hcm-1"
  },
  "zone_id": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl "https://api.onie.net/v1/images/<iid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### ISO attached to the VM + attachable ISOs

`GET /v1/vm/{id}/iso`

Shows which ISO is attached to a server and which of your ISO images can be attached to it. `attached` is the ISO currently inserted, or null when there is none; its `image_id` is null when that ISO is not one of yours (for example a system ISO attached by support). `images` lists your `Ready`, unlocked ISO images that are in the same region as the server. If the current attachment cannot be read right now, `live` is false and `attached` is null while `images` is still returned.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm iso get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `vm_id` | string | yes | The server UUID. |
| `attached` | object or null | yes | The ISO currently attached to the server. |
| `attached.image_id` | integer or null | yes | Identifier of the attached image when it is one of yours, otherwise null. |
| `attached.name` | string or null | yes | Name of the attached ISO. |
| `live` | boolean | yes | False when the attachment could not be read right now; `attached` is then null even if an ISO is attached. |
| `images` | array of object | yes | ISO images that can be attached to this server. |
| `images[].id` | integer | yes | Image identifier; pass it as `iid` to Attach an ISO. |
| `images[].name` | string | yes | Name of the ISO. |
| `images[].size_gb` | integer | yes | Billed size in whole GB. |
| `images[].os_type_name` | string or null | yes | Operating system type chosen at import. |
| `images[].cents_per_month` | integer | yes | Estimated monthly storage cost in US cents. |
| `cs_state` | string or null | yes | Last known power state of the server, for example `Running` or `Stopped`. |

Example:

```json
{
  "attached": {
    "image_id": 14,
    "name": "Rescue ISO"
  },
  "cs_state": "Running",
  "images": [
    {
      "cents_per_month": 1,
      "id": 14,
      "name": "Rescue ISO",
      "os_type_name": "Other Linux (64-bit)",
      "size_gb": 1
    }
  ],
  "live": true,
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`iso`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/iso" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Import an image/ISO from URL (storage billed hourly)

`POST /v1/images`

Imports an operating system image (a QCOW2 disk) or an ISO from a public URL into your account. The call returns 202 at once with the image in state `Queued` and a `job_id`; the file is then downloaded and checked in the background. Poll Get an image until `state` is `Ready` or `Error` (see `error_code`). Nothing is charged while the file downloads; storage billing per GB-hour starts when the image is `Ready`. You need a positive wallet balance to start an import.

The URL must be a direct download link: `http` or `https`, port 80 or 443, no credentials or fragment, at most 2048 ASCII characters, a full domain name or a public IP address, and a path ending in `.iso` for ISOs or `.qcow2` / `.img` for templates. Compressed files are rejected. The server resolves and checks the address before anything is fetched: private, internal and provider addresses fail with `blocked_url`, redirects are never followed (`url_redirect`, use the final link), and the first bytes of the file must be a QCOW2 header or an ISO 9660 / UDF descriptor (`invalid_image`).

Size limits are set per site (by default 50 GB for templates and 10 GB for ISOs; see `limits` in List images): a larger file fails with `too_large`, and when the source does not announce its size the maximum is reserved against your limits until the real size is known. An account can have at most 2 images downloading or being created at a time. Repeating the call with the same `Idempotency-Key` (8 to 80 characters of letters, digits, `-`, `_` and `:`) returns the original image with status 200 and `idempotent_replay` true instead of importing it twice.

**Required scope:** `image:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `image:write` | CLI: `image import` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `kind` | string: `template`, `iso` | yes | `template` imports a QCOW2 disk that servers can be created from; `iso` imports an installation or rescue disc. |
| `name` | string | yes | Name of the image: 1 to 64 characters. Letters, digits, spaces and `-`, `_`, `.`, `(`, `)` are kept; any other character is silently dropped. |
| `url` | string | yes | Direct download link of the file (see the rules above). |
| `os_type_id` | string | yes | Operating system type, an `id` from List OS types. |
| `description` | string | no | Optional description, up to 500 characters. |
| `format` | string: `QCOW2` | no | Templates only: disk format. `QCOW2` is the only accepted value and the default; ignored for ISOs. |
| `zone_id` | integer | no | Region to store the image in. Defaults to the default region of the site. |
| `checksum` | string | no | Optional hex digest (MD5, SHA-1, SHA-256, SHA-384 or SHA-512, detected from its length) of the file, optionally prefixed with the algorithm as `sha256:<hex>`. The download fails with `checksum_mismatch` if it differs. |
| `bootable` | boolean | no | ISO only: whether the ISO can be booted. Defaults to true; always true for templates. |
| `password_enabled` | boolean | no | Templates only: whether servers created from the image support password reset. Defaults to true; false for ISOs. |

Example:

```json
{
  "checksum": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "description": "Hardened base image",
  "kind": "template",
  "name": "Ubuntu 24.04 golden",
  "os_type_id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
  "url": "https://images.example.com/ubuntu-24.04.qcow2"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `image` | Image | yes |  |
| `image.id` | integer | yes | Image identifier. Use it as `iid` in the other image calls. |
| `image.kind` | string: `template`, `iso` | yes | `template` is a bootable operating system disk used to create servers; `iso` is an installation or rescue disc that can be attached to a server. |
| `image.source` | string: `url`, `vm` | yes | How the image was made: imported from a `url`, or created from one of your servers (`vm`). |
| `image.name` | string | yes | Name you gave the image. |
| `image.description` | string or null | yes | Free-text description, or null. |
| `image.zone_id` | integer | yes | Region where the image is stored. Servers can only use images of their own region. |
| `image.template_id` | integer or null | yes | Templates only: identifier to pass as `template_id` when creating a server from this image. Null until the image is `Ready`, and always null for ISOs. |
| `image.url` | string or null | yes | Download URL the image was imported from, as normalised by the server. Null for images created from a server. |
| `image.format` | string or null | yes | Disk format: `QCOW2` for templates, `ISO` for ISO images. |
| `image.os_type_id` | string or null | yes | Operating system type chosen at import (an `id` from List OS types). |
| `image.os_type_name` | string or null | yes | Name of that operating system type. |
| `image.bootable` | boolean | yes | ISO only: whether the ISO can be booted. Always true for templates. |
| `image.password_enabled` | boolean | yes | Templates only: whether servers created from this image support password reset. False for ISOs. |
| `image.checksum` | string or null | yes | Checksum you supplied, normalised to the form `{SHA-256}` followed by the lowercase hex digest. Null when none was given. |
| `image.src_vm_id` | string or null | yes | For images created from a server: UUID of that server. Otherwise null. |
| `image.username` | string or null | yes | For images created from a server: the login user name servers created from the image start with. Otherwise null. |
| `image.state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | yes | Processing state. `Queued` waiting to start, `Downloading` being fetched from the URL, `Creating` being copied from a server, `Ready` usable and billed, `Error` failed (see `error_code`), `Deleting` being removed. |
| `image.busy` | boolean | yes | True while `state` is `Queued`, `Downloading`, `Creating` or `Deleting`. A busy image cannot be deleted or changed in storage. |
| `image.progress` | integer | yes | Download or copy progress in percent, 0 to 100. |
| `image.size_bytes` | integer | yes | Real size on storage in bytes, known once the image is `Ready`; 0 before that. |
| `image.virtual_size_bytes` | integer | yes | Size of the virtual disk in bytes, known once the image is `Ready`; 0 before that. |
| `image.declared_bytes` | integer | yes | Size announced by the source before the transfer (the file size from the URL, or the disk size of the source server); 0 when unknown. |
| `image.size_gb` | integer | yes | Billed size: `size_bytes` rounded up to whole GB (1 GB = 2^30 bytes); 0 until the image is `Ready`. |
| `image.rate_uusd_gb_hour` | integer | yes | Hourly storage rate locked in for this image, in millionths of a US dollar per GB. It can only go down over time. |
| `image.uusd_per_hour` | integer | yes | Current hourly cost of the image in millionths of a US dollar (`size_gb` times the rate). |
| `image.cents_per_month` | integer | yes | Estimated monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `image.hours_per_month` | integer | yes | Hours per month used for the monthly estimate (730 by default). |
| `image.paid_cents` | integer | yes | Total amount charged for storing this image so far, in US cents. |
| `image.debt_since` | integer or null | yes | Set while your wallet could not cover the storage charge: since when the image has been unpaid. Images unpaid for long enough are deleted automatically (Unix time, seconds, UTC) |
| `image.locked` | boolean | yes | True when support has locked the image. A locked image is not billed and cannot be attached. |
| `image.locked_at` | integer or null | yes | When the image was locked (Unix time, seconds, UTC) |
| `image.lock_reason` | string or null | yes | Reason given for the lock. |
| `image.last_error` | string or null | yes | Human-readable explanation of the failure when `state` is `Error`; null otherwise. |
| `image.error_code` | string or null | yes | Machine-readable failure reason when `state` is `Error`, for example `invalid_url`, `blocked_url`, `url_redirect`, `url_unreachable`, `too_large`, `invalid_image`, `checksum_mismatch` or `download_failed`; other values may appear. Null when there is no error. |
| `image.created_at` | integer | yes | When the image was created (Unix time, seconds, UTC) |
| `image.updated_at` | integer | yes | When the image last changed (Unix time, seconds, UTC) |
| `image.ready_at` | integer or null | yes | When the image became `Ready`; null before that (Unix time, seconds, UTC) |
| `image.vm_count` | integer | no | Templates only: number of your servers that currently use this image. Absent for ISOs and for images that are not `Ready` yet. |
| `job_id` | integer or null | yes | Identifier of the background job. Null in a repeated (idempotent) answer. |
| `idempotent_replay` | boolean | no | True when this is the answer to a repeated request (the response status is then 200). |

Example:

```json
{
  "image": {
    "bootable": true,
    "busy": true,
    "cents_per_month": 0,
    "checksum": null,
    "created_at": 1791800000,
    "debt_since": null,
    "declared_bytes": 1048576,
    "description": null,
    "error_code": null,
    "format": "QCOW2",
    "hours_per_month": 730,
    "id": 13,
    "kind": "template",
    "last_error": null,
    "lock_reason": null,
    "locked": false,
    "locked_at": null,
    "name": "Ubuntu 24.04 golden",
    "os_type_id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
    "os_type_name": "Other Linux (64-bit)",
    "paid_cents": 0,
    "password_enabled": true,
    "progress": 0,
    "rate_uusd_gb_hour": 17,
    "ready_at": null,
    "size_bytes": 0,
    "size_gb": 0,
    "source": "url",
    "src_vm_id": null,
    "state": "Queued",
    "template_id": null,
    "updated_at": 1791800900,
    "url": "https://images.example.com/ubuntu-24.04.qcow2",
    "username": null,
    "uusd_per_hour": 0,
    "virtual_size_bytes": 0,
    "zone_id": 1
  },
  "job_id": 4821
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Your wallet balance is zero or negative. Top up and retry. |
| 404 | `zone_not_found` | `zone_id` is not a region available on this site. |
| 409 | `image_limit` | You reached the maximum number of images per account (`limit`). |
| 409 | `image_gb_limit` | The new image would exceed your total storage limit (`limit_gb`, `used_gb`). |
| 409 | `image_concurrent` | You already have 2 images downloading or being created. Wait for one to finish. |
| 409 | `zone_not_supported` | Images are not available in the chosen (or default) region. |
| 409 | `job_running` | A background job for this image is already running. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `kind`, `name` or `format` is missing or not allowed. The `field` of the error names it. |
| 422 | `invalid_url` | The URL does not follow the rules above (scheme, port, credentials, length, file extension, host name). |
| 422 | `blocked_url` | The address of the URL is not allowed (private network or provider infrastructure). |
| 422 | `resolve_failed` | The host name in the URL could not be resolved. |
| 422 | `url_redirect` | The URL answers with a redirect. Use the direct download link of the file. |
| 422 | `url_unreachable` | The server did not answer the URL with a success status. |
| 422 | `too_large` | The file is larger than the maximum for this kind of image (`max_gb`). |
| 422 | `invalid_image` | The first bytes of the file are not a QCOW2 disk (templates) or an ISO 9660 / UDF disc (ISOs), or the file is compressed. |
| 422 | `invalid_checksum` | `checksum` is not a hex digest of 32, 40, 64, 96 or 128 digits, or its algorithm prefix does not match its length. |
| 422 | `invalid_os_type` | `os_type_id` is not an identifier from List OS types. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |
| 502 | `cloudstack_error` | The list of operating system types could not be fetched from the platform right now. Retry later. |
| 503 | `image_capacity` | Image storage is temporarily full. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/images" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"checksum":"sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","description":"Hardened base image","kind":"template","name":"Ubuntu 24.04 golden","os_type_id":"5a3f6ae4-bf73-11f0-8c3a-00163eb1d097","url":"https://images.example.com/ubuntu-24.04.qcow2"}'
```

---

#### Create an image from a stopped instance

`POST /v1/images/from-vm`

Creates a template image from the system disk of one of your servers. The server must be stopped (power state `Stopped`) and not locked or busy with another operation; it is not modified. The call returns 202 with the new image in state `Queued` and a `job_id`; follow it with Get an image until it is `Ready`. The image is stored in the region of the server and inherits its login user name. Its real size is measured when the copy completes and billing per GB-hour starts then; until that moment your limits reserve the disk size of the server. You need a positive wallet balance to start. At most 2 images per account can be downloading or being created at a time, and the whole site runs only a few copies at once (503 `image_capacity` when it is busy). Repeating the call with the same `Idempotency-Key` returns the original image with status 200 and `idempotent_replay` true.

**Required scope:** `image:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `image:write` | CLI: `image from-vm` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | yes | UUID of the stopped server to copy. |
| `name` | string | yes | Name of the image: 1 to 64 characters. Letters, digits, spaces and `-`, `_`, `.`, `(`, `)` are kept; any other character is silently dropped. |
| `description` | string | no | Optional description, up to 500 characters. |

Example:

```json
{
  "description": "Before the Ubuntu upgrade",
  "name": "web-1 golden",
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `image` | Image | yes |  |
| `image.id` | integer | yes | Image identifier. Use it as `iid` in the other image calls. |
| `image.kind` | string: `template`, `iso` | yes | `template` is a bootable operating system disk used to create servers; `iso` is an installation or rescue disc that can be attached to a server. |
| `image.source` | string: `url`, `vm` | yes | How the image was made: imported from a `url`, or created from one of your servers (`vm`). |
| `image.name` | string | yes | Name you gave the image. |
| `image.description` | string or null | yes | Free-text description, or null. |
| `image.zone_id` | integer | yes | Region where the image is stored. Servers can only use images of their own region. |
| `image.template_id` | integer or null | yes | Templates only: identifier to pass as `template_id` when creating a server from this image. Null until the image is `Ready`, and always null for ISOs. |
| `image.url` | string or null | yes | Download URL the image was imported from, as normalised by the server. Null for images created from a server. |
| `image.format` | string or null | yes | Disk format: `QCOW2` for templates, `ISO` for ISO images. |
| `image.os_type_id` | string or null | yes | Operating system type chosen at import (an `id` from List OS types). |
| `image.os_type_name` | string or null | yes | Name of that operating system type. |
| `image.bootable` | boolean | yes | ISO only: whether the ISO can be booted. Always true for templates. |
| `image.password_enabled` | boolean | yes | Templates only: whether servers created from this image support password reset. False for ISOs. |
| `image.checksum` | string or null | yes | Checksum you supplied, normalised to the form `{SHA-256}` followed by the lowercase hex digest. Null when none was given. |
| `image.src_vm_id` | string or null | yes | For images created from a server: UUID of that server. Otherwise null. |
| `image.username` | string or null | yes | For images created from a server: the login user name servers created from the image start with. Otherwise null. |
| `image.state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | yes | Processing state. `Queued` waiting to start, `Downloading` being fetched from the URL, `Creating` being copied from a server, `Ready` usable and billed, `Error` failed (see `error_code`), `Deleting` being removed. |
| `image.busy` | boolean | yes | True while `state` is `Queued`, `Downloading`, `Creating` or `Deleting`. A busy image cannot be deleted or changed in storage. |
| `image.progress` | integer | yes | Download or copy progress in percent, 0 to 100. |
| `image.size_bytes` | integer | yes | Real size on storage in bytes, known once the image is `Ready`; 0 before that. |
| `image.virtual_size_bytes` | integer | yes | Size of the virtual disk in bytes, known once the image is `Ready`; 0 before that. |
| `image.declared_bytes` | integer | yes | Size announced by the source before the transfer (the file size from the URL, or the disk size of the source server); 0 when unknown. |
| `image.size_gb` | integer | yes | Billed size: `size_bytes` rounded up to whole GB (1 GB = 2^30 bytes); 0 until the image is `Ready`. |
| `image.rate_uusd_gb_hour` | integer | yes | Hourly storage rate locked in for this image, in millionths of a US dollar per GB. It can only go down over time. |
| `image.uusd_per_hour` | integer | yes | Current hourly cost of the image in millionths of a US dollar (`size_gb` times the rate). |
| `image.cents_per_month` | integer | yes | Estimated monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `image.hours_per_month` | integer | yes | Hours per month used for the monthly estimate (730 by default). |
| `image.paid_cents` | integer | yes | Total amount charged for storing this image so far, in US cents. |
| `image.debt_since` | integer or null | yes | Set while your wallet could not cover the storage charge: since when the image has been unpaid. Images unpaid for long enough are deleted automatically (Unix time, seconds, UTC) |
| `image.locked` | boolean | yes | True when support has locked the image. A locked image is not billed and cannot be attached. |
| `image.locked_at` | integer or null | yes | When the image was locked (Unix time, seconds, UTC) |
| `image.lock_reason` | string or null | yes | Reason given for the lock. |
| `image.last_error` | string or null | yes | Human-readable explanation of the failure when `state` is `Error`; null otherwise. |
| `image.error_code` | string or null | yes | Machine-readable failure reason when `state` is `Error`, for example `invalid_url`, `blocked_url`, `url_redirect`, `url_unreachable`, `too_large`, `invalid_image`, `checksum_mismatch` or `download_failed`; other values may appear. Null when there is no error. |
| `image.created_at` | integer | yes | When the image was created (Unix time, seconds, UTC) |
| `image.updated_at` | integer | yes | When the image last changed (Unix time, seconds, UTC) |
| `image.ready_at` | integer or null | yes | When the image became `Ready`; null before that (Unix time, seconds, UTC) |
| `image.vm_count` | integer | no | Templates only: number of your servers that currently use this image. Absent for ISOs and for images that are not `Ready` yet. |
| `job_id` | integer or null | yes | Identifier of the background job. Null in a repeated (idempotent) answer. |
| `idempotent_replay` | boolean | no | True when this is the answer to a repeated request (the response status is then 200). |

Example:

```json
{
  "image": {
    "bootable": true,
    "busy": true,
    "cents_per_month": 0,
    "checksum": null,
    "created_at": 1791800000,
    "debt_since": null,
    "declared_bytes": 26843545600,
    "description": null,
    "error_code": null,
    "format": "QCOW2",
    "hours_per_month": 730,
    "id": 13,
    "kind": "template",
    "last_error": null,
    "lock_reason": null,
    "locked": false,
    "locked_at": null,
    "name": "web-1 golden",
    "os_type_id": null,
    "os_type_name": null,
    "paid_cents": 0,
    "password_enabled": true,
    "progress": 0,
    "rate_uusd_gb_hour": 17,
    "ready_at": null,
    "size_bytes": 0,
    "size_gb": 0,
    "source": "vm",
    "src_vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "state": "Queued",
    "template_id": null,
    "updated_at": 1791800900,
    "url": null,
    "username": "ubuntu",
    "uusd_per_hour": 0,
    "virtual_size_bytes": 0,
    "zone_id": 1
  },
  "job_id": 4822
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Your wallet balance is zero or negative. Top up and retry. |
| 404 | `not_found` | `vm_id` does not exist or belongs to another account. |
| 409 | `vm_not_active` | The server is not in a state that allows operations (the error carries its `state`). |
| 409 | `job_running` | Another operation is running on the server. Wait for it to finish. |
| 409 | `vm_must_be_stopped` | The server is not stopped. Stop it first (the error carries its `cs_state`). |
| 409 | `image_limit` | You reached the maximum number of images per account (`limit`). |
| 409 | `image_gb_limit` | The copy would exceed your total storage limit (`limit_gb`, `used_gb`). |
| 409 | `image_concurrent` | You already have 2 images downloading or being created. Wait for one to finish. |
| 409 | `image_busy` | An image with the same idempotency key is being created. |
| 409 | `zone_not_supported` | Images are not available in the region of this server. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`snapshot`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `name` is missing or empty after dropping unsupported characters. The `field` of the error names it. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked. The error carries the lock `reason`. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |
| 503 | `image_capacity` | Image storage or the copy capacity of the site is temporarily full. Retry later. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/images/from-vm" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"description":"Before the Ubuntu upgrade","name":"web-1 golden","vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

#### Rename / describe an image

`PATCH /v1/images/{iid}`

Renames an image and/or changes its description. Only these display fields change; the image itself, its billing and the servers using it are not affected, and the call works in any state. Omit a field to keep it; send an empty `description` to clear it. Names are limited to 64 characters of letters, digits, spaces and `-`, `_`, `.`, `(`, `)`: other characters are silently dropped, and a name that ends up empty is rejected.

**Required scope:** `image:write`.

Scope: `image:write` | CLI: `image update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `iid` | string | yes | Numeric image identifier, as returned in the `id` field of List images. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | New name of the image. |
| `description` | string | no | New description, up to 500 characters. An empty string removes it. |

Example:

```json
{
  "description": "Hardened, patched in October",
  "name": "Ubuntu 24.04 golden v2"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `image` | Image | yes |  |
| `image.id` | integer | yes | Image identifier. Use it as `iid` in the other image calls. |
| `image.kind` | string: `template`, `iso` | yes | `template` is a bootable operating system disk used to create servers; `iso` is an installation or rescue disc that can be attached to a server. |
| `image.source` | string: `url`, `vm` | yes | How the image was made: imported from a `url`, or created from one of your servers (`vm`). |
| `image.name` | string | yes | Name you gave the image. |
| `image.description` | string or null | yes | Free-text description, or null. |
| `image.zone_id` | integer | yes | Region where the image is stored. Servers can only use images of their own region. |
| `image.template_id` | integer or null | yes | Templates only: identifier to pass as `template_id` when creating a server from this image. Null until the image is `Ready`, and always null for ISOs. |
| `image.url` | string or null | yes | Download URL the image was imported from, as normalised by the server. Null for images created from a server. |
| `image.format` | string or null | yes | Disk format: `QCOW2` for templates, `ISO` for ISO images. |
| `image.os_type_id` | string or null | yes | Operating system type chosen at import (an `id` from List OS types). |
| `image.os_type_name` | string or null | yes | Name of that operating system type. |
| `image.bootable` | boolean | yes | ISO only: whether the ISO can be booted. Always true for templates. |
| `image.password_enabled` | boolean | yes | Templates only: whether servers created from this image support password reset. False for ISOs. |
| `image.checksum` | string or null | yes | Checksum you supplied, normalised to the form `{SHA-256}` followed by the lowercase hex digest. Null when none was given. |
| `image.src_vm_id` | string or null | yes | For images created from a server: UUID of that server. Otherwise null. |
| `image.username` | string or null | yes | For images created from a server: the login user name servers created from the image start with. Otherwise null. |
| `image.state` | string: `Queued`, `Downloading`, `Creating`, `Ready`, `Error`, `Deleting` | yes | Processing state. `Queued` waiting to start, `Downloading` being fetched from the URL, `Creating` being copied from a server, `Ready` usable and billed, `Error` failed (see `error_code`), `Deleting` being removed. |
| `image.busy` | boolean | yes | True while `state` is `Queued`, `Downloading`, `Creating` or `Deleting`. A busy image cannot be deleted or changed in storage. |
| `image.progress` | integer | yes | Download or copy progress in percent, 0 to 100. |
| `image.size_bytes` | integer | yes | Real size on storage in bytes, known once the image is `Ready`; 0 before that. |
| `image.virtual_size_bytes` | integer | yes | Size of the virtual disk in bytes, known once the image is `Ready`; 0 before that. |
| `image.declared_bytes` | integer | yes | Size announced by the source before the transfer (the file size from the URL, or the disk size of the source server); 0 when unknown. |
| `image.size_gb` | integer | yes | Billed size: `size_bytes` rounded up to whole GB (1 GB = 2^30 bytes); 0 until the image is `Ready`. |
| `image.rate_uusd_gb_hour` | integer | yes | Hourly storage rate locked in for this image, in millionths of a US dollar per GB. It can only go down over time. |
| `image.uusd_per_hour` | integer | yes | Current hourly cost of the image in millionths of a US dollar (`size_gb` times the rate). |
| `image.cents_per_month` | integer | yes | Estimated monthly cost in US cents, rounded, for `hours_per_month` hours. |
| `image.hours_per_month` | integer | yes | Hours per month used for the monthly estimate (730 by default). |
| `image.paid_cents` | integer | yes | Total amount charged for storing this image so far, in US cents. |
| `image.debt_since` | integer or null | yes | Set while your wallet could not cover the storage charge: since when the image has been unpaid. Images unpaid for long enough are deleted automatically (Unix time, seconds, UTC) |
| `image.locked` | boolean | yes | True when support has locked the image. A locked image is not billed and cannot be attached. |
| `image.locked_at` | integer or null | yes | When the image was locked (Unix time, seconds, UTC) |
| `image.lock_reason` | string or null | yes | Reason given for the lock. |
| `image.last_error` | string or null | yes | Human-readable explanation of the failure when `state` is `Error`; null otherwise. |
| `image.error_code` | string or null | yes | Machine-readable failure reason when `state` is `Error`, for example `invalid_url`, `blocked_url`, `url_redirect`, `url_unreachable`, `too_large`, `invalid_image`, `checksum_mismatch` or `download_failed`; other values may appear. Null when there is no error. |
| `image.created_at` | integer | yes | When the image was created (Unix time, seconds, UTC) |
| `image.updated_at` | integer | yes | When the image last changed (Unix time, seconds, UTC) |
| `image.ready_at` | integer or null | yes | When the image became `Ready`; null before that (Unix time, seconds, UTC) |
| `image.vm_count` | integer | no | Templates only: number of your servers that currently use this image. Absent for ISOs and for images that are not `Ready` yet. |

Example:

```json
{
  "image": {
    "bootable": true,
    "busy": false,
    "cents_per_month": 4,
    "checksum": "{SHA-256}e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "created_at": 1791800000,
    "debt_since": null,
    "declared_bytes": 2362232832,
    "description": "Hardened base image",
    "error_code": null,
    "format": "QCOW2",
    "hours_per_month": 730,
    "id": 12,
    "kind": "template",
    "last_error": null,
    "lock_reason": null,
    "locked": false,
    "locked_at": null,
    "name": "Ubuntu 24.04 golden",
    "os_type_id": "5a3f6ae4-bf73-11f0-8c3a-00163eb1d097",
    "os_type_name": "Other Linux (64-bit)",
    "paid_cents": 2,
    "password_enabled": true,
    "progress": 100,
    "rate_uusd_gb_hour": 17,
    "ready_at": 1791800900,
    "size_bytes": 2362232832,
    "size_gb": 3,
    "source": "url",
    "src_vm_id": null,
    "state": "Ready",
    "template_id": 57,
    "updated_at": 1791800900,
    "url": "https://images.example.com/ubuntu-24.04.qcow2",
    "username": null,
    "uusd_per_hour": 51,
    "virtual_size_bytes": 10737418240,
    "vm_count": 1,
    "zone_id": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `name` is empty after dropping unsupported characters. The `field` of the error names it. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/images/<iid>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"description":"Hardened, patched in October","name":"Ubuntu 24.04 golden v2"}'
```

---

#### Delete an image (not in use)

`DELETE /v1/images/{iid}`

Deletes an image. The request is accepted with 202 and the image moves to `Deleting`; it disappears from List images when the removal finishes, and billing stops. An image cannot be deleted while it is being processed (409 `image_busy`) or while it is in use (409 `image_in_use`): a template that existing servers were created from, or an ISO attached to a server. Delete those servers or detach the ISO first. An image that never reached storage, for example a failed import, is removed immediately: the response then has `deleted` true and no `job_id`. At most 10 deletions per minute are accepted.

**Required scope:** `image:write`.

Scope: `image:write` | CLI: `image delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `iid` | string | yes | Numeric image identifier, as returned in the `id` field of List images. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer or null | yes | Identifier of the background job removing the image; null when it was removed immediately. |
| `deleted` | boolean | yes | True when the image was removed immediately and no job was needed. |

Example:

```json
{
  "deleted": false,
  "job_id": 4830
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `image_busy` | The image is being processed (`state` is `Queued`, `Downloading`, `Creating` or `Deleting`). Wait until it settles. |
| 409 | `image_in_use` | The image is in use. The error carries the number of servers (`vm_count`). |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |
| 502 | `cloudstack_error` | Whether the image is in use could not be checked on the platform right now. Retry later. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/images/<iid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach an ISO to an instance

`POST /v1/images/{iid}/attach`

Attaches one of your ISO images to a server so that it can boot from it. The server can be running or stopped; reboot it to boot from the ISO. The ISO must be `Ready`, not locked, and in the same region as the server, and a server can have only one ISO attached at a time. The call returns 200 with the `job_id` of the background operation; follow it with the jobs of the server (`GET /v1/vm/{id}/jobs`). At most 10 attach calls per minute are accepted.

**Required scope:** `image:write`.

Scope: `image:write` | CLI: `image attach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `iid` | string | yes | Numeric image identifier, as returned in the `id` field of List images. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | yes | UUID of the server to attach the ISO to. |

Example:

```json
{
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that attaches the ISO. |

Example:

```json
{
  "job_id": 4840
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON. |
| 404 | `not_found` | The image or the server does not exist, or belongs to another account. |
| 409 | `vm_not_active` | The server is not in a state that allows operations (the error carries its `state`). |
| 409 | `job_running` | Another operation is running on the server. Wait for it to finish. |
| 409 | `image_not_ready` | The ISO is not `Ready` yet (the error carries its `state`). |
| 409 | `image_zone_mismatch` | The ISO and the server are in different regions. |
| 422 | `not_iso` | The image is a template; only ISO images can be attached. |
| 423 | `image_locked` | The ISO was locked by support and cannot be attached. |
| 423 | `vm_locked` | The server is locked. The error carries the lock `reason`. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/images/<iid>/attach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

#### Detach an ISO from an instance

`POST /v1/images/{iid}/detach`

Detaches the ISO that is currently attached to a server. `iid` must be one of your ISO images, but it is not compared with the ISO that is actually attached: whatever ISO is attached is removed, and the call succeeds without effect when there is none. It works on running and stopped servers and returns the `job_id` of the background operation (see `GET /v1/vm/{id}/jobs`). At most 10 detach calls per minute are accepted.

**Required scope:** `image:write`.

Scope: `image:write` | CLI: `image detach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `iid` | string | yes | Numeric image identifier, as returned in the `id` field of List images. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | yes | UUID of the server to detach the ISO from. |

Example:

```json
{
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Identifier of the background job that detaches the ISO. |

Example:

```json
{
  "job_id": 4841
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON. |
| 404 | `not_found` | The image or the server does not exist, or belongs to another account. |
| 409 | `vm_not_active` | The server is not in a state that allows operations (the error carries its `state`). |
| 409 | `job_running` | Another operation is running on the server. Wait for it to finish. |
| 422 | `not_iso` | The image is a template; only ISO images can be detached. |
| 423 | `vm_locked` | The server is locked. The error carries the lock `reason`. |
| 501 | `feature_disabled` | Image management is switched off on this site (or not yet enabled for your account). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/images/<iid>/detach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

### VPN and Proxy

VPN IPv4 and Proxy IPv6 plans. The `vpn:read` scope gives an app or script what it needs to connect: the plans, IP addresses, ports, user names and passwords. Separate scopes cover plan details such as traffic and configuration files (`vpn:detail`), changing settings (`vpn:write`), buying, renewing and upgrading (`vpn:create`, costs money) and cancelling (`vpn:destroy`). The responses contain live proxy credentials, so treat them as secrets and give each key only the scopes it needs. Hidden on sites that do not sell VPN or proxies.

#### List VPN IPv4 plans

`GET /v1/vpn/subscriptions`

Lists your VPN IPv4 plans, newest first, with status, expiry and the number of endpoints of each plan. The list is not paginated. Plans you removed from your list and orders that were rejected before any payment are left out.

Endpoint addresses, ports and passwords are not part of this list; call [Get a VPN plan](#operation/vpn_subscription_get) or [List VPN endpoints](#operation/vpn_endpoint_list) for them. Proxy IPv6 plans are listed by [List Proxy IPv6 plans](#operation/proxy6_subscription_list).

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `vpn subscription list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `include_hidden` | boolean | no | Set to `true` (or `1`) to also list plans that you removed from your list in the dashboard. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpnSubscription | yes |  |
| `items[].id` | integer | yes | Plan identifier. |
| `items[].tier` | string: `shared`, `private`, `dedicated` | yes | IP type of the plan. New plans are `dedicated` (the IP is for your exclusive use); older plans can be `private` or `shared`. |
| `items[].ip_count` | integer | yes | Number of IP addresses (endpoints) in the plan. |
| `items[].bandwidth_gb` | integer | yes | Traffic allowance per billing period in GB; 0 means unlimited. |
| `items[].cycle` | string | yes | Billing cycle chosen at purchase, for example `daily`, `weekly`, `monthly` or `yearly`. |
| `items[].addons` | array of string | yes | Add-ons bought with the plan. |
| `items[].monthly_uusd` | integer | yes | Price per month in millionths of a US dollar, as sold. |
| `items[].total_uusd` | integer | yes | Price of one full billing period in millionths of a US dollar, as sold. |
| `items[].status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | `pending`: payment is being confirmed. `active`: usable. `expired`: ended; it can still be renewed while the IP addresses are held (see `keep_until`). `canceled` and `failed`: ended for good. |
| `items[].created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `items[].expires_at` | integer | yes | When the current paid period ends (Unix time, seconds, UTC) |
| `items[].months` | integer | yes | Length of one billing period in months. 0 for plans billed per day or per week (see `period_days`). |
| `items[].renew_cents` | integer | yes | Price of renewing one billing period, in US cents. It is fixed when the plan is bought. |
| `items[].renew_max_periods` | integer | yes | Largest number of billing periods that can be paid in a single renewal. |
| `items[].period_days` | integer | yes | Length of one billing period in days for plans billed per day or per week; 0 when billing follows calendar months (`months`). |
| `items[].activated_at` | integer or null | yes | When the plan became active, or null if it never did (Unix time, seconds, UTC) |
| `items[].fail_reason` | string or null | yes | Short machine-readable reason when the plan is `canceled` or `failed` (for example `not_charged` or `refunded`); null otherwise. |
| `items[].canceled_at` | integer or null | yes | When the plan was canceled or failed, or null otherwise (Unix time, seconds, UTC) |
| `items[].ip_released_at` | integer or null | yes | When the IP addresses went back to the pool, or null while the plan still holds them (Unix time, seconds, UTC) |
| `items[].hidden_at` | integer or null | yes | When you removed the plan from your list, or null otherwise. Removed plans are only returned with `include_hidden` (Unix time, seconds, UTC) |
| `items[].renewable` | boolean | yes | Whether the plan can be renewed now (it is `active`, or `expired` and still holds its IP addresses). |
| `items[].auto_renew` | boolean | yes | Whether the plan renews itself from the wallet balance shortly before it ends. Always false for plans that can no longer be renewed. |
| `items[].keep_until` | integer or null | yes | For an `expired` plan that still holds its IP addresses: the time after which they are released unless the plan is renewed. Null otherwise (Unix time, seconds, UTC) |
| `items[].endpoint_count` | integer | no | Number of endpoints of the plan. Only present in the list response. |
| `items[].zone` | Zone or null | yes |  |
| `items[].capabilities` | object | no | Capabilities of the plan, summarised over its IPs. |
| `items[].capabilities.http` | boolean | yes | HTTP proxy is available. |
| `items[].capabilities.socks5` | boolean | yes | SOCKS5 proxy is available. |
| `items[].capabilities.udp` | boolean | yes | At least one IP of the plan offers UDP. |
| `items[].capabilities.ip_auth` | boolean | yes | At least one IP of the plan accepts authorized source IPs without a password. |
| `items[].capabilities.ip_auth_protocols` | array of string: `http`, `socks5` | yes | Protocols that work without a password from an authorized IP on every IP of the plan that accepts authorized IPs. |
| `items[].capabilities.addons` | boolean | yes | Pro add-ons can be used: every IP of the plan supports them. |
| `items[].capabilities.metering` | string: `directional`, `combined` | yes | `directional`: download and upload are counted separately. `combined`: only the total is counted. |
| `items[].capabilities.protocols` | array of string: `http`, `socks5`, `udp` | yes | Protocols offered. |
| `items[].capabilities.udp_all` | boolean | yes | Every IP of the plan offers UDP. |
| `items[].capabilities.ip_auth_all` | boolean | yes | Every IP of the plan accepts authorized source IPs. |

Example:

```json
{
  "items": [
    {
      "activated_at": 1787400012,
      "addons": [],
      "auto_renew": true,
      "bandwidth_gb": 1000,
      "canceled_at": null,
      "capabilities": {
        "addons": true,
        "http": true,
        "ip_auth": true,
        "ip_auth_all": true,
        "ip_auth_protocols": [
          "http",
          "socks5"
        ],
        "metering": "directional",
        "protocols": [
          "http",
          "socks5",
          "udp"
        ],
        "socks5": true,
        "udp": true,
        "udp_all": true
      },
      "created_at": 1787400000,
      "cycle": "monthly",
      "endpoint_count": 2,
      "expires_at": 1792584012,
      "fail_reason": null,
      "hidden_at": null,
      "id": 1042,
      "ip_count": 2,
      "ip_released_at": null,
      "keep_until": null,
      "monthly_uusd": 11960000,
      "months": 1,
      "period_days": 0,
      "renew_cents": 1196,
      "renew_max_periods": 12,
      "renewable": true,
      "status": "active",
      "tier": "dedicated",
      "total_uusd": 11960000,
      "zone": {
        "city": "Ho Chi Minh City",
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "name_en": "Ho Chi Minh City",
        "slug": "hcm-1"
      }
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one VPN IPv4 plan + endpoints (with passwords)

`GET /v1/vpn/subscriptions/{id}`

Returns one VPN IPv4 plan with its endpoints. Each endpoint carries the IP address, the SOCKS5 and HTTP ports (and the UDP port when that IP offers UDP — see `capabilities`), and the user name and **password** to connect with, so this response is sensitive. `subscription.capabilities` summarises what the plan's IPs support. The renewal history and the bandwidth-upgrade history are included (the 50 most recent entries of each, newest first).

Only endpoints of an `active` plan accept connections. When a plan is canceled or its IP addresses are released, `endpoints` is empty. An id that belongs to another account, or to a Proxy IPv6 plan, returns `404`.

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `vpn subscription get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier, as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnSubscription | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string: `shared`, `private`, `dedicated` | yes | IP type of the plan. New plans are `dedicated` (the IP is for your exclusive use); older plans can be `private` or `shared`. |
| `subscription.ip_count` | integer | yes | Number of IP addresses (endpoints) in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Traffic allowance per billing period in GB; 0 means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle chosen at purchase, for example `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes | Add-ons bought with the plan. |
| `subscription.monthly_uusd` | integer | yes | Price per month in millionths of a US dollar, as sold. |
| `subscription.total_uusd` | integer | yes | Price of one full billing period in millionths of a US dollar, as sold. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | `pending`: payment is being confirmed. `active`: usable. `expired`: ended; it can still be renewed while the IP addresses are held (see `keep_until`). `canceled` and `failed`: ended for good. |
| `subscription.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | When the current paid period ends (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Length of one billing period in months. 0 for plans billed per day or per week (see `period_days`). |
| `subscription.renew_cents` | integer | yes | Price of renewing one billing period, in US cents. It is fixed when the plan is bought. |
| `subscription.renew_max_periods` | integer | yes | Largest number of billing periods that can be paid in a single renewal. |
| `subscription.period_days` | integer | yes | Length of one billing period in days for plans billed per day or per week; 0 when billing follows calendar months (`months`). |
| `subscription.activated_at` | integer or null | yes | When the plan became active, or null if it never did (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short machine-readable reason when the plan is `canceled` or `failed` (for example `not_charged` or `refunded`); null otherwise. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled or failed, or null otherwise (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool, or null while the plan still holds them (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When you removed the plan from your list, or null otherwise. Removed plans are only returned with `include_hidden` (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed now (it is `active`, or `expired` and still holds its IP addresses). |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet balance shortly before it ends. Always false for plans that can no longer be renewed. |
| `subscription.keep_until` | integer or null | yes | For an `expired` plan that still holds its IP addresses: the time after which they are released unless the plan is renewed. Null otherwise (Unix time, seconds, UTC) |
| `subscription.endpoint_count` | integer | no | Number of endpoints of the plan. Only present in the list response. |
| `subscription.zone` | Zone or null | yes |  |
| `subscription.capabilities` | object | no | Capabilities of the plan, summarised over its IPs. |
| `subscription.capabilities.http` | boolean | yes | HTTP proxy is available. |
| `subscription.capabilities.socks5` | boolean | yes | SOCKS5 proxy is available. |
| `subscription.capabilities.udp` | boolean | yes | At least one IP of the plan offers UDP. |
| `subscription.capabilities.ip_auth` | boolean | yes | At least one IP of the plan accepts authorized source IPs without a password. |
| `subscription.capabilities.ip_auth_protocols` | array of string: `http`, `socks5` | yes | Protocols that work without a password from an authorized IP on every IP of the plan that accepts authorized IPs. |
| `subscription.capabilities.addons` | boolean | yes | Pro add-ons can be used: every IP of the plan supports them. |
| `subscription.capabilities.metering` | string: `directional`, `combined` | yes | `directional`: download and upload are counted separately. `combined`: only the total is counted. |
| `subscription.capabilities.protocols` | array of string: `http`, `socks5`, `udp` | yes | Protocols offered. |
| `subscription.capabilities.udp_all` | boolean | yes | Every IP of the plan offers UDP. |
| `subscription.capabilities.ip_auth_all` | boolean | yes | Every IP of the plan accepts authorized source IPs. |
| `endpoints` | array of VpnEndpoint | yes |  |
| `endpoints[].id` | integer | yes | Endpoint identifier. |
| `endpoints[].subscription_id` | integer | yes | Plan this endpoint belongs to. |
| `endpoints[].ip` | string | yes | IPv4 address of the endpoint. Traffic sent through the endpoint leaves from this address. |
| `endpoints[].port_socks` | integer | yes | Port of the SOCKS5 proxy (TCP). |
| `endpoints[].port_http` | integer | yes | Port of the HTTP proxy. |
| `endpoints[].port_udp` | integer | yes | Port of the UDP relay; 0 when this IP does not offer UDP (see `capabilities.udp`). |
| `endpoints[].username` | string | yes | User name for the proxy login. |
| `endpoints[].password` | string | yes | Password for the proxy login. Treat it as a secret. |
| `endpoints[].country` | string or null | yes | ISO 3166-1 alpha-2 country code of the IP address, when known. |
| `endpoints[].city` | string or null | yes | City of the IP address, when known. |
| `endpoints[].state` | string: `provisioning`, `active` | yes | `provisioning`: being set up, may not accept connections yet. `active`: ready to use. |
| `endpoints[].capabilities` | object | no | Capabilities of this IP. |
| `endpoints[].capabilities.http` | boolean | yes | HTTP proxy is available. |
| `endpoints[].capabilities.socks5` | boolean | yes | SOCKS5 proxy is available. |
| `endpoints[].capabilities.udp` | boolean | yes | This IP offers UDP (`port_udp`). |
| `endpoints[].capabilities.ip_auth` | boolean | yes | This IP accepts authorized source IPs without a password. |
| `endpoints[].capabilities.ip_auth_protocols` | array of string: `http`, `socks5` | yes | Protocols that work without a password from an authorized IP. A protocol that is not listed always needs the username and password. |
| `endpoints[].capabilities.addons` | boolean | yes | This IP supports Pro add-ons. |
| `endpoints[].capabilities.metering` | string: `directional`, `combined` | yes | `directional`: download and upload are counted separately. `combined`: only the total is counted. |
| `endpoints[].capabilities.protocols` | array of string: `http`, `socks5`, `udp` | yes | Protocols offered. |
| `endpoints[].period_bytes` | integer | no | Total bytes through this IP in the current billing period. Only in the plan detail response. |
| `endpoints[].period_rx` | integer or null | no | Bytes downloaded through this IP in the current period; null when the IP only counts total traffic (`capabilities.metering` is `combined`). |
| `endpoints[].period_tx` | integer or null | no | Bytes uploaded through this IP in the current period; null when the IP only counts total traffic. |
| `endpoints[].period_seen` | integer or null | no | Last time this IP carried traffic (or, for an IP that only counts totals, when its counter was last read); null when there is no data yet. (Unix time, seconds, UTC) |
| `renewals` | array of VpnPlanRenewal | yes |  |
| `renewals[].id` | integer | yes | Renewal identifier. |
| `renewals[].seq` | integer | yes | Sequence number of the renewal within the plan, starting at 1. |
| `renewals[].periods` | integer | yes | Number of billing periods paid. |
| `renewals[].months` | integer | yes | Months added by the renewal (0 for plans billed per day or per week). |
| `renewals[].charged_cents` | integer | yes | Amount charged from the wallet, in US cents. |
| `renewals[].from` | integer | yes | Expiry before the renewal (Unix time, seconds, UTC) |
| `renewals[].to` | integer | yes | Expiry after the renewal (Unix time, seconds, UTC) |
| `renewals[].status` | string: `pending`, `done`, `failed`, `canceled` | yes | `done` once applied; `failed` and `canceled` renewals are refunded. |
| `renewals[].created_at` | integer | yes | When the renewal was requested (Unix time, seconds, UTC) |
| `bw_upgrades` | array of VpnBandwidthUpgrade | yes |  |
| `bw_upgrades[].id` | integer | yes | Upgrade identifier. |
| `bw_upgrades[].seq` | integer | yes | Sequence number of the upgrade within the plan, starting at 1. |
| `bw_upgrades[].from_gb` | integer | yes | Traffic allowance before the upgrade in GB (0 = unlimited). |
| `bw_upgrades[].to_gb` | integer | yes | Traffic allowance after the upgrade in GB (0 = unlimited). |
| `bw_upgrades[].days_left` | integer | yes | Days left in the period when the upgrade was bought; the charge covers these days. |
| `bw_upgrades[].charged_cents` | integer | yes | Amount charged from the wallet for the upgrade, in US cents. |
| `bw_upgrades[].new_renew_cents` | integer | yes | Price of one renewal period after the upgrade, in US cents. |
| `bw_upgrades[].status` | string: `pending`, `done`, `failed`, `canceled` | yes | `done` once applied; `failed` and `canceled` upgrades are refunded. |
| `bw_upgrades[].created_at` | integer | yes | When the upgrade was requested (Unix time, seconds, UTC) |

Example:

```json
{
  "bw_upgrades": [
    {
      "charged_cents": 807,
      "created_at": 1788000000,
      "days_left": 18,
      "from_gb": 250,
      "id": 12,
      "new_renew_cents": 1196,
      "seq": 1,
      "status": "done",
      "to_gb": 1000
    }
  ],
  "endpoints": [
    {
      "capabilities": {
        "addons": true,
        "http": true,
        "ip_auth": true,
        "ip_auth_protocols": [
          "http",
          "socks5"
        ],
        "metering": "directional",
        "protocols": [
          "http",
          "socks5",
          "udp"
        ],
        "socks5": true,
        "udp": true
      },
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 3101,
      "ip": "198.51.100.24",
      "password": "9f2c4e7a1b3d",
      "port_http": 65002,
      "port_socks": 65001,
      "port_udp": 65003,
      "state": "active",
      "subscription_id": 1042,
      "username": "k3m9x2p7qa"
    },
    {
      "capabilities": {
        "addons": true,
        "http": true,
        "ip_auth": true,
        "ip_auth_protocols": [
          "http",
          "socks5"
        ],
        "metering": "directional",
        "protocols": [
          "http",
          "socks5",
          "udp"
        ],
        "socks5": true,
        "udp": true
      },
      "city": null,
      "country": "VN",
      "id": 3102,
      "ip": "198.51.100.25",
      "password": "5b7d1a9e3c2f",
      "port_http": 65005,
      "port_socks": 65004,
      "port_udp": 65006,
      "state": "active",
      "subscription_id": 1042,
      "username": "t8w4n6c2ze"
    }
  ],
  "renewals": [
    {
      "charged_cents": 1196,
      "created_at": 1789900000,
      "from": 1789992012,
      "id": 87,
      "months": 1,
      "periods": 1,
      "seq": 1,
      "status": "done",
      "to": 1792584012
    }
  ],
  "subscription": {
    "activated_at": 1787400012,
    "addons": [],
    "auto_renew": true,
    "bandwidth_gb": 1000,
    "canceled_at": null,
    "capabilities": {
      "addons": true,
      "http": true,
      "ip_auth": true,
      "ip_auth_all": true,
      "ip_auth_protocols": [
        "http",
        "socks5"
      ],
      "metering": "directional",
      "protocols": [
        "http",
        "socks5",
        "udp"
      ],
      "socks5": true,
      "udp": true,
      "udp_all": true
    },
    "created_at": 1787400000,
    "cycle": "monthly",
    "expires_at": 1792584012,
    "fail_reason": null,
    "hidden_at": null,
    "id": 1042,
    "ip_count": 2,
    "ip_released_at": null,
    "keep_until": null,
    "monthly_uusd": 11960000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 1196,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 11960000,
    "zone": {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "name_en": "Ho Chi Minh City",
      "slug": "hcm-1"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### All endpoints of active plans (IP, ports, user/pass)

`GET /v1/vpn/endpoints`

Returns the endpoints of all your `active` VPN IPv4 plans in one flat list, ready to feed an app that lets the user pick an IP. The response contains the proxy passwords.

Connect to `ip:port_socks` with a SOCKS5 client, or to `ip:port_http` with an HTTP proxy client, and authenticate with `username` and `password`; traffic leaves from the endpoint IP. Endpoints in state `provisioning` are still being set up and may not accept connections yet. Plans that are not `active` contribute no endpoints. The list is not paginated.

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `vpn endpoint list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpnEndpoint | yes |  |
| `items[].id` | integer | yes | Endpoint identifier. |
| `items[].subscription_id` | integer | yes | Plan this endpoint belongs to. |
| `items[].ip` | string | yes | IPv4 address of the endpoint. Traffic sent through the endpoint leaves from this address. |
| `items[].port_socks` | integer | yes | Port of the SOCKS5 proxy (TCP). |
| `items[].port_http` | integer | yes | Port of the HTTP proxy. |
| `items[].port_udp` | integer | yes | Port of the UDP relay; 0 when this IP does not offer UDP (see `capabilities.udp`). |
| `items[].username` | string | yes | User name for the proxy login. |
| `items[].password` | string | yes | Password for the proxy login. Treat it as a secret. |
| `items[].country` | string or null | yes | ISO 3166-1 alpha-2 country code of the IP address, when known. |
| `items[].city` | string or null | yes | City of the IP address, when known. |
| `items[].state` | string: `provisioning`, `active` | yes | `provisioning`: being set up, may not accept connections yet. `active`: ready to use. |
| `items[].capabilities` | object | no | Capabilities of this IP. |
| `items[].capabilities.http` | boolean | yes | HTTP proxy is available. |
| `items[].capabilities.socks5` | boolean | yes | SOCKS5 proxy is available. |
| `items[].capabilities.udp` | boolean | yes | This IP offers UDP (`port_udp`). |
| `items[].capabilities.ip_auth` | boolean | yes | This IP accepts authorized source IPs without a password. |
| `items[].capabilities.ip_auth_protocols` | array of string: `http`, `socks5` | yes | Protocols that work without a password from an authorized IP. A protocol that is not listed always needs the username and password. |
| `items[].capabilities.addons` | boolean | yes | This IP supports Pro add-ons. |
| `items[].capabilities.metering` | string: `directional`, `combined` | yes | `directional`: download and upload are counted separately. `combined`: only the total is counted. |
| `items[].capabilities.protocols` | array of string: `http`, `socks5`, `udp` | yes | Protocols offered. |
| `items[].period_bytes` | integer | no | Total bytes through this IP in the current billing period. Only in the plan detail response. |
| `items[].period_rx` | integer or null | no | Bytes downloaded through this IP in the current period; null when the IP only counts total traffic (`capabilities.metering` is `combined`). |
| `items[].period_tx` | integer or null | no | Bytes uploaded through this IP in the current period; null when the IP only counts total traffic. |
| `items[].period_seen` | integer or null | no | Last time this IP carried traffic (or, for an IP that only counts totals, when its counter was last read); null when there is no data yet. (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "capabilities": {
        "addons": true,
        "http": true,
        "ip_auth": true,
        "ip_auth_protocols": [
          "http",
          "socks5"
        ],
        "metering": "directional",
        "protocols": [
          "http",
          "socks5",
          "udp"
        ],
        "socks5": true,
        "udp": true
      },
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 3101,
      "ip": "198.51.100.24",
      "password": "9f2c4e7a1b3d",
      "port_http": 65002,
      "port_socks": 65001,
      "port_udp": 65003,
      "state": "active",
      "subscription_id": 1042,
      "username": "k3m9x2p7qa"
    },
    {
      "capabilities": {
        "addons": true,
        "http": true,
        "ip_auth": true,
        "ip_auth_protocols": [
          "http",
          "socks5"
        ],
        "metering": "directional",
        "protocols": [
          "http",
          "socks5",
          "udp"
        ],
        "socks5": true,
        "udp": true
      },
      "city": null,
      "country": "VN",
      "id": 3102,
      "ip": "198.51.100.25",
      "password": "5b7d1a9e3c2f",
      "port_http": 65005,
      "port_socks": 65004,
      "port_udp": 65006,
      "state": "active",
      "subscription_id": 1042,
      "username": "t8w4n6c2ze"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/endpoints" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List Proxy IPv6 plans

`GET /v1/proxy6/subscriptions`

Lists your Proxy IPv6 plans, newest first. Each plan shows its type and size, the host and ports to connect to, the user name and the rotation state. The password is **not** included in the list (`proxy6.password` is `null`); fetch it with [Get a Proxy IPv6 plan](#operation/proxy6_subscription_get). The list is not paginated.

Plans you removed from your list and orders that were rejected before any payment are left out. VPN IPv4 plans are listed by [List VPN plans](#operation/vpn_subscription_list).

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `proxy6 subscription list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `include_hidden` | boolean | no | Set to `true` (or `1`) to also list plans that you removed from your list in the dashboard. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Proxy6Subscription | yes |  |
| `items[].id` | integer | yes | Plan identifier. |
| `items[].tier` | string: `shared`, `private`, `dedicated` | yes | Always `dedicated` for Proxy IPv6 plans. |
| `items[].ip_count` | integer | yes | Size of the plan: the number of IPv6 addresses of a static plan, the number of rotations per period of a rotating plan, and 0 for an unlimited plan. |
| `items[].bandwidth_gb` | integer | yes | Always 0: traffic is not metered per plan. |
| `items[].cycle` | string | yes | Billing cycle chosen at purchase, for example `daily`, `weekly`, `monthly` or `yearly`. |
| `items[].addons` | array of string | yes | Add-ons bought with the plan. |
| `items[].monthly_uusd` | integer | yes | Price per month in millionths of a US dollar, as sold. |
| `items[].total_uusd` | integer | yes | Price of one full billing period in millionths of a US dollar, as sold. |
| `items[].status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | `pending`: payment is being confirmed. `active`: usable. `expired`: ended; it can still be renewed while the IP addresses are held (see `keep_until`). `canceled` and `failed`: ended for good. |
| `items[].created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `items[].expires_at` | integer | yes | When the current paid period ends (Unix time, seconds, UTC) |
| `items[].months` | integer | yes | Length of one billing period in months. 0 for plans billed per day or per week (see `period_days`). |
| `items[].renew_cents` | integer | yes | Price of renewing one billing period, in US cents. It is fixed when the plan is bought. |
| `items[].renew_max_periods` | integer | yes | Largest number of billing periods that can be paid in a single renewal. |
| `items[].period_days` | integer | yes | Length of one billing period in days for plans billed per day or per week; 0 when billing follows calendar months (`months`). |
| `items[].activated_at` | integer or null | yes | When the plan became active, or null if it never did (Unix time, seconds, UTC) |
| `items[].fail_reason` | string or null | yes | Short machine-readable reason when the plan is `canceled` or `failed` (for example `not_charged` or `refunded`); null otherwise. |
| `items[].canceled_at` | integer or null | yes | When the plan was canceled or failed, or null otherwise (Unix time, seconds, UTC) |
| `items[].ip_released_at` | integer or null | yes | When the IP addresses went back to the pool, or null while the plan still holds them (Unix time, seconds, UTC) |
| `items[].hidden_at` | integer or null | yes | When you removed the plan from your list, or null otherwise. Removed plans are only returned with `include_hidden` (Unix time, seconds, UTC) |
| `items[].renewable` | boolean | yes | Whether the plan can be renewed now (it is `active`, or `expired` and still holds its IP addresses). |
| `items[].auto_renew` | boolean | yes | Whether the plan renews itself from the wallet balance shortly before it ends. Always false for plans that can no longer be renewed. |
| `items[].keep_until` | integer or null | no | For an `expired` plan that still holds its IP addresses: the time after which they are released unless the plan is renewed. Null otherwise (Unix time, seconds, UTC) |
| `items[].ip_version` | string | yes | Always `ipv6`. |
| `items[].proxy6` | object | yes | Connection details and rotation state of the Proxy IPv6 plan. |
| `items[].proxy6.kind` | string: `static`, `rotate`, `unlimited` | yes | `static`: a fixed set of IPv6 addresses. `rotate`: one address that changes, with a limited number of rotations per period. `unlimited`: one address that changes, with unlimited rotations. |
| `items[].proxy6.plan` | string | yes | Slug of the plan that was bought, for example `static-100`. |
| `items[].proxy6.count` | integer | yes | Plan size: number of addresses (`static`), rotations per period (`rotate`), or 0 (`unlimited`). |
| `items[].proxy6.mbps` | integer | yes | Bandwidth cap of the plan in Mbit/s, including bought add-ons. |
| `items[].proxy6.mbps_addons` | integer | yes | Number of bandwidth add-ons bought with the plan. |
| `items[].proxy6.devices` | integer | yes | Number of client source IP addresses the plan can be used from. The first sources that connect are locked to the plan and other sources are refused; 0 means no limit. |
| `items[].proxy6.device_addons` | integer | yes | Number of extra-device add-ons bought with the plan. |
| `items[].proxy6.devices_locked` | array of string | yes | Source IP addresses currently locked to the plan. They can be released in the dashboard. |
| `items[].proxy6.username` | string | yes | User name to authenticate with. |
| `items[].proxy6.password` | string or null | yes | Password to authenticate with. Null in list responses; returned by Get a Proxy IPv6 plan. Treat it as a secret. |
| `items[].proxy6.host` | string | yes | Host name to connect to. |
| `items[].proxy6.ports` | object | yes | Ports of the connection host. |
| `items[].proxy6.addresses` | integer | yes | Number of IPv6 addresses currently assigned to the plan. |
| `items[].proxy6.current_addr` | string or null | yes | Current outgoing address of a rotating plan. Null for static plans. |
| `items[].proxy6.turns_total` | integer | yes | Rotations included in the current period (rotating plans). |
| `items[].proxy6.turns_used` | integer | yes | Rotations already used in the current period. |
| `items[].proxy6.turns_left` | integer | yes | Rotations still available in the current period. |
| `items[].proxy6.exhausted` | boolean | yes | True when all rotations are used. Renew the plan to get more. |
| `items[].proxy6.exhausted_at` | integer or null | yes | When the rotations ran out, or null if they have not (Unix time, seconds, UTC) |
| `items[].proxy6.rotate_interval_s` | integer | yes | Automatic rotation interval in seconds; 0 means automatic rotation is off. |
| `items[].proxy6.next_rotate_at` | integer or null | yes | When the next automatic rotation happens, or null when automatic rotation is off (Unix time, seconds, UTC) |
| `items[].proxy6.last_rotated_at` | integer or null | yes | When the address last changed, or null if it never did (Unix time, seconds, UTC) |
| `items[].proxy6.rotate_path` | string or null | yes | Path of the public rotation link. Always null in responses to API keys. |

Example:

```json
{
  "items": [
    {
      "activated_at": 1791000008,
      "addons": [],
      "auto_renew": true,
      "bandwidth_gb": 0,
      "canceled_at": null,
      "created_at": 1791000000,
      "cycle": "weekly",
      "expires_at": 1791604800,
      "fail_reason": null,
      "hidden_at": null,
      "id": 2087,
      "ip_count": 100,
      "ip_released_at": null,
      "ip_version": "ipv6",
      "monthly_uusd": 5769230,
      "months": 0,
      "period_days": 7,
      "proxy6": {
        "addresses": 100,
        "count": 100,
        "current_addr": null,
        "device_addons": 0,
        "devices": 0,
        "devices_locked": [],
        "exhausted": false,
        "exhausted_at": null,
        "host": "proxy.example.com",
        "kind": "static",
        "last_rotated_at": null,
        "mbps": 100,
        "mbps_addons": 0,
        "next_rotate_at": null,
        "password": null,
        "plan": "static-100",
        "ports": {
          "http": 80,
          "https": 443,
          "socks5": 443,
          "static_from": 60001,
          "static_to": 60100
        },
        "rotate_interval_s": 0,
        "rotate_path": null,
        "turns_left": 0,
        "turns_total": 0,
        "turns_used": 0,
        "username": "p6k3m9x2pq"
      },
      "renew_cents": 180,
      "renew_max_periods": 12,
      "renewable": true,
      "status": "active",
      "tier": "dedicated",
      "total_uusd": 1802884
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one Proxy IPv6 plan (with password)

`GET /v1/proxy6/subscriptions/{id}`

Returns one Proxy IPv6 plan including the connection **password** (`proxy6.password`), so this response is sensitive. With `proxy6.host`, `proxy6.ports`, `proxy6.username` and the password you can configure any HTTP or SOCKS5 client; traffic leaves over IPv6 only, destinations must have an IPv6 address and outgoing connections to the mail ports 25, 465, 587 and 2525 are refused. The 50 most recent renewals are included.

A static plan gives a fixed set of addresses, listed by [List Proxy IPv6 addresses](#operation/proxy6_ip_list). A rotating plan exposes its current address in `proxy6.current_addr`. `proxy6.rotate_path` is always `null` in responses to API keys. An id that belongs to another account, or to a VPN IPv4 plan, returns `404`.

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `proxy6 subscription get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier, as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | Proxy6Subscription | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string: `shared`, `private`, `dedicated` | yes | Always `dedicated` for Proxy IPv6 plans. |
| `subscription.ip_count` | integer | yes | Size of the plan: the number of IPv6 addresses of a static plan, the number of rotations per period of a rotating plan, and 0 for an unlimited plan. |
| `subscription.bandwidth_gb` | integer | yes | Always 0: traffic is not metered per plan. |
| `subscription.cycle` | string | yes | Billing cycle chosen at purchase, for example `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes | Add-ons bought with the plan. |
| `subscription.monthly_uusd` | integer | yes | Price per month in millionths of a US dollar, as sold. |
| `subscription.total_uusd` | integer | yes | Price of one full billing period in millionths of a US dollar, as sold. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | `pending`: payment is being confirmed. `active`: usable. `expired`: ended; it can still be renewed while the IP addresses are held (see `keep_until`). `canceled` and `failed`: ended for good. |
| `subscription.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | When the current paid period ends (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Length of one billing period in months. 0 for plans billed per day or per week (see `period_days`). |
| `subscription.renew_cents` | integer | yes | Price of renewing one billing period, in US cents. It is fixed when the plan is bought. |
| `subscription.renew_max_periods` | integer | yes | Largest number of billing periods that can be paid in a single renewal. |
| `subscription.period_days` | integer | yes | Length of one billing period in days for plans billed per day or per week; 0 when billing follows calendar months (`months`). |
| `subscription.activated_at` | integer or null | yes | When the plan became active, or null if it never did (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short machine-readable reason when the plan is `canceled` or `failed` (for example `not_charged` or `refunded`); null otherwise. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled or failed, or null otherwise (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool, or null while the plan still holds them (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When you removed the plan from your list, or null otherwise. Removed plans are only returned with `include_hidden` (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed now (it is `active`, or `expired` and still holds its IP addresses). |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet balance shortly before it ends. Always false for plans that can no longer be renewed. |
| `subscription.keep_until` | integer or null | no | For an `expired` plan that still holds its IP addresses: the time after which they are released unless the plan is renewed. Null otherwise (Unix time, seconds, UTC) |
| `subscription.ip_version` | string | yes | Always `ipv6`. |
| `subscription.proxy6` | object | yes | Connection details and rotation state of the Proxy IPv6 plan. |
| `subscription.proxy6.kind` | string: `static`, `rotate`, `unlimited` | yes | `static`: a fixed set of IPv6 addresses. `rotate`: one address that changes, with a limited number of rotations per period. `unlimited`: one address that changes, with unlimited rotations. |
| `subscription.proxy6.plan` | string | yes | Slug of the plan that was bought, for example `static-100`. |
| `subscription.proxy6.count` | integer | yes | Plan size: number of addresses (`static`), rotations per period (`rotate`), or 0 (`unlimited`). |
| `subscription.proxy6.mbps` | integer | yes | Bandwidth cap of the plan in Mbit/s, including bought add-ons. |
| `subscription.proxy6.mbps_addons` | integer | yes | Number of bandwidth add-ons bought with the plan. |
| `subscription.proxy6.devices` | integer | yes | Number of client source IP addresses the plan can be used from. The first sources that connect are locked to the plan and other sources are refused; 0 means no limit. |
| `subscription.proxy6.device_addons` | integer | yes | Number of extra-device add-ons bought with the plan. |
| `subscription.proxy6.devices_locked` | array of string | yes | Source IP addresses currently locked to the plan. They can be released in the dashboard. |
| `subscription.proxy6.username` | string | yes | User name to authenticate with. |
| `subscription.proxy6.password` | string or null | yes | Password to authenticate with. Null in list responses; returned by Get a Proxy IPv6 plan. Treat it as a secret. |
| `subscription.proxy6.host` | string | yes | Host name to connect to. |
| `subscription.proxy6.ports` | object | yes | Ports of the connection host. |
| `subscription.proxy6.addresses` | integer | yes | Number of IPv6 addresses currently assigned to the plan. |
| `subscription.proxy6.current_addr` | string or null | yes | Current outgoing address of a rotating plan. Null for static plans. |
| `subscription.proxy6.turns_total` | integer | yes | Rotations included in the current period (rotating plans). |
| `subscription.proxy6.turns_used` | integer | yes | Rotations already used in the current period. |
| `subscription.proxy6.turns_left` | integer | yes | Rotations still available in the current period. |
| `subscription.proxy6.exhausted` | boolean | yes | True when all rotations are used. Renew the plan to get more. |
| `subscription.proxy6.exhausted_at` | integer or null | yes | When the rotations ran out, or null if they have not (Unix time, seconds, UTC) |
| `subscription.proxy6.rotate_interval_s` | integer | yes | Automatic rotation interval in seconds; 0 means automatic rotation is off. |
| `subscription.proxy6.next_rotate_at` | integer or null | yes | When the next automatic rotation happens, or null when automatic rotation is off (Unix time, seconds, UTC) |
| `subscription.proxy6.last_rotated_at` | integer or null | yes | When the address last changed, or null if it never did (Unix time, seconds, UTC) |
| `subscription.proxy6.rotate_path` | string or null | yes | Path of the public rotation link. Always null in responses to API keys. |
| `renewals` | array of VpnPlanRenewal | yes |  |
| `renewals[].id` | integer | yes | Renewal identifier. |
| `renewals[].seq` | integer | yes | Sequence number of the renewal within the plan, starting at 1. |
| `renewals[].periods` | integer | yes | Number of billing periods paid. |
| `renewals[].months` | integer | yes | Months added by the renewal (0 for plans billed per day or per week). |
| `renewals[].charged_cents` | integer | yes | Amount charged from the wallet, in US cents. |
| `renewals[].from` | integer | yes | Expiry before the renewal (Unix time, seconds, UTC) |
| `renewals[].to` | integer | yes | Expiry after the renewal (Unix time, seconds, UTC) |
| `renewals[].status` | string: `pending`, `done`, `failed`, `canceled` | yes | `done` once applied; `failed` and `canceled` renewals are refunded. |
| `renewals[].created_at` | integer | yes | When the renewal was requested (Unix time, seconds, UTC) |

Example:

```json
{
  "renewals": [],
  "subscription": {
    "activated_at": 1791000008,
    "addons": [],
    "auto_renew": true,
    "bandwidth_gb": 0,
    "canceled_at": null,
    "created_at": 1791000000,
    "cycle": "weekly",
    "expires_at": 1791604800,
    "fail_reason": null,
    "hidden_at": null,
    "id": 2087,
    "ip_count": 100,
    "ip_released_at": null,
    "ip_version": "ipv6",
    "keep_until": null,
    "monthly_uusd": 5769230,
    "months": 0,
    "period_days": 7,
    "proxy6": {
      "addresses": 100,
      "count": 100,
      "current_addr": null,
      "device_addons": 0,
      "devices": 0,
      "devices_locked": [],
      "exhausted": false,
      "exhausted_at": null,
      "host": "proxy.example.com",
      "kind": "static",
      "last_rotated_at": null,
      "mbps": 100,
      "mbps_addons": 0,
      "next_rotate_at": null,
      "password": "Qm7xT3vRb8LkP2nZ",
      "plan": "static-100",
      "ports": {
        "http": 80,
        "https": 443,
        "socks5": 443,
        "static_from": 60001,
        "static_to": 60100
      },
      "rotate_interval_s": 0,
      "rotate_path": null,
      "turns_left": 0,
      "turns_total": 0,
      "turns_used": 0,
      "username": "p6k3m9x2pq"
    },
    "renew_cents": 180,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 1802884
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### IPv6 addresses of the plan (paged)

`GET /v1/proxy6/subscriptions/{id}/ips`

Returns the IPv6 addresses currently assigned to a Proxy IPv6 plan, ordered by `slot`, together with the user name (and, on static plans, the dedicated port) that selects each address. A static plan has one address per slot; a rotating plan has a single address in slot 1.

`history` lists the latest address changes of a rotating plan (up to 50, newest first) and is empty for static plans. A page number beyond the last page returns an empty `items` array.

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `proxy6 ip list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier, as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Proxy6Address | yes |  |
| `items[].slot` | integer | yes | Position of the address in the plan, starting at 1. |
| `items[].addr` | string | yes | IPv6 address. |
| `items[].net64` | string | yes | The network the address is reserved under: its /64 (for example `2001:db8:5a1:7c3::/64`), or the address itself with `/128` when the plan is served from a single /64. |
| `items[].port` | integer or null | yes | Advanced, optional: dedicated port of the address on a static plan (`ports.static_from + slot - 1`, base user name). Normal use is the shared ports with the `user` name of this address. Null for other plan types. |
| `items[].user` | string | yes | User name that selects this address. On a static plan it is `<username>-<slot>`; otherwise the plan user name. |
| `items[].since` | integer | yes | When the address was assigned (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `history` | array of Proxy6Rotation | yes |  |
| `history[].slot` | integer | yes | Slot of the address that changed. |
| `history[].old_addr` | string or null | yes | Address before the change. |
| `history[].new_addr` | string or null | yes | Address after the change. Null when the rotations ran out. |
| `history[].reason` | string | yes | Why the address changed: `manual`, `link`, `interval`, `topup` or `exhausted`. |
| `history[].created_at` | integer | yes | When the change happened (Unix time, seconds, UTC) |

Example:

```json
{
  "history": [
    {
      "created_at": 1791300100,
      "new_addr": "2001:db8:5a1:7c3::1f",
      "old_addr": "2001:db8:5a1:1b2::9",
      "reason": "manual",
      "slot": 1
    },
    {
      "created_at": 1791299800,
      "new_addr": "2001:db8:5a1:1b2::9",
      "old_addr": "2001:db8:5a1:44d::3",
      "reason": "interval",
      "slot": 1
    }
  ],
  "items": [
    {
      "addr": "2001:db8:5a1:7c3::1f",
      "net64": "2001:db8:5a1:7c3::/64",
      "port": null,
      "since": 1791300100,
      "slot": 1,
      "user": "p6k3m9x2pq"
    }
  ],
  "page": 1,
  "per_page": 50,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/ips" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### The key revokes itself (app log out)

`DELETE /v1/ext/session`

Revokes the API key that makes the call, immediately and permanently. Apps use it as a "log out" button: the next request with the same key fails with `401`. Only the calling key is affected; other keys and dashboard sessions stay valid, and the revoked key stays listed as revoked on the API Keys page.

Call it with an API key. A dashboard session is refused with `403 key_required`.

**Required scope:** `vpn:read`.

Scope: `vpn:read` | CLI: `vpn session revoke` | Destructive or costs money

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `key_required` | The call was not made with an API key (for example it used a dashboard session). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/ext/session" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Account token (appAccountToken) + Apple In-App Purchase top-up products

`GET /v1/ext/iap/apple/token`

For the VPN app for iPhone. Returns the fixed `app_account_token` of your account and the wallet top-up products sold through Apple In-App Purchase. Pass the token to StoreKit (`purchase(options: [.appAccountToken(uuid)])`) so the signed transaction is bound to your account; it never changes and does not reveal your account id.

`credit_cents` is what one unit of the product adds to the wallet (US cents). `enabled` tells the app whether to offer purchases; transactions already paid are still credited when it is `false`. Only available on the main site (`403 iap_unavailable` on reseller sites).

**Required scope:** `wallet:iap`.

Scope: `wallet:iap` | CLI: `vpn iap token`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `app_account_token` | string | yes | UUID to pass to StoreKit as appAccountToken (lower case). |
| `products` | array of object | yes |  |
| `products[].id` | string | yes | App Store product id (consumable). |
| `products[].credit_cents` | integer | yes | Wallet credit per unit, in US cents. |
| `enabled` | boolean | yes | Whether the app should offer Apple In-App Purchase top-ups. |

Example:

```json
{
  "app_account_token": "3f2b8c1e-7d4a-4b9e-a6c2-91d0e5f4b7a3",
  "enabled": true,
  "products": [
    {
      "credit_cents": 1000,
      "id": "net.example.vpn.topup.10"
    },
    {
      "credit_cents": 2000,
      "id": "net.example.vpn.topup.20"
    },
    {
      "credit_cents": 5000,
      "id": "net.example.vpn.topup.50"
    },
    {
      "credit_cents": 10000,
      "id": "net.example.vpn.topup.100"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `iap_unavailable` | In-App Purchase is not available on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/ext/iap/apple/token" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Submit a signed Apple In-App Purchase transaction to credit the wallet (idempotent per transactionId)

`POST /v1/ext/iap/apple/transactions`

For the VPN app for iPhone. Submit a StoreKit 2 transaction (`Transaction.jwsRepresentation`) after an Apple In-App Purchase to credit the wallet. The server verifies the Apple signature offline (certificate chain up to Apple Root CA - G3), the bundle id, the product, the `appAccountToken` (must be yours) and that the transaction was not refunded. Call `finish()` on the transaction after a `200`.

Idempotent per Apple `transactionId`: submitting the same transaction again returns `200` with `replayed: true` and `credited_cents: 0`. A real top-up runs exactly like a card top-up (invoice, receipt e-mail, and it activates the trial credit when it qualifies — see `trial`). Sandbox transactions (TestFlight, App Review) are credited only for accounts the site owner allowed and never count as a real top-up.

**Required scope:** `wallet:iap`.

Scope: `wallet:iap` | CLI: `vpn iap submit`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `signed_transaction` | string | yes | JWS from StoreKit 2 `Transaction.jwsRepresentation`. |

Example:

```json
{
  "signed_transaction": "eyJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlF...In0.eyJ0cmFuc2FjdGlvbklkIjoi...In0.MEUCIQ..."
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `credited_cents` | integer | yes | Amount added to the wallet by this call, in US cents (0 when replayed). |
| `balance_cents` | integer | yes | Wallet balance after the call, in US cents. |
| `replayed` | boolean | yes | True when this transaction had already been credited. |
| `environment` | string: `Production`, `Sandbox` | yes | App Store environment of the transaction. |
| `transaction_id` | string | yes | Apple transactionId. |
| `trial` | object or null | yes |  |
| `trial.status` | string: `none`, `pending`, `active`, `used_up`, `expired` | yes | State of the trial credit (see `GET /v1/billing/trial`). |
| `trial.amount_cents` | integer | yes | Trial credit granted, in US cents. |
| `trial.left_cents` | integer | yes | Trial credit still available, in US cents. |
| `trial.expires_at` | integer or null | yes | Time the trial credit expires (Unix time, seconds, UTC) |

Example:

```json
{
  "balance_cents": 1000,
  "credited_cents": 1000,
  "environment": "Production",
  "replayed": false,
  "transaction_id": "2000000812345678",
  "trial": {
    "amount_cents": 10000,
    "expires_at": 1795000000,
    "left_cents": 10000,
    "status": "active"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_signature` | The transaction is not signed by Apple (bad chain, expired certificate, wrong OID or signature). |
| 403 | `account_mismatch` | The transaction's appAccountToken belongs to another account. |
| 403 | `sandbox_not_allowed` | Sandbox purchase from an account that is not allowed to use Sandbox. |
| 409 | `transaction_revoked` | Apple refunded or revoked the transaction. |
| 422 | `unknown_product` | The product is not a wallet top-up product of this site. |
| 422 | `bundle_mismatch` | The transaction belongs to another app. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/ext/iap/apple/transactions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"signed_transaction":"eyJhbGciOiJFUzI1NiIsIng1YyI6WyJNSUlF...In0.eyJ0cmFuc2FjdGlvbklkIjoi...In0.MEUCIQ..."}'
```

---

#### Download the connection list (SOCKS5/HTTP, plain, Clash, sing-box, v2rayN)

`GET /v1/vpn/subscriptions/{id}/config`

Downloads the connection list of the plan as a plain-text file in the chosen format. The file contains the user name and password of every active endpoint, so treat it like a secret. Formats: `socks` / `http` (URL lines), `socks_plain` / `http_plain` (`host:port:user:pass` lines for scraping and anti-detect tools), `json`, `clash`, `singbox` and `v2rayn` (base64 subscription).

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription config`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `format` | string: `socks`, `http`, `socks_plain`, `http_plain`, `json`, `clash`, `singbox`, `v2rayn` | no | Output format. |

**Response 200** - Success.

Content type: `text/plain`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `format` is not one of the supported formats. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/config" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Real traffic chart and usage of a VPN IPv4 plan

`GET /v1/vpn/subscriptions/{id}/traffic`

Returns real traffic of the plan: a time series for charting, the latest rate, the usage of the current billing period against the quota, and the busiest endpoints. Minute buckets are available for `1h` and `6h`, hourly buckets for `24h`, `7d` and `30d`, daily buckets for `month` (last 30 days) and monthly buckets for `all` (all time, with the usage of each past billing period in `periods`). Minute data is kept for 48 hours and hourly data for 40 days; `data_from` tells where the series really starts. The `live` rate is an average over the last stored minute. Limited to 30 calls per minute per account.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription traffic`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d`, `month`, `all` | no | Time range of the series. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d`, `month`, `all` | yes | The range that was returned. |
| `granularity` | string: `minute`, `hour`, `day`, `month` | no | Bucket size of `series`. |
| `data_from` | integer or null | no | Earliest sample kept at this granularity: when the requested range is longer than the data kept, the series starts here. (Unix time, seconds, UTC) |
| `metering` | string: `directional`, `combined` | yes | `combined` when the plan has an IP that only counts total traffic: then `series` is empty, `live` is null and only totals are returned (no download/upload split). |
| `bucket_secs` | integer | yes | Nominal length of one series bucket in seconds (60 for 1h and 6h, 3600 for 24h, 7d and 30d, 86400 for month, about 30 days for all). |
| `series` | array of object | yes |  |
| `series[].t` | integer | yes | Bucket start (Unix time, seconds, UTC) |
| `series[].rx_bps` | number | yes | Average download rate in bits per second. |
| `series[].tx_bps` | number | yes | Average upload rate in bits per second. |
| `series[].conns` | integer | yes | Connections seen in the bucket. |
| `series[].peak_rx_bps` | number | no | Highest download rate seen in the bucket, in bits per second (equals the average for minute and hour buckets). |
| `series[].peak_tx_bps` | number | no | Highest upload rate seen in the bucket, in bits per second. |
| `series[].rx_bytes` | integer | no | Bytes downloaded in the bucket. |
| `series[].tx_bytes` | integer | no | Bytes uploaded in the bucket. |
| `live` | object or null | yes |  |
| `live.rx_bps` | number | yes | Latest download rate in bits per second. |
| `live.tx_bps` | number | yes | Latest upload rate in bits per second. |
| `live.conns` | integer | yes | Latest connection count. |
| `live.at` | integer or null | yes | Time of the latest sample (Unix time, seconds, UTC) |
| `live.window_secs` | integer | no | Length of the sample: the rates are an average over this many seconds (60), not an instantaneous speed. |
| `live.age_secs` | integer or null | no | Age of the latest sample in seconds. |
| `usage` | object | yes |  |
| `usage.period_start` | integer | yes | Start of the current billing period (Unix time, seconds, UTC) |
| `usage.period_end` | integer | yes | End of the current billing period (Unix time, seconds, UTC) |
| `usage.rx_bytes` | integer | no | Bytes downloaded in the period (`directional` only). |
| `usage.tx_bytes` | integer | no | Bytes uploaded in the period (`directional` only). |
| `usage.total_bytes` | integer | yes | Total bytes in the period. |
| `usage.quota_bytes` | integer | yes | Quota in bytes, 0 when unlimited. |
| `usage.pct` | number | yes | Share of the quota used, in percent (0 when unlimited). |
| `endpoints` | array of object | yes |  |
| `endpoints[].id` | integer | yes | Endpoint identifier. |
| `endpoints[].ip` | string | yes | Endpoint IP address. |
| `endpoints[].rx_bytes` | integer | no | Bytes downloaded through this endpoint in the period (`directional` only). |
| `endpoints[].tx_bytes` | integer | no | Bytes uploaded through this endpoint in the period (`directional` only). |
| `endpoints[].total_bytes` | integer | yes | Total bytes through this endpoint in the period. |
| `endpoints[].last_seen` | integer or null | yes | `directional`: last time the endpoint carried traffic. `combined`: when the counters were last read (Unix time, seconds, UTC) |
| `periods` | array of object | no |  |
| `periods[].period_start` | integer | yes | Start of the billing period (Unix time, seconds, UTC) |
| `periods[].period_end` | integer | yes | End of the billing period (Unix time, seconds, UTC) |
| `periods[].rx_bytes` | integer | yes | Bytes downloaded in the period. |
| `periods[].tx_bytes` | integer | yes | Bytes uploaded in the period. |
| `periods[].total_bytes` | integer | yes | Total bytes in the period. |

Example:

```json
{
  "bucket_secs": 3600,
  "data_from": 1757500000,
  "endpoints": [
    {
      "id": 31,
      "ip": "198.51.100.71",
      "last_seen": 1760003500,
      "rx_bytes": 30000000,
      "total_bytes": 35000000,
      "tx_bytes": 5000000
    }
  ],
  "granularity": "hour",
  "live": {
    "age_secs": 20,
    "at": 1760003540,
    "conns": 7,
    "rx_bps": 900000.0,
    "tx_bps": 120000.0,
    "window_secs": 60
  },
  "metering": "directional",
  "range": "24h",
  "series": [
    {
      "conns": 18,
      "peak_rx_bps": 1250000.0,
      "peak_tx_bps": 340000.0,
      "rx_bps": 1250000.0,
      "rx_bytes": 562500000,
      "t": 1760000000,
      "tx_bps": 340000.0,
      "tx_bytes": 153000000
    }
  ],
  "usage": {
    "pct": 0.03,
    "period_end": 1762492000,
    "period_start": 1759900000,
    "quota_bytes": 250000000000,
    "rx_bytes": 52428800,
    "total_bytes": 62914560,
    "tx_bytes": 10485760
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `range` is not one of 1h, 6h, 24h, 7d, 30d, month, all. |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/traffic" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth tiers you can upgrade to, with prices

`GET /v1/vpn/subscriptions/{id}/bandwidth`

Lists the bandwidth tiers you can upgrade this plan to, with the amount that would be charged now (prorated for the days left) and the renewal price afterwards. `can_upgrade` is false, with a `reason`, when the plan cannot be upgraded right now. Use [Upgrade bandwidth](#operation/vpn_subscription_upgrade_bandwidth) to buy a tier.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription bandwidth`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `current_gb` | integer | yes | Current quota in GB (0 = unlimited). |
| `options` | array of object | yes |  |
| `options[].gb` | integer | yes | Quota of the tier in GB. |
| `options[].label` | string | yes | Display label of the tier. |
| `options[].adder_month_uusd` | integer | yes | Monthly price of the tier in millionths of a US dollar. |
| `options[].charge_now_cents` | integer | yes | Amount charged now in US cents, prorated for the remaining days. |
| `options[].new_renew_cents` | integer | yes | Renewal price per period after the upgrade, in US cents. |
| `options[].days_left` | integer | yes | Days left in the current period. |
| `can_upgrade` | boolean | yes | Whether an upgrade is possible now. |
| `reason` | string or null | yes | Why not: `feature_disabled`, `tenant_unavailable`, `not_active`, `expired`, `in_progress` or `no_higher_tier`. |

Example:

```json
{
  "can_upgrade": true,
  "current_gb": 250,
  "options": [
    {
      "adder_month_uusd": 13460000,
      "charge_now_cents": 1077,
      "days_left": 24,
      "gb": 1000,
      "label": "1000 GB",
      "new_renew_cents": 2186
    }
  ],
  "reason": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Active add-ons and add-ons you can still buy, with mid-term prices

`GET /v1/vpn/subscriptions/{id}/addons`

Lists the add-ons currently active on the plan and the add-ons you can still buy, with the prorated price of adding each one now. `can_add` is false, with a `reason`, when add-ons cannot be bought right now.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription addons`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `current_addons` | array of string | yes |  |
| `available` | array of object | yes |  |
| `available[].key` | string | yes | Add-on key to pass to the add call. |
| `available[].name` | string | yes | Display name. |
| `available[].uusd_month` | integer | yes | Monthly price in millionths of a US dollar. |
| `available[].days_left` | integer | yes | Days left in the current period. |
| `available[].charge_now_cents` | integer | yes | Amount charged now in US cents, prorated for the remaining days. |
| `can_add` | boolean | yes | Whether add-ons can be bought now. |
| `reason` | string or null | yes | Why not, when `can_add` is false. |

Example:

```json
{
  "available": [
    {
      "charge_now_cents": 807,
      "days_left": 24,
      "key": "concurrency",
      "name": "High Concurrency",
      "uusd_month": 10090000
    }
  ],
  "can_add": true,
  "current_addons": [
    "ipauth"
  ],
  "reason": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/addons" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### IPs authorized to use the plan without user and password

`GET /v1/vpn/subscriptions/{id}/auth-ips`

Returns the IP addresses and networks that may use the plan without a user name and password. The limit is 3 entries, or 1000 with the `ipauth` add-on.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription auth-ips`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of string | yes |  |
| `limit` | integer | yes | Maximum number of entries. |

Example:

```json
{
  "items": [
    "203.0.113.5/32"
  ],
  "limit": 3
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/auth-ips" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Blacklist reports you filed for the plan's IPs

`GET /v1/vpn/subscriptions/{id}/ip-reports`

Lists the blacklist reports you filed for the IP addresses of the plan, newest first (up to 100). Use [Report IPs](#operation/vpn_subscription_report_ip) to file one.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription reports`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpnIpReport | yes |  |
| `items[].id` | integer | yes | Report identifier. |
| `items[].subscription_id` | integer | yes | Plan the report belongs to. |
| `items[].endpoint_id` | integer | yes | Endpoint (IP) the report is about. |
| `items[].ip` | string | yes | The reported IP address. |
| `items[].zone_id` | integer or null | yes | Location of the IP. |
| `items[].reason` | string: `dnsbl`, `site_block`, `other` | yes | Why the IP is reported. |
| `items[].site` | string or null | yes | Site that blocks the IP, for `site_block` reports. |
| `items[].note` | string or null | yes | Free-text description. |
| `items[].dnsbl_status` | string or null | yes | Result of the blacklist check run at report time: `clean`, `listed` or `unknown`. |
| `items[].dnsbl_lists` | array of string | yes |  |
| `items[].status` | string: `open`, `replaced`, `rejected` | yes | `open` while waiting for review, `replaced` when a clean IP was swapped in, `rejected` when the request was declined. |
| `items[].new_ip` | string or null | yes | The replacement IP, once replaced. |
| `items[].admin_note` | string or null | yes | Message from the reviewer, shown when a report is rejected or replaced. |
| `items[].decided_at` | integer or null | yes | When the report was reviewed (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the report was filed (Unix time, seconds, UTC) |
| `max_open` | integer | yes | Maximum number of open reports per plan. |

Example:

```json
{
  "items": [
    {
      "admin_note": null,
      "created_at": 1760001000,
      "decided_at": null,
      "dnsbl_lists": [
        "zen.example-rbl.org"
      ],
      "dnsbl_status": "listed",
      "endpoint_id": 31,
      "id": 4,
      "ip": "198.51.100.71",
      "new_ip": null,
      "note": "Mail rejected by a blocklist",
      "reason": "dnsbl",
      "site": null,
      "status": "open",
      "subscription_id": 12,
      "zone_id": 1
    }
  ],
  "max_open": 10
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/ip-reports" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Preview of canceling a VPN IPv4 plan

`GET /v1/vpn/subscriptions/{id}/cancel-preview`

Shows what canceling the plan would do, without changing anything: whether it can be canceled, how many IPs would be released, and that no refund is given.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `vpn subscription cancel-preview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `can_cancel` | boolean | yes | Whether the plan can be canceled now. |
| `reason` | string or null | yes | Why it cannot be canceled, when `can_cancel` is false. |
| `refund_cents` | integer | yes | Always 0: canceling never refunds. |
| `ips_released` | integer | yes | Number of IP addresses that would go back to the pool. |
| `expires_at` | integer | yes | Current expiry of the plan (Unix time, seconds, UTC) |
| `status` | string | yes | Current plan status. |
| `can_hide` | boolean | yes | Whether the plan can be removed from your list (canceled or expired, IPs already released). |
| `keep_until` | integer or null | yes | For expired plans: when the IPs will be released (Unix time, seconds, UTC) |

Example:

```json
{
  "can_cancel": true,
  "can_hide": false,
  "expires_at": 1762592000,
  "ips_released": 2,
  "keep_until": null,
  "reason": null,
  "refund_cents": 0,
  "status": "active"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/cancel-preview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Invoices that belong to a VPN IPv4 plan

`GET /v1/vpn/subscriptions/{id}/billing`

Lists every invoice that belongs to the plan: purchase, renewals, bandwidth upgrades and add-ons, newest first. Invoices issued to a previous owner (after a transfer) are marked `previous_owner` and their buyer details are redacted.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `vpn subscription billing`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `invoices` | array of VpnPlanInvoice | yes |  |
| `invoices[].id` | integer | yes | Invoice identifier. |
| `invoices[].number` | string or null | yes | Human-readable invoice number. |
| `invoices[].account_id` | integer or null | yes | Your account id, or null on invoices issued to a previous owner of the plan. |
| `invoices[].vm_id` | string or null | yes | Always null for plan invoices. |
| `invoices[].kind` | string | yes | Invoice kind, e.g. `receipt`. |
| `invoices[].status` | string | yes | Invoice status, e.g. `paid`. |
| `invoices[].subtotal_cents` | integer | yes | Subtotal in US cents. |
| `invoices[].total_cents` | integer | yes | Total in US cents. |
| `invoices[].currency` | string | yes | Currency code of the amounts. |
| `invoices[].due_at` | integer or null | yes | Due time (Unix time, seconds, UTC) |
| `invoices[].paid_at` | integer or null | yes | Payment time (Unix time, seconds, UTC) |
| `invoices[].ledger_ref` | string or null | yes | Wallet ledger reference. |
| `invoices[].seller_json` | string | yes | Seller details as a JSON string. |
| `invoices[].buyer_json` | string | yes | Buyer details as a JSON string (redacted on invoices issued to a previous owner). |
| `invoices[].note` | string or null | yes | Invoice note. |
| `invoices[].created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `invoices[].updated_at` | integer | yes | Last update time (Unix time, seconds, UTC) |
| `invoices[].previous_owner` | boolean | no | Present and true on invoices issued before the plan was transferred to you. |

Example:

```json
{
  "invoices": [
    {
      "account_id": 5,
      "buyer_json": "{}",
      "created_at": 1760000020,
      "currency": "USD",
      "due_at": null,
      "id": 77,
      "kind": "receipt",
      "ledger_ref": "vpn-buy-12",
      "note": null,
      "number": "INV-000077",
      "paid_at": 1760000020,
      "seller_json": "{}",
      "status": "paid",
      "subtotal_cents": 840,
      "total_cents": 840,
      "updated_at": 1760000020,
      "vm_id": null
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vpn/subscriptions/<id>/billing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Replace the list of authorized IPs of a plan

`PUT /v1/vpn/subscriptions/{id}/auth-ips`

Replaces the whole list of authorized IPs. Addresses and networks must be valid CIDR; networks wider than /16 (IPv4) or /32 (IPv6) are rejected, and so is a list longer than the limit (3, or 1000 with the `ipauth` add-on). Nothing is saved when any entry is invalid. Anyone connecting from an authorized address can use the proxies without credentials, so keep the list short. Which protocols work without a password depends on the IP: see `capabilities.ip_auth_protocols` of each endpoint (an IP that lists only `http` still needs the username and password for SOCKS5).

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `vpn subscription set-auth-ips` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cidrs` | array of string | yes | The complete new list. An empty list removes all authorizations. |

Example:

```json
{
  "cidrs": [
    "203.0.113.5",
    "198.51.100.0/24"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of string | yes |  |
| `limit` | integer | yes | Maximum number of entries. |

Example:

```json
{
  "items": [
    "198.51.100.0/24",
    "203.0.113.5/32"
  ],
  "limit": 3
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `auth_ips_invalid` | An entry is not a valid address, or the network is too wide. |
| 422 | `auth_ips_limit` | The list is longer than the allowed limit. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/vpn/subscriptions/<id>/auth-ips" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidrs":["203.0.113.5","198.51.100.0/24"]}'
```

---

#### Turn auto-renew on or off (turning it on can renew from the wallet at once)

`PUT /v1/vpn/subscriptions/{id}/auto-renew`

Turns auto-renew on or off. When on, the plan renews itself from the wallet shortly before it expires (and during the grace period after expiry). Turning it on for a plan that is already due renews it immediately; `renew` then reports what happened. Turning it off always works.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `vpn subscription set-auto-renew`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | yes | `true` to renew automatically, `false` to stop. |

Example:

```json
{
  "enabled": true
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `changed` | boolean | yes | Whether the setting was different from before. |
| `renew` | string or null: `renewed`, `replayed`, `no_funds`, `skipped`, `failed` | yes | Outcome of the immediate renewal, or null when none was attempted. |

Example:

```json
{
  "changed": true,
  "renew": null,
  "subscription": {
    "activated_at": 1760000020,
    "addons": [
      "ipauth"
    ],
    "auto_renew": true,
    "bandwidth_gb": 250,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": null,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 8400000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_renewable` | Auto-renew cannot be turned on for a plan that can no longer be renewed. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/vpn/subscriptions/<id>/auto-renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true}'
```

---

#### Schedule removal of add-ons at the next renewal (no refund)

`POST /v1/vpn/subscriptions/{id}/addons/remove`

Schedules add-ons for removal at the next renewal. Nothing is refunded and the add-ons keep working until the plan renews. Send an empty list to cancel a scheduled removal.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `vpn subscription remove-addons` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `remove` | array of string | no | Keys of the add-ons to remove. Empty to clear the scheduled removal. |

Example:

```json
{
  "remove": [
    "concurrency"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `pending_remove` | array of string | yes |  |

Example:

```json
{
  "pending_remove": [
    "concurrency"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/addons/remove" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"remove":["concurrency"]}'
```

---

#### Report blacklisted IPs of a plan for replacement

`POST /v1/vpn/subscriptions/{id}/ip-reports`

Reports IP addresses of the plan that are blacklisted or blocked by a site, asking for replacements. Each IP is checked against public blacklists immediately and the result is attached to the report. A reviewer then replaces the IP with a clean one in the same location (no charge) or rejects the report with a reason. Limits: one open report per IP and at most 10 open reports per plan. The call can take several seconds because the blacklist lookup runs live. Send an `Idempotency-Key` to retry safely.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `vpn subscription report-ip`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `endpoint_ids` | array of integer | yes | Endpoints (IPs) to report, 1 to 10 of them. |
| `reason` | string: `dnsbl`, `site_block`, `other` | yes | Why the IPs are reported. |
| `site` | string | no | Name of the site that blocks the IP. Required in practice for `site_block`. |
| `note` | string | no | Free-text description, up to 500 characters. |

Example:

```json
{
  "endpoint_ids": [
    31
  ],
  "note": "Mail rejected by a blocklist",
  "reason": "dnsbl"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of VpnIpReport | yes |  |
| `items[].id` | integer | yes | Report identifier. |
| `items[].subscription_id` | integer | yes | Plan the report belongs to. |
| `items[].endpoint_id` | integer | yes | Endpoint (IP) the report is about. |
| `items[].ip` | string | yes | The reported IP address. |
| `items[].zone_id` | integer or null | yes | Location of the IP. |
| `items[].reason` | string: `dnsbl`, `site_block`, `other` | yes | Why the IP is reported. |
| `items[].site` | string or null | yes | Site that blocks the IP, for `site_block` reports. |
| `items[].note` | string or null | yes | Free-text description. |
| `items[].dnsbl_status` | string or null | yes | Result of the blacklist check run at report time: `clean`, `listed` or `unknown`. |
| `items[].dnsbl_lists` | array of string | yes |  |
| `items[].status` | string: `open`, `replaced`, `rejected` | yes | `open` while waiting for review, `replaced` when a clean IP was swapped in, `rejected` when the request was declined. |
| `items[].new_ip` | string or null | yes | The replacement IP, once replaced. |
| `items[].admin_note` | string or null | yes | Message from the reviewer, shown when a report is rejected or replaced. |
| `items[].decided_at` | integer or null | yes | When the report was reviewed (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the report was filed (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "admin_note": null,
      "created_at": 1760001000,
      "decided_at": null,
      "dnsbl_lists": [
        "zen.example-rbl.org"
      ],
      "dnsbl_status": "listed",
      "endpoint_id": 31,
      "id": 4,
      "ip": "198.51.100.71",
      "new_ip": null,
      "note": "Mail rejected by a blocklist",
      "reason": "dnsbl",
      "site": null,
      "status": "open",
      "subscription_id": 12,
      "zone_id": 1
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_active` | The plan is not active. |
| 409 | `report_open` | Every selected IP already has an open report. |
| 409 | `too_many_reports` | The plan already has the maximum number of open reports. |
| 409 | `conflict` | The IP changed meanwhile, or no clean replacement IP is available. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/ip-reports" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endpoint_ids":[31],"note":"Mail rejected by a blocklist","reason":"dnsbl"}'
```

---

#### Issue a new subscription-feed link (the old link dies)

`POST /v1/vpn/subscriptions/{id}/feed/rotate`

Issues a new subscription-feed link and invalidates the previous one. The feed is a public URL (no API key needed) that VPN apps download to get the plan's proxies, so anyone holding it can use the plan: treat the token as a secret and rotate it if it leaks.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `vpn subscription rotate-feed` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `token` | string | yes | The feed token. |
| `path` | string | yes | Path of the feed URL on this site, `/v1/vpn/feed/{token}`. Append `?format=v2rayn\|clash\|singbox`. |

Example:

```json
{
  "path": "/v1/vpn/feed/Zk3q9rVx0aLm2PwTnB7cYdHs5uJgEoXf",
  "token": "Zk3q9rVx0aLm2PwTnB7cYdHs5uJgEoXf"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/feed/rotate" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Buy a VPN IPv4 plan (charges the wallet)

`POST /v1/vpn/subscriptions`

Buys a VPN IPv4 plan. The price is charged to the wallet and the IP addresses are allocated and activated at once. If activation fails after payment the amount is refunded automatically. Only `dedicated` IPs are on sale. Get valid tiers, quotas and cycles from the VPN catalog first. On sites run by resellers the charge is the site's retail price. Needs the wallet to cover the price (otherwise 402).

Send an `Idempotency-Key` header: calling again with the same key returns the original purchase instead of buying twice. A `202 Accepted` answer means the payment is still being finalized; the plan appears in your list when done.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `vpn subscription buy` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `tier` | string: `dedicated`, `private`, `shared` | yes | IP type. Only `dedicated` can be bought; the others return 422 `tier_retired`. |
| `ip_count` | integer | yes | Number of IP addresses, at least 1. |
| `bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB; 0 for unlimited. Must be one of the quotas in the catalog. |
| `cycle` | string | yes | Billing cycle slug from the catalog: `daily`, `weekly`, `monthly` or `yearly`. |
| `addons` | array of string | no | Add-ons to include (at most 16). |
| `zone_id` | integer | no | Location to buy in. Omit to use the default; 422 `zone_required` lists the choices when you must pick. |
| `zone` | string | no | Location slug, as an alternative to `zone_id`. |

Example:

```json
{
  "addons": [],
  "bandwidth_gb": 250,
  "cycle": "monthly",
  "ip_count": 2,
  "tier": "dedicated"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `endpoints` | array of object | yes | The allocated endpoints; empty while the order is still pending. |
| `charged_cents` | integer | yes | Amount charged in US cents. |
| `invoice_id` | integer or null | no | Invoice identifier. |
| `invoice_number` | string or null | no | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "charged_cents": 840,
  "endpoints": [
    {
      "city": "Ho Chi Minh City",
      "country": "VN",
      "id": 31,
      "ip": "198.51.100.71",
      "password": "s3cr3t-pass",
      "port_http": 20032,
      "port_socks": 20031,
      "port_udp": 20033,
      "state": "active",
      "subscription_id": 12,
      "username": "u12a"
    }
  ],
  "invoice_id": 77,
  "invoice_number": "INV-000077",
  "subscription": {
    "activated_at": 1760000020,
    "addons": [
      "ipauth"
    ],
    "auto_renew": true,
    "bandwidth_gb": 250,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": null,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 8400000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell VPN plans. |
| 409 | `pool_exhausted` | Not enough free IP addresses; the body says whether you were charged and refunded (`charged`, `refunded`). |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `tier_retired` | That IP type is no longer sold. |
| 422 | `addon_retired` | An add-on in the order is no longer sold. |
| 422 | `zone_required` | Several locations are available; pass `zone_id`. The body lists them. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |
| 503 | `maintenance` | Orders are paused for maintenance. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"addons":[],"bandwidth_gb":250,"cycle":"monthly","ip_count":2,"tier":"dedicated"}'
```

---

#### Renew a VPN IPv4 plan (charges the wallet)

`POST /v1/vpn/subscriptions/{id}/renew`

Renews the plan for one or more periods at the price fixed when it was bought (not the current catalog price). The amount is charged to the wallet and the expiry moves forward. Active plans, and expired plans that still hold their IPs, can be renewed. Only one renewal or upgrade can be in progress at a time.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `vpn subscription renew` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `periods` | integer | no | Number of periods to buy, from 1 up to `renew_max_periods` of the plan. Defaults to 1. |

Example:

```json
{
  "periods": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `renewal` | VpnRenewal | yes |  |
| `renewal.id` | integer | yes | Renewal identifier. |
| `renewal.seq` | integer | yes | Sequence number of the renewal within the plan. |
| `renewal.periods` | integer | yes | Number of periods bought. |
| `renewal.months` | integer | yes | Months added. |
| `renewal.charged_cents` | integer | yes | Amount charged in US cents. |
| `renewal.from` | integer | yes | Previous expiry (Unix time, seconds, UTC) |
| `renewal.to` | integer | yes | New expiry (Unix time, seconds, UTC) |
| `renewal.status` | string | yes | `done`, or `pending` while the payment is being finalized. |
| `renewal.created_at` | integer | yes | When the renewal was requested (Unix time, seconds, UTC) |
| `invoice_id` | integer or null | no | Invoice identifier. |
| `invoice_number` | string or null | no | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "invoice_id": 91,
  "invoice_number": "INV-000091",
  "renewal": {
    "charged_cents": 840,
    "created_at": 1762000000,
    "from": 1762592000,
    "id": 3,
    "months": 1,
    "periods": 1,
    "seq": 1,
    "status": "done",
    "to": 1765184000
  },
  "subscription": {
    "activated_at": 1760000020,
    "addons": [
      "ipauth"
    ],
    "auto_renew": true,
    "bandwidth_gb": 250,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": null,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 8400000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell VPN plans. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_renewable` | The plan cannot be renewed in its current state. |
| 409 | `renewal_in_progress` | Another renewal of this plan is still being processed. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `periods` is out of range; the body has `max`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"periods":1}'
```

---

#### Upgrade the bandwidth tier mid-term (charges the wallet)

`POST /v1/vpn/subscriptions/{id}/bandwidth`

Upgrades the monthly bandwidth quota to a higher tier in the middle of a period. The difference is charged now, prorated for the days left, and the renewal price rises accordingly. Only higher tiers are accepted. See [List bandwidth options](#operation/vpn_subscription_bandwidth) for the available tiers and prices.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `vpn subscription upgrade-bandwidth` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `gb` | integer | yes | The new quota in GB; must be one of the tiers returned by the options call and higher than the current quota. |

Example:

```json
{
  "gb": 1000
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `upgrade` | object | yes |  |
| `upgrade.id` | integer | yes | Upgrade identifier. |
| `upgrade.seq` | integer | yes | Sequence number of the upgrade within the plan. |
| `upgrade.from_gb` | integer | yes | Previous quota in GB. |
| `upgrade.to_gb` | integer | yes | New quota in GB. |
| `upgrade.days_left` | integer | yes | Days left in the period when the upgrade was bought. |
| `upgrade.charged_cents` | integer | yes | Amount charged in US cents. |
| `upgrade.new_renew_cents` | integer | yes | Renewal price per period after the upgrade, in US cents. |
| `upgrade.status` | string | yes | `done`, or `pending` while the payment is being finalized. |
| `upgrade.created_at` | integer | yes | When the upgrade was requested (Unix time, seconds, UTC) |
| `invoice_id` | integer or null | no | Invoice identifier. |
| `invoice_number` | string or null | no | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "invoice_id": 85,
  "invoice_number": "INV-000085",
  "subscription": {
    "activated_at": 1760000020,
    "addons": [
      "ipauth"
    ],
    "auto_renew": true,
    "bandwidth_gb": 250,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": null,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 8400000
  },
  "upgrade": {
    "charged_cents": 1077,
    "created_at": 1760500000,
    "days_left": 24,
    "from_gb": 250,
    "id": 2,
    "new_renew_cents": 2186,
    "seq": 1,
    "status": "done",
    "to_gb": 1000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell VPN plans. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_upgradable` | The plan cannot be upgraded now (not active, or the tier has no price). |
| 409 | `not_higher` | The tier is not higher than the current quota. |
| 409 | `in_progress` | A renewal or upgrade of this plan is still being processed. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `gb` is not an available tier. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"gb":1000}'
```

---

#### Add features to a plan mid-term (charges the wallet)

`POST /v1/vpn/subscriptions/{id}/addons`

Adds add-ons to the plan in the middle of a period. The price is prorated for the days left and charged now; the add-ons are included in later renewals. Retired add-ons are rejected. See [List add-ons](#operation/vpn_subscription_addons) for the keys and prices.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `vpn subscription add-addons` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `add` | array of string | yes | Keys of the add-ons to add (at least one). |

Example:

```json
{
  "add": [
    "concurrency"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `change` | object | yes |  |
| `change.id` | integer | yes | Change identifier. |
| `change.subscription_id` | integer | yes | Plan identifier. |
| `change.seq` | integer | yes | Sequence number of the change within the plan. |
| `change.added` | array of string | yes |  |
| `change.days_left` | integer | yes | Days left in the period when the change was bought. |
| `change.charged_cents` | integer | yes | Amount charged in US cents. |
| `change.status` | string | yes | `done`, or `pending` while the payment is being finalized. |
| `change.fail_reason` | string or null | yes | Short failure code. |
| `change.created_at` | integer | yes | When the change was requested (Unix time, seconds, UTC) |
| `invoice_id` | integer or null | no | Invoice identifier. |
| `invoice_number` | string or null | no | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "change": {
    "added": [
      "concurrency"
    ],
    "charged_cents": 807,
    "created_at": 1760500000,
    "days_left": 24,
    "fail_reason": null,
    "id": 1,
    "seq": 1,
    "status": "done",
    "subscription_id": 12
  },
  "invoice_id": 86,
  "invoice_number": "INV-000086",
  "subscription": {
    "activated_at": 1760000020,
    "addons": [
      "ipauth"
    ],
    "auto_renew": true,
    "bandwidth_gb": 250,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": null,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 12,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 8400000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell VPN plans. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_upgradable` | The plan cannot take add-ons now. |
| 409 | `nothing_to_add` | The plan already has all the requested add-ons. |
| 409 | `in_progress` | A renewal or upgrade of this plan is still being processed. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `unknown_addon` | An add-on key does not exist. |
| 422 | `addon_retired` | An add-on is no longer sold. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/addons" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"add":["concurrency"]}'
```

---

#### Cancel a VPN IPv4 plan now (no refund; IPs are released)

`POST /v1/vpn/subscriptions/{id}/cancel`

Cancels the plan immediately. The proxies stop working and the IP addresses go back to the pool. **Nothing is refunded**, even if time remains. To prevent accidents you must repeat the plan id in `confirm`. Canceling an already canceled plan succeeds and reports `already: true`. Look at [Preview cancellation](#operation/vpn_subscription_cancel_preview) first.

**Required scope:** `vpn:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:destroy` | CLI: `vpn subscription cancel` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | any | yes | The plan id, as a number or a string such as `12` or `#12`. Must match the id in the path. |

Example:

```json
{
  "confirm": 12
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `already` | boolean | yes | True when the plan had been canceled before this call. |
| `endpoints_revoked` | integer | yes | Number of endpoints that were switched off. |
| `ips_released` | integer | yes | Number of IP addresses returned to the pool. |
| `refund_cents` | integer | yes | Always 0. |

Example:

```json
{
  "already": false,
  "endpoints_revoked": 2,
  "ips_released": 2,
  "refund_cents": 0,
  "subscription": {
    "activated_at": 1760000020,
    "addons": [],
    "auto_renew": false,
    "bandwidth_gb": 250,
    "canceled_at": 1760600000,
    "created_at": 1760000000,
    "cycle": "monthly",
    "expires_at": 1762592000,
    "fail_reason": null,
    "hidden_at": null,
    "id": 12,
    "ip_count": 2,
    "ip_released_at": 1760600000,
    "monthly_uusd": 8400000,
    "months": 1,
    "period_days": 0,
    "renew_cents": 840,
    "renew_max_periods": 0,
    "renewable": false,
    "status": "canceled",
    "tier": "dedicated",
    "total_uusd": 8400000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_cancelable` | The plan is in a state that cannot be canceled (for example a failed order). |
| 409 | `in_progress` | A renewal or upgrade is still being processed; try again shortly. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `confirm_mismatch` | `confirm` does not match the plan id. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vpn/subscriptions/<id>/cancel" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":12}'
```

---

#### Remove a canceled or expired VPN IPv4 plan from your list

`DELETE /v1/vpn/subscriptions/{id}`

Removes a finished plan from your list. Only plans that are canceled, expired or failed and whose IP addresses have been released can be removed. The plan and its invoices are kept for the records; it just stops appearing in the list unless you pass `include_hidden=1`. Repeating the call succeeds with `already: true`.

**Required scope:** `vpn:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:destroy` | CLI: `vpn subscription delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `id` | integer | yes | Plan identifier. |
| `hidden_at` | integer or null | yes | When the plan was hidden (Unix time, seconds, UTC) |
| `already` | boolean | yes | True when the plan had been removed before this call. |

Example:

```json
{
  "already": false,
  "hidden_at": 1760700000,
  "id": 12,
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_hideable` | The plan is still active or still holds IP addresses. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vpn/subscriptions/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Download the proxy list of a Proxy IPv6 plan (with password)

`GET /v1/proxy6/subscriptions/{id}/export`

Downloads the proxies of the plan as a text file in the chosen format. Every line carries the proxy password, so treat the file as a secret. For static plans there is one line per address (the user name carries the address number); rotating plans export their single current entry. Every format connects on the shared ports 80 (HTTP) and 443 (HTTPS and SOCKS5) and selects the address through the user name (`user-N`). Formats: `hostport` and `userpass` (`host:80:user:pass`), `socks5` and `http` (URL lines), `ips` (the IPv6 addresses only), `clash` and `singbox`, and the advanced `perport` (static plans only, one dedicated port per address, `host:port:user:pass`).

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `proxy6 subscription export`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `format` | string: `hostport`, `perport`, `userpass`, `socks5`, `http`, `ips`, `clash`, `singbox` | no | Output format. |

**Response 200** - Success.

Content type: `text/plain`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `format` is not one of the supported formats; the body lists them in `allowed`. |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/export" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Connection log of a Proxy IPv6 plan (paged, searchable)

`GET /v1/proxy6/subscriptions/{id}/logs`

Returns the connection log of the plan, newest first: which client address connected to which destination through which outgoing IPv6 address, with the transferred bytes and whether the connection was denied. Without `q` the last 30 days are searched; with `q` the search is limited to the last 7 days. Limited to 30 calls per minute per account.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `proxy6 subscription logs`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `q` | string | no | Search text (at least 2 characters), matched against client address, destination host and outgoing address. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].sub_id` | integer | yes | Plan identifier. |
| `items[].ts` | integer | yes | Start of the minute the row covers (Unix time, seconds, UTC) |
| `items[].src` | string | yes | Client address that connected. |
| `items[].host` | string | yes | Destination host name or address. |
| `items[].port` | integer | yes | Destination port. |
| `items[].out_addr` | string | yes | Outgoing IPv6 address used. |
| `items[].conns` | integer | yes | Number of connections in the minute. |
| `items[].up` | integer | yes | Bytes sent to the destination. |
| `items[].down` | integer | yes | Bytes received from the destination. |
| `items[].denied` | integer | yes | Connections that were denied. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "conns": 3,
      "denied": 0,
      "down": 40960,
      "host": "example.com",
      "out_addr": "2001:db8:1234:5678::a1",
      "port": 443,
      "src": "203.0.113.5",
      "sub_id": 21,
      "ts": 1760003400,
      "up": 2048
    }
  ],
  "page": 1,
  "per_page": 50,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_request` | `page` is greater than 200. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/logs" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Real traffic chart and usage of a Proxy IPv6 plan

`GET /v1/proxy6/subscriptions/{id}/traffic`

Returns real traffic of the plan: a time series for charting, the latest rate, the usage of the current billing period and the busiest endpoints. Minute buckets are available for `1h` and `6h`, hourly buckets for `24h`, `7d` and `30d`, daily buckets for `month` and monthly buckets for `all`. Limited to 30 calls per minute per account.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `proxy6 subscription traffic`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d`, `month`, `all` | no | Time range of the series. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `24h`, `7d`, `30d`, `month`, `all` | yes | The range that was returned. |
| `granularity` | string: `minute`, `hour`, `day`, `month` | no | Bucket size of `series`. |
| `data_from` | integer or null | no | Earliest sample kept at this granularity: when the requested range is longer than the data kept, the series starts here. (Unix time, seconds, UTC) |
| `metering` | string: `directional`, `combined` | yes | `combined` when the plan has an IP that only counts total traffic: then `series` is empty, `live` is null and only totals are returned (no download/upload split). |
| `bucket_secs` | integer | yes | Nominal length of one series bucket in seconds (60 for 1h and 6h, 3600 for 24h, 7d and 30d, 86400 for month, about 30 days for all). |
| `series` | array of object | yes |  |
| `series[].t` | integer | yes | Bucket start (Unix time, seconds, UTC) |
| `series[].rx_bps` | number | yes | Average download rate in bits per second. |
| `series[].tx_bps` | number | yes | Average upload rate in bits per second. |
| `series[].conns` | integer | yes | Connections seen in the bucket. |
| `series[].peak_rx_bps` | number | no | Highest download rate seen in the bucket, in bits per second (equals the average for minute and hour buckets). |
| `series[].peak_tx_bps` | number | no | Highest upload rate seen in the bucket, in bits per second. |
| `series[].rx_bytes` | integer | no | Bytes downloaded in the bucket. |
| `series[].tx_bytes` | integer | no | Bytes uploaded in the bucket. |
| `live` | object or null | yes |  |
| `live.rx_bps` | number | yes | Latest download rate in bits per second. |
| `live.tx_bps` | number | yes | Latest upload rate in bits per second. |
| `live.conns` | integer | yes | Latest connection count. |
| `live.at` | integer or null | yes | Time of the latest sample (Unix time, seconds, UTC) |
| `live.window_secs` | integer | no | Length of the sample: the rates are an average over this many seconds (60), not an instantaneous speed. |
| `live.age_secs` | integer or null | no | Age of the latest sample in seconds. |
| `usage` | object | yes |  |
| `usage.period_start` | integer | yes | Start of the current billing period (Unix time, seconds, UTC) |
| `usage.period_end` | integer | yes | End of the current billing period (Unix time, seconds, UTC) |
| `usage.rx_bytes` | integer | no | Bytes downloaded in the period (`directional` only). |
| `usage.tx_bytes` | integer | no | Bytes uploaded in the period (`directional` only). |
| `usage.total_bytes` | integer | yes | Total bytes in the period. |
| `usage.quota_bytes` | integer | yes | Quota in bytes, 0 when unlimited. |
| `usage.pct` | number | yes | Share of the quota used, in percent (0 when unlimited). |
| `endpoints` | array of object | yes |  |
| `endpoints[].id` | integer | yes | Endpoint identifier. |
| `endpoints[].ip` | string | yes | Endpoint IP address. |
| `endpoints[].rx_bytes` | integer | no | Bytes downloaded through this endpoint in the period (`directional` only). |
| `endpoints[].tx_bytes` | integer | no | Bytes uploaded through this endpoint in the period (`directional` only). |
| `endpoints[].total_bytes` | integer | yes | Total bytes through this endpoint in the period. |
| `endpoints[].last_seen` | integer or null | yes | `directional`: last time the endpoint carried traffic. `combined`: when the counters were last read (Unix time, seconds, UTC) |
| `periods` | array of object | no |  |
| `periods[].period_start` | integer | yes | Start of the billing period (Unix time, seconds, UTC) |
| `periods[].period_end` | integer | yes | End of the billing period (Unix time, seconds, UTC) |
| `periods[].rx_bytes` | integer | yes | Bytes downloaded in the period. |
| `periods[].tx_bytes` | integer | yes | Bytes uploaded in the period. |
| `periods[].total_bytes` | integer | yes | Total bytes in the period. |

Example:

```json
{
  "bucket_secs": 3600,
  "endpoints": [],
  "live": {
    "at": null,
    "conns": 0,
    "rx_bps": 0.0,
    "tx_bps": 0.0
  },
  "metering": "directional",
  "range": "24h",
  "series": [
    {
      "conns": 4,
      "rx_bps": 250000.0,
      "t": 1760000000,
      "tx_bps": 40000.0
    }
  ],
  "usage": {
    "pct": 0.0,
    "period_end": 1760086400,
    "period_start": 1760000000,
    "quota_bytes": 0,
    "rx_bytes": 1048576,
    "total_bytes": 1310720,
    "tx_bytes": 262144
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 422 | `invalid_argument` | `range` is not one of 1h, 6h, 24h, 7d, 30d. |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/traffic" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Preview of canceling a Proxy IPv6 plan

`GET /v1/proxy6/subscriptions/{id}/cancel-preview`

Shows what canceling the plan would do, without changing anything: whether it can be canceled, how many addresses would be released, and that no refund is given.

**Required scope:** `vpn:detail`.

Scope: `vpn:detail` | CLI: `proxy6 subscription cancel-preview`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `can_cancel` | boolean | yes | Whether the plan can be canceled now. |
| `reason` | string or null | yes | Why it cannot be canceled, when `can_cancel` is false. |
| `refund_cents` | integer | yes | Always 0: canceling never refunds. |
| `ips_released` | integer | yes | Number of IP addresses that would go back to the pool. |
| `expires_at` | integer | yes | Current expiry of the plan (Unix time, seconds, UTC) |
| `status` | string | yes | Current plan status. |
| `can_hide` | boolean | yes | Whether the plan can be removed from your list (canceled or expired, IPs already released). |
| `keep_until` | integer or null | yes | For expired plans: when the IPs will be released (Unix time, seconds, UTC) |

Example:

```json
{
  "can_cancel": true,
  "can_hide": false,
  "expires_at": 1760086400,
  "ips_released": 5,
  "keep_until": null,
  "reason": null,
  "refund_cents": 0,
  "status": "active"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/cancel-preview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Invoices that belong to a Proxy IPv6 plan

`GET /v1/proxy6/subscriptions/{id}/billing`

Lists every invoice that belongs to the plan (purchase and renewals), newest first. Invoices issued to a previous owner (after a transfer) are marked `previous_owner` and their buyer details are redacted.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `proxy6 subscription billing`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `invoices` | array of VpnPlanInvoice | yes |  |
| `invoices[].id` | integer | yes | Invoice identifier. |
| `invoices[].number` | string or null | yes | Human-readable invoice number. |
| `invoices[].account_id` | integer or null | yes | Your account id, or null on invoices issued to a previous owner of the plan. |
| `invoices[].vm_id` | string or null | yes | Always null for plan invoices. |
| `invoices[].kind` | string | yes | Invoice kind, e.g. `receipt`. |
| `invoices[].status` | string | yes | Invoice status, e.g. `paid`. |
| `invoices[].subtotal_cents` | integer | yes | Subtotal in US cents. |
| `invoices[].total_cents` | integer | yes | Total in US cents. |
| `invoices[].currency` | string | yes | Currency code of the amounts. |
| `invoices[].due_at` | integer or null | yes | Due time (Unix time, seconds, UTC) |
| `invoices[].paid_at` | integer or null | yes | Payment time (Unix time, seconds, UTC) |
| `invoices[].ledger_ref` | string or null | yes | Wallet ledger reference. |
| `invoices[].seller_json` | string | yes | Seller details as a JSON string. |
| `invoices[].buyer_json` | string | yes | Buyer details as a JSON string (redacted on invoices issued to a previous owner). |
| `invoices[].note` | string or null | yes | Invoice note. |
| `invoices[].created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `invoices[].updated_at` | integer | yes | Last update time (Unix time, seconds, UTC) |
| `invoices[].previous_owner` | boolean | no | Present and true on invoices issued before the plan was transferred to you. |

Example:

```json
{
  "invoices": [
    {
      "account_id": 5,
      "buyer_json": "{}",
      "created_at": 1760000010,
      "currency": "USD",
      "due_at": null,
      "id": 78,
      "kind": "receipt",
      "ledger_ref": "vpn-buy-21",
      "note": null,
      "number": "INV-000078",
      "paid_at": 1760000010,
      "seller_json": "{}",
      "status": "paid",
      "subtotal_cents": 20,
      "total_cents": 20,
      "updated_at": 1760000010,
      "vm_id": null
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/proxy6/subscriptions/<id>/billing" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Turn auto-renew on or off (turning it on can renew from the wallet at once)

`PUT /v1/proxy6/subscriptions/{id}/auto-renew`

Turns auto-renew on or off. When on, the plan renews itself from the wallet shortly before it expires. Turning it on for a plan that is already due renews it immediately; `renew` then reports what happened. Turning it off always works.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `proxy6 subscription set-auto-renew`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | yes | `true` to renew automatically, `false` to stop. |

Example:

```json
{
  "enabled": false
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `changed` | boolean | yes | Whether the setting was different from before. |
| `renew` | string or null: `renewed`, `replayed`, `no_funds`, `skipped`, `failed` | yes | Outcome of the immediate renewal, or null when none was attempted. |

Example:

```json
{
  "changed": false,
  "renew": null,
  "subscription": {
    "activated_at": 1760000010,
    "addons": [],
    "auto_renew": false,
    "bandwidth_gb": 0,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "daily",
    "expires_at": 1760086400,
    "fail_reason": null,
    "hidden_at": null,
    "id": 21,
    "ip_count": 5,
    "ip_released_at": null,
    "monthly_uusd": 4000000,
    "months": 0,
    "period_days": 1,
    "renew_cents": 20,
    "renew_max_periods": 30,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 200000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_renewable` | Auto-renew cannot be turned on for a plan that can no longer be renewed. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/proxy6/subscriptions/<id>/auto-renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":false}'
```

---

#### Set the automatic IP rotation interval (0 = off)

`PUT /v1/proxy6/subscriptions/{id}/rotation`

Sets the automatic rotation interval of a rotating plan. Every automatic rotation uses one of the plan's rotations. Static plans cannot rotate.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `proxy6 subscription set-rotation`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `interval_s` | integer | yes | Seconds between rotations, from 30 to 600; 0 turns automatic rotation off. |

Example:

```json
{
  "interval_s": 60
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `rotate_interval_s` | integer | yes | The interval now in effect. |
| `next_rotate_at` | integer or null | yes | Time of the next rotation, null when off (Unix time, seconds, UTC) |

Example:

```json
{
  "next_rotate_at": 1760003660,
  "ok": true,
  "rotate_interval_s": 60
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `static_no_rotate` | Static plans keep fixed addresses and cannot rotate. |
| 422 | `bad_interval` | The interval is not 0 or between 30 and 600 seconds; the body has `min_s` and `max_s`. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/proxy6/subscriptions/<id>/rotation" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"interval_s":60}'
```

---

#### Issue a new public rotation link (anyone holding it can burn rotations)

`POST /v1/proxy6/subscriptions/{id}/rotation/token`

Issues a new public rotation link and invalidates the previous one. Calling the link (GET or POST, no API key needed) rotates the address once, which is handy for scripts and phones. Anyone who holds the link can use up the plan's rotations, so treat it as a secret and issue a new one if it leaks.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `proxy6 subscription rotation-token` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `rotate_path` | string | yes | Path of the rotation link on this site, `/v1/proxy6/rotate/{token}`. |

Example:

```json
{
  "rotate_path": "/v1/proxy6/rotate/Zk3q9rVx0aLm2PwTnB7cYdHs5uJgEoXf"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `static_no_rotate` | Static plans cannot rotate. |
| 409 | `not_active` | The plan has already released its addresses. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/rotation/token" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Release the devices locked to the plan

`POST /v1/proxy6/subscriptions/{id}/release-device`

Releases the devices (client source IPs) locked to the plan. The plan allows a limited number of devices; the first devices that connect are locked in. After a release, the next devices that connect are locked instead.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `proxy6 subscription release-device`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `released` | array of string | yes |  |

Example:

```json
{
  "ok": true,
  "released": [
    "203.0.113.5"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/release-device" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Generate a new proxy password (returned once)

`POST /v1/proxy6/subscriptions/{id}/reset-password`

Generates a new proxy password and returns it. The old password stops working at once, so update your clients. At most 5 resets per plan every 5 minutes.

**Required scope:** `vpn:write`.

Scope: `vpn:write` | CLI: `proxy6 subscription reset-password` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `password` | string | yes | The new proxy password (16 characters). |

Example:

```json
{
  "ok": true,
  "password": "Hq7Lm2Zx9PrTk4Wd"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/reset-password" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rotate the IPv6 address now (uses one rotation of the plan)

`POST /v1/proxy6/subscriptions/{id}/rotate`

Rotates the IPv6 address of a rotating plan now and returns the new one. Each call uses one of the plan's rotations; when none are left the call fails with `turns_exhausted` until you renew. Send an `Idempotency-Key` so that a retried call does not use a second rotation. At most one rotation every 3 seconds per plan.

**Required scope:** `vpn:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:write` | CLI: `proxy6 subscription rotate` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `old` | string or null | yes | The address that was replaced. |
| `ip` | string | yes | The new IPv6 address. |
| `turns_left` | integer | yes | Rotations left after this one. |

Example:

```json
{
  "ip": "2001:db8:1234:5678::b7",
  "ok": true,
  "old": "2001:db8:1234:5678::a1",
  "turns_left": 3
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `turns_exhausted` | All rotations are used; renew the plan to get more. |
| 409 | `static_no_rotate` | Static plans keep fixed addresses and cannot rotate. |
| 409 | `not_active` | The plan is not active. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `no_space` | No free IPv6 address is available right now; try again shortly. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/rotate" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Buy a Proxy IPv6 plan (charges the wallet)

`POST /v1/proxy6/subscriptions`

Buys a Proxy IPv6 plan. The price is charged to the wallet and the proxy is set up at once; if setup fails after payment the amount is refunded automatically. Get plans, speeds and cycles from the Proxy IPv6 catalog first. Send an `Idempotency-Key` header: calling again with the same key returns the original purchase instead of buying twice. A `202 Accepted` answer means the payment is still being finalized; the plan appears in your list when done. When called with an API key, the answer carries no secrets (`password` and `rotate_path` are null): read the connection details with `GET /v1/proxy6/subscriptions/{id}` or `GET /v1/proxy6/subscriptions/{id}/export`.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `proxy6 subscription buy` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan` | string | yes | Plan slug from the catalog, e.g. `static-100` or `rotate-5`. |
| `cycle` | string: `daily`, `weekly`, `monthly`, `yearly` | yes | Billing cycle. |
| `zone_id` | integer | no | Location to buy in; omit for the default. |
| `mbps_addons` | integer | no | Extra 100 Mbps speed steps, default 0. |
| `device_addons` | integer | no | Extra device slots, default 0. |
| `auto_renew` | boolean | no | Pass `false` to start with auto-renew off. Default: on. |

Example:

```json
{
  "auto_renew": false,
  "cycle": "daily",
  "plan": "rotate-5"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | Proxy6PlanSummary | yes | A Proxy IPv6 plan: the common plan fields plus the proxy settings in `proxy6`. |
| `charged_cents` | integer | yes | Amount charged in US cents. |
| `invoice_id` | integer or null | yes | Invoice identifier. |
| `invoice_number` | string or null | yes | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "charged_cents": 20,
  "invoice_id": 78,
  "invoice_number": "INV-000078",
  "subscription": {
    "activated_at": 1760000010,
    "addons": [],
    "auto_renew": false,
    "bandwidth_gb": 0,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "daily",
    "expires_at": 1760086400,
    "fail_reason": null,
    "hidden_at": null,
    "id": 21,
    "ip_count": 5,
    "ip_released_at": null,
    "ip_version": "ipv6",
    "monthly_uusd": 4000000,
    "months": 0,
    "period_days": 1,
    "proxy6": {
      "addresses": 1,
      "count": 5,
      "current_addr": "2001:db8:1234:5678::a1",
      "device_addons": 0,
      "devices": 1,
      "devices_locked": [],
      "exhausted": false,
      "exhausted_at": null,
      "host": "ipv6.example.com",
      "kind": "rotate",
      "last_rotated_at": null,
      "mbps": 100,
      "mbps_addons": 0,
      "next_rotate_at": null,
      "password": null,
      "plan": "rotate-5",
      "ports": {
        "http": 80,
        "https": 443,
        "socks5": 443,
        "static_from": 60001,
        "static_to": 60001
      },
      "rotate_interval_s": 0,
      "rotate_path": null,
      "turns_left": 4,
      "turns_total": 5,
      "turns_used": 1,
      "username": "p6u8c2d1"
    },
    "renew_cents": 20,
    "renew_max_periods": 30,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 200000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell Proxy IPv6. |
| 409 | `pool_exhausted` | No capacity in that location; the body says whether you were charged and refunded. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |
| 503 | `maintenance` | Orders are paused for maintenance. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"auto_renew":false,"cycle":"daily","plan":"rotate-5"}'
```

---

#### Renew a Proxy IPv6 plan (charges the wallet)

`POST /v1/proxy6/subscriptions/{id}/renew`

Renews the plan for one or more periods at the price fixed when it was bought. The amount is charged to the wallet and the expiry moves forward; for rotating plans more rotations are added to the plan. Send an `Idempotency-Key` so that a retried call does not charge twice.

**Required scope:** `vpn:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:create` | CLI: `proxy6 subscription renew` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `periods` | integer | no | Number of periods to buy, from 1 up to `renew_max_periods` of the plan. Defaults to 1. |

Example:

```json
{
  "periods": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `renewal` | VpnRenewal | yes |  |
| `renewal.id` | integer | yes | Renewal identifier. |
| `renewal.seq` | integer | yes | Sequence number of the renewal within the plan. |
| `renewal.periods` | integer | yes | Number of periods bought. |
| `renewal.months` | integer | yes | Months added. |
| `renewal.charged_cents` | integer | yes | Amount charged in US cents. |
| `renewal.from` | integer | yes | Previous expiry (Unix time, seconds, UTC) |
| `renewal.to` | integer | yes | New expiry (Unix time, seconds, UTC) |
| `renewal.status` | string | yes | `done`, or `pending` while the payment is being finalized. |
| `renewal.created_at` | integer | yes | When the renewal was requested (Unix time, seconds, UTC) |
| `invoice_id` | integer or null | no | Invoice identifier. |
| `invoice_number` | string or null | no | Invoice number. |
| `pending` | boolean | no | True when the answer is 202 and the payment is still being finalized. |
| `replayed` | boolean | no | True when this is the stored result of an earlier call with the same Idempotency-Key. |

Example:

```json
{
  "invoice_id": 92,
  "invoice_number": "INV-000092",
  "renewal": {
    "charged_cents": 20,
    "created_at": 1760080000,
    "from": 1760086400,
    "id": 5,
    "months": 0,
    "periods": 1,
    "seq": 1,
    "status": "done",
    "to": 1760172800
  },
  "subscription": {
    "activated_at": 1760000010,
    "addons": [],
    "auto_renew": false,
    "bandwidth_gb": 0,
    "canceled_at": null,
    "created_at": 1760000000,
    "cycle": "daily",
    "expires_at": 1760086400,
    "fail_reason": null,
    "hidden_at": null,
    "id": 21,
    "ip_count": 5,
    "ip_released_at": null,
    "monthly_uusd": 4000000,
    "months": 0,
    "period_days": 1,
    "renew_cents": 20,
    "renew_max_periods": 30,
    "renewable": true,
    "status": "active",
    "tier": "dedicated",
    "total_uusd": 200000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the price; the body has `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | This site does not sell Proxy IPv6. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_renewable` | The plan cannot be renewed in its current state. |
| 409 | `renewal_in_progress` | Another renewal of this plan is still being processed. |
| 409 | `idempotency_key_reused` | The Idempotency-Key was already used for a different order in the last 24 hours. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `periods` is out of range; the body has `max`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 500 | `refund_pending` | The payment was taken and the automatic refund failed; do not retry, contact support. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"periods":1}'
```

---

#### Cancel a Proxy IPv6 plan now (no refund; addresses are released)

`POST /v1/proxy6/subscriptions/{id}/cancel`

Cancels the plan immediately. The proxy stops working and the addresses are released. **Nothing is refunded**, even if time remains. To prevent accidents you must repeat the plan id in `confirm`. Canceling an already canceled plan succeeds and reports `already: true`.

**Required scope:** `vpn:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:destroy` | CLI: `proxy6 subscription cancel` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | any | yes | The plan id, as a number or a string such as `21` or `#21`. Must match the id in the path. |

Example:

```json
{
  "confirm": 21
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subscription` | VpnPlanSummary | yes |  |
| `subscription.id` | integer | yes | Plan identifier. |
| `subscription.tier` | string | yes | IP type: `dedicated` (the only type on sale), or `shared` / `private` on older plans. |
| `subscription.ip_count` | integer | yes | Number of IP addresses in the plan. |
| `subscription.bandwidth_gb` | integer | yes | Monthly bandwidth quota in GB (decimal). `0` means unlimited. |
| `subscription.cycle` | string | yes | Billing cycle slug: `daily`, `weekly`, `monthly` or `yearly`. |
| `subscription.addons` | array of string | yes |  |
| `subscription.monthly_uusd` | integer | yes | Monthly list price in millionths of a US dollar. |
| `subscription.total_uusd` | integer | yes | Price of one full cycle in millionths of a US dollar. |
| `subscription.status` | string: `pending`, `active`, `expired`, `canceled`, `failed` | yes | Lifecycle state of the plan. |
| `subscription.created_at` | integer | yes | When the order was created (Unix time, seconds, UTC) |
| `subscription.expires_at` | integer | yes | End of the paid period (Unix time, seconds, UTC) |
| `subscription.months` | integer | yes | Months per cycle (0 for daily and weekly cycles). |
| `subscription.renew_cents` | integer | yes | Price of one renewal period in US cents, fixed at purchase time. |
| `subscription.renew_max_periods` | integer | yes | Largest number of periods a single renewal call accepts. |
| `subscription.period_days` | integer | yes | Days per period for daily and weekly cycles, 0 otherwise. |
| `subscription.activated_at` | integer or null | yes | When the plan became active (Unix time, seconds, UTC) |
| `subscription.fail_reason` | string or null | yes | Short code explaining why the order failed, when it did. |
| `subscription.canceled_at` | integer or null | yes | When the plan was canceled (Unix time, seconds, UTC) |
| `subscription.ip_released_at` | integer or null | yes | When the IP addresses went back to the pool (Unix time, seconds, UTC) |
| `subscription.hidden_at` | integer or null | yes | When the plan was removed from your list (Unix time, seconds, UTC) |
| `subscription.renewable` | boolean | yes | Whether the plan can be renewed in its current state. |
| `subscription.auto_renew` | boolean | yes | Whether the plan renews itself from the wallet shortly before it expires. |
| `subscription.zone` | object or null | no | Location the plan is served from. |
| `subscription.keep_until` | integer or null | no | For expired plans: the time after which the IP addresses are released (Unix time, seconds, UTC) |
| `already` | boolean | yes | True when the plan had been canceled before this call. |
| `endpoints_revoked` | integer | yes | Number of endpoints that were switched off. |
| `ips_released` | integer | yes | Number of addresses returned to the pool. |
| `refund_cents` | integer | yes | Always 0. |

Example:

```json
{
  "already": false,
  "endpoints_revoked": 0,
  "ips_released": 0,
  "refund_cents": 0,
  "subscription": {
    "activated_at": 1760000010,
    "addons": [],
    "auto_renew": false,
    "bandwidth_gb": 0,
    "canceled_at": 1760050000,
    "created_at": 1760000000,
    "cycle": "daily",
    "expires_at": 1760086400,
    "fail_reason": null,
    "hidden_at": null,
    "id": 21,
    "ip_count": 5,
    "ip_released_at": 1760050000,
    "monthly_uusd": 4000000,
    "months": 0,
    "period_days": 1,
    "renew_cents": 20,
    "renew_max_periods": 0,
    "renewable": false,
    "status": "canceled",
    "tier": "dedicated",
    "total_uusd": 200000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_cancelable` | The plan is in a state that cannot be canceled (for example a failed order). |
| 409 | `in_progress` | A renewal is still being processed; try again shortly. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `confirm_mismatch` | `confirm` does not match the plan id. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/proxy6/subscriptions/<id>/cancel" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":21}'
```

---

#### Remove a canceled or expired Proxy IPv6 plan from your list

`DELETE /v1/proxy6/subscriptions/{id}`

Removes a finished plan from your list. Only plans that are canceled, expired or failed and whose addresses have been released can be removed. The plan and its invoices are kept for the records. Repeating the call succeeds with `already: true`.

**Required scope:** `vpn:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vpn:destroy` | CLI: `proxy6 subscription delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Plan identifier as returned by the list operation. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `id` | integer | yes | Plan identifier. |
| `hidden_at` | integer or null | yes | When the plan was hidden (Unix time, seconds, UTC) |
| `already` | boolean | yes | True when the plan had been removed before this call. |

Example:

```json
{
  "already": false,
  "hidden_at": 1760100000,
  "id": 21,
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_hideable` | The plan is still active or still holds addresses. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/proxy6/subscriptions/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

### Scaling

Change the size of a server (vCPU, RAM, disk) now or on a schedule, and let Auto Scaling grow it when the load is high. Resizing is charged or refunded for the price difference, and every operation that costs money requires an `Idempotency-Key`. Available only on sites that sell resizing; when it is switched off the write operations fail with `403 feature_disabled`.

#### Scaling status: limits, capabilities, blockers

`GET /v1/vm/{id}/scale`

Returns everything needed to build a resize form for one server in a single call: its current size and price, the limits and unit prices of your site, what it can do without a restart, the reasons a resize is not possible right now, and your wallet balance. It changes nothing and costs nothing.

`feature` is false when the site does not sell resizing; the write operations of this section then fail with `403 feature_disabled`. A resize also needs the site to sell custom configurations, because the new size is priced like a custom configuration.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm scale get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `feature` | boolean | yes | Whether the site sells resizing. When `false`, the write operations fail with `403 feature_disabled`. |
| `autoscale_feature` | boolean | yes | Whether Auto Scaling can be enabled on this server: the site sells it, the server is billed by the hour and it does not run Windows. |
| `vm` | object | yes | The server as it is now. |
| `vm.id` | string | yes | VM identifier (UUID). |
| `vm.hostname` | string | yes | Host name of the server. |
| `vm.state` | string | yes | Lifecycle state of the server, for example `active`, `locked` or `provisioning`. Only `active` servers can be resized. |
| `vm.cs_state` | string or null | yes | Power state reported by the platform, for example `Running` or `Stopped`; null until first known. |
| `vm.cycle` | string | yes | Billing cycle slug of the server, `hourly` or a prepaid cycle such as `monthly`. |
| `vm.plan_id` | integer | yes | Plan the server is currently on. |
| `vm.cpu` | integer | yes | Current virtual CPU cores. |
| `vm.ram_mb` | integer | yes | Current memory in MiB. |
| `vm.disk_gb` | integer | yes | Current system disk in GiB. |
| `vm.hourly_uusd` | integer | yes | Current price per hour in millionths of a US dollar. |
| `vm.monthly_cents` | integer | yes | Current price for a month of `hours_per_month` hours in US cents. |
| `hours_per_month` | integer | yes | Hours in a billing month used to convert hourly prices to monthly ones (730 by default). |
| `limits` | object | yes | Allowed values and unit prices. |
| `limits.cpu` | object | yes | vCPU cores you can choose. |
| `limits.cpu.min` | integer | yes | Smallest allowed value. |
| `limits.cpu.max` | integer | yes | Largest allowed value. |
| `limits.cpu.step` | integer | yes | Values must grow in multiples of this step. |
| `limits.ram_gb` | object | yes | RAM in GiB you can choose. |
| `limits.ram_gb.min` | integer | yes | Smallest allowed value. |
| `limits.ram_gb.max` | integer | yes | Largest allowed value. |
| `limits.ram_gb.step` | integer | yes | Values must grow in multiples of this step. |
| `limits.disk_gb` | object | yes | Disk in GiB you can choose. `min` is the current disk because a disk can only grow. |
| `limits.disk_gb.min` | integer | yes | Smallest allowed value. |
| `limits.disk_gb.max` | integer | yes | Largest allowed value. |
| `limits.disk_gb.step` | integer | yes | Values must grow in multiples of this step. |
| `limits.ram_mb_step` | integer | yes | `ram_mb` in a resize request must be a multiple of this value (1024). |
| `limits.unit_uusd_h` | object | yes | Unit prices of your site, so you can estimate a price locally. |
| `limits.unit_uusd_h.cpu` | integer | yes | Price of one vCPU per hour, in millionths of a US dollar. |
| `limits.unit_uusd_h.ram_gb` | integer | yes | Price of 1 GiB of RAM per hour, in millionths of a US dollar. |
| `limits.unit_uusd_h.disk_gb` | integer | yes | Price of 1 GiB of disk per hour, in millionths of a US dollar. |
| `caps` | object | yes | What the server can do without a restart. |
| `caps.running` | boolean | yes | The server is running. Only a running server can be resized without a restart. |
| `caps.hotplug` | boolean | yes | The server has been restarted since live resizing became available. When `false`, the first change needs one restart (see Restart for scaling). |
| `caps.cpu_hotplug` | boolean | yes | The operating system image can bring added vCPUs online without a restart. When `false`, increasing vCPUs needs a restart. |
| `caps.windows` | boolean | yes | The server runs Windows. Windows servers are always restarted to resize and cannot use Auto Scaling. |
| `caps.ram_hotplugs_used` | integer | yes | Number of live RAM additions since the last start. |
| `caps.ram_hotplugs_max` | integer | yes | A server accepts at most this many live RAM additions between restarts (16); restart it to reset the counter. |
| `blocked` | array of string | yes | Reasons a resize cannot be applied right now; empty when it can. Values: `vm_locked`, `vm_not_active`, `job_running`, `ram_slots_exhausted`, `needs_reboot`. |
| `billed_until` | integer or null | yes | End of the hour or cycle already paid (Unix time, seconds, UTC) |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |
| `state` | string: `base`, `scaled`, `cooling` | yes | Auto Scaling state of the server: `base` (at its base size), `scaled` (grown by Auto Scaling) or `cooling` (still larger, billed at the base price until it is returned to base). |
| `pending_revert` | boolean | yes | The server is larger than its base size and will return to base size on its next restart. |

Example:

```json
{
  "autoscale_feature": true,
  "balance_cents": 2500,
  "billed_until": 1790003600,
  "blocked": [],
  "caps": {
    "cpu_hotplug": true,
    "hotplug": true,
    "ram_hotplugs_max": 16,
    "ram_hotplugs_used": 0,
    "running": true,
    "windows": false
  },
  "feature": true,
  "hours_per_month": 730,
  "limits": {
    "cpu": {
      "max": 32,
      "min": 1,
      "step": 1
    },
    "disk_gb": {
      "max": 1000,
      "min": 50,
      "step": 10
    },
    "ram_gb": {
      "max": 64,
      "min": 1,
      "step": 1
    },
    "ram_mb_step": 1024,
    "unit_uusd_h": {
      "cpu": 2740,
      "disk_gb": 110,
      "ram_gb": 1370
    }
  },
  "pending_revert": false,
  "state": "base",
  "vm": {
    "cpu": 2,
    "cs_state": "Running",
    "cycle": "hourly",
    "disk_gb": 50,
    "hostname": "web-1",
    "hourly_uusd": 16460,
    "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
    "monthly_cents": 1202,
    "plan_id": 14,
    "ram_mb": 4096,
    "state": "active"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`resize_live`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/scale" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Resize CPU/RAM/disk now or scheduled (charges or refunds)

`POST /v1/vm/{id}/scale`

Resizes a server to the vCPU, RAM and disk you give, now or at a scheduled time. **This operation costs money.** The price of the new size is always computed by the server. For a server billed by the hour, one hour at the new price is charged to your wallet up front and the hourly price changes from then on. For a server on a prepaid billing cycle, the price difference for the rest of the cycle is charged, or refunded (never more than you paid for the cycle) when the new size is cheaper. If the resize fails in the background, the charge is refunded automatically.

The call returns as soon as the change is accepted; the resize runs as a background job (`job_id`, see [List VM jobs](#operation/vm_jobs)). `live` tells you whether the server keeps running: it is `true` only for an increase of RAM or vCPUs on a running server that has been restarted since live resizing became available, whose image supports hot-plugging and whose disk does not change. Every other change, including any decrease and any disk enlargement, stops and starts the server again, which is a short interruption. A disk can only grow, in steps.

Pass `at` to schedule a **decrease**: nothing is charged now, the schedule is stored (one schedule per server; a new one replaces the old) and the resize and its payment or refund happen at that time. Increases cannot be scheduled, and `at` may be at most 7 days ahead. A scheduled call answers `{"scheduled": true, "at": ...}`.

The server must be `active`, unlocked, with no other operation running, and the new size must be within the `limits` returned by [Get scaling status](#operation/vm_scale_get). Requests are limited to 1 per minute per server and 5 per minute per account (`429 rate_limited` with `retry_after`). Repeating a request with the same `Idempotency-Key` returns the original response with the header `Idempotency-Replayed: 1` instead of charging again.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm scale apply` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cpu` | integer | yes | Target number of virtual CPU cores, within `limits.cpu` of Get scaling status. |
| `ram_mb` | integer | yes | Target memory in MiB. Must be a multiple of 1024 and within `limits.ram_gb`. |
| `disk_gb` | integer | yes | Target system disk in GiB. Cannot be lower than the current disk; to keep the disk, send the current value. |
| `at` | integer | no | Schedule the change for this time (Unix time, seconds, UTC) instead of doing it now. Only decreases can be scheduled, at most 7 days ahead. A value that is not in the future means "now". |

Example:

```json
{
  "cpu": 2,
  "disk_gb": 50,
  "ram_mb": 8192
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `live` | boolean | yes | `true` when the change is applied without restarting the server; `false` when the background job stops and starts the server (or when the change is only scheduled). |
| `charged_cents` | integer | yes | Amount charged to your wallet by this call, in US cents (0 when nothing was charged). |
| `refunded_cents` | integer | yes | Amount refunded to your wallet by this call, in US cents. |
| `job_id` | integer or null | no | Background job that performs the resize. Absent for a scheduled change, which has no job until its time comes. |
| `event_id` | integer | no | Identifier of the entry written to the scaling history (see List scaling events). |
| `replay` | boolean | no | `true` when this answer repeats the result of an earlier request with the same `Idempotency-Key` instead of running again. |
| `scheduled` | boolean | no | Present and `true` when the change was only scheduled (a decrease requested with `at`). |
| `at` | integer | no | When the change was accepted, or the scheduled time for a scheduled change (Unix time, seconds, UTC) |
| `from` | ScaleSize | no |  |
| `from.cpu` | integer | yes | Virtual CPU cores. |
| `from.ram_mb` | integer | yes | Memory in MiB. |
| `from.disk_gb` | integer | yes | System disk in GiB. |
| `from.hourly_uusd` | integer | no | Price per hour of this size in millionths of a US dollar. Absent on a replayed response. |
| `from.monthly_cents` | integer | no | Price of this size for a 730-hour month in US cents (informational). |
| `to` | ScaleSize | no |  |
| `to.cpu` | integer | yes | Virtual CPU cores. |
| `to.ram_mb` | integer | yes | Memory in MiB. |
| `to.disk_gb` | integer | yes | System disk in GiB. |
| `to.hourly_uusd` | integer | no | Price per hour of this size in millionths of a US dollar. Absent on a replayed response. |
| `to.monthly_cents` | integer | no | Price of this size for a 730-hour month in US cents (informational). |

Example:

```json
{
  "at": 1790001200,
  "charged_cents": 2,
  "event_id": 211,
  "from": {
    "cpu": 2,
    "disk_gb": 50,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "job_id": 18342,
  "live": true,
  "refunded_cents": 0,
  "replay": false,
  "to": {
    "cpu": 2,
    "disk_gb": 50,
    "hourly_uusd": 21940,
    "monthly_cents": 1602,
    "ram_mb": 8192
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON, or `cpu`, `ram_mb` or `disk_gb` is missing or not a number. Numbers sent as strings are accepted. |
| 400 | `bad_input` | The size is outside the site limits (`detail` explains which value and the allowed range), or the paid hour was already charged (`detail`: `hour_already_charged`). |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot cover the charge. The body carries `need_cents` and `balance_cents`. |
| 403 | `feature_disabled` | The site does not sell resizing, or does not sell custom configurations. |
| 403 | `quota_exceeded` | The new size would exceed your account resource quota. The body carries the usage, the limit and the next tier. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server. Wait for it to finish. |
| 409 | `ram_slots_exhausted` | The server already took 16 live RAM additions since its last start. Restart it (see [Restart for scaling](#operation/vm_scale_reboot)) to continue. |
| 409 | `has_snapshots` | The server still has VM snapshots, which must be deleted before it can be resized. The body carries `count`. |
| 409 | `idempotency_key_reused` | The key was already used for a different server or a different size. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`resize_live`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `ram_step` | `ram_mb` is not a multiple of 1024. |
| 422 | `disk_shrink` | `disk_gb` is lower than the current disk. The body carries the current `disk_gb`. |
| 422 | `same_plan` | The requested size equals the current size. |
| 422 | `schedule_upscale` | `at` was given for a change that increases a component. Only decreases can be scheduled. |
| 422 | `schedule_too_far` | `at` is more than 7 days ahead. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because of unpaid charges. |
| 503 | `cluster_full` | The region has no spare capacity for an increase right now. You were not charged; try again later. |
| 503 | `provider_unavailable` | The platform could not accept the change. You were not charged. |
| 503 | `site_unavailable` | The site is temporarily unable to charge or resize. You were not charged. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/scale" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cpu":2,"disk_gb":50,"ram_mb":8192}'
```

---

#### Reboot (now or scheduled) to unlock CPU/RAM hot-plug

`POST /v1/vm/{id}/scale/reboot`

Restarts the server immediately, or at a time you choose. A server that was last started before live resizing became available needs one restart before CPU and RAM can be changed without interrupting it, and a restart also resets the counter of live RAM additions (a server accepts 16 between restarts). The call does not change the size and has no charge of its own.

Omit `at`, or give a time that is not in the future, to restart now: the call answers `{"job_id": ..., "at": ...}` and the restart runs as a background job. Give a future `at` (at most 7 days ahead) to schedule it: the call answers `{"scheduled": true, "at": ...}`; a server has one scheduled restart and a new one replaces the old. A body that is not valid JSON is treated as empty, that is, as an immediate restart.

The site must sell resizing. The server must be `active` and unlocked. Limited to 2 requests per 5 minutes per server.

**Required scope:** `vm:write`.

Scope: `vm:write` | CLI: `vm scale reboot`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `at` | integer | no | Restart at this time (Unix time, seconds, UTC) instead of now. At most 7 days ahead. A value that is not in the future means "now". |

Example:

```json
{
  "at": 1790090000
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | When the restart was queued (immediate) or the time it is scheduled for (Unix time, seconds, UTC) |
| `job_id` | integer | no | Background job that restarts the server. Present only for an immediate restart. |
| `scheduled` | boolean | no | `true` when the restart was scheduled instead of queued. |

Example:

```json
{
  "at": 1790090000,
  "scheduled": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | The site does not sell resizing. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_active` | The server is not in the `active` state. |
| 409 | `job_running` | A restart of this server is already queued or running. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`resize_live`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `schedule_too_far` | `at` is more than 7 days ahead. |
| 423 | `vm_locked` | The server is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 2 restarts were requested for this server in 5 minutes. The body carries `retry_after` in seconds. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/scale/reboot" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"at":1790090000}'
```

---

#### Return the VM to its base size after Auto Scaling (reboots)

`POST /v1/vm/{id}/scale/revert`

Returns a server that Auto Scaling has grown to its base size. The server is stopped, resized back to the base configuration and started again automatically in the background, which is a short interruption; the price falls back to the base price and any difference is settled automatically. The call only records your request and answers `202` with the current Auto Scaling state, in which `revert_manual` is `true`; follow progress with [Get Auto Scaling](#operation/vm_autoscale_get) (`revert_phase`).

Only a server that is larger than its base size because of Auto Scaling can be returned (`revert_available` is `true` in the Auto Scaling state). Auto Scaling does not have to be enabled. The site must sell resizing. Limited to 2 requests per 5 minutes per server.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm scale revert` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `feature` | boolean | yes | Whether the site sells Auto Scaling. When `false`, enabling it fails with `403 feature_disabled`. |
| `prepaid` | boolean | yes | `true` for a server on a prepaid cycle (monthly, yearly, multi-year, including a paid Black Friday server). Its prepaid plan, expiry and renewal price never change; only the extra capacity is billed separately by the hour (see `extra`). `false` for an hourly server, which is billed for the whole size by the hour as before. |
| `extra` | object or null | yes | Billing of the extra capacity of a prepaid server; null for an hourly server. |
| `extra.billing` | string | yes | Always `separate_hourly`: the extra capacity is billed by the hour on top of the prepaid plan. |
| `extra.active` | boolean | yes | `true` while the server really runs larger than its base size and the extra is being billed. |
| `extra.hourly_uusd` | integer | yes | Price per hour of the extra capacity (target size minus base size, at the normal hourly price list) in millionths of a US dollar. While `active` this is the price being charged; otherwise the price the saved target would cost. |
| `extra.preview_hourly_uusd` | integer | yes | Price per hour the saved target would add on top of the base size, in millionths of a US dollar. |
| `extra.monthly_cents` | integer | yes | `hourly_uusd` for a 730-hour month in US cents. |
| `extra.wallet_hours` | integer | yes | Hours of extra capacity your balance must cover to turn Auto Scaling on and for every size increase (the `autoscale_wallet_hours` setting, 24 by default). |
| `extra.need_cents` | integer | yes | Balance in US cents that covers `wallet_hours` of the saved target's extra. |
| `extra.billed_until` | integer or null | yes | End of the last hour of extra capacity that has been paid; the next hour is charged when it passes. Null unless `active`. (Unix time, seconds, UTC) |
| `extra.started_at` | integer or null | yes | When the current increase started (the first hour is paid at that moment). Null unless `active`. (Unix time, seconds, UTC) |
| `extra.warn_at` | integer or null | yes | When the low-balance warning was sent; null when none is pending. (Unix time, seconds, UTC) |
| `extra.revert_at` | integer or null | yes | When the server will be restarted back to its base size if the balance is not topped up: `warn_at` plus 24 hours. Topping up before it cancels the schedule. (Unix time, seconds, UTC) |
| `extra.covered_until` | integer or null | yes | When the current balance runs out for the extra capacity at the current price. Null unless `active`. (Unix time, seconds, UTC) |
| `enabled` | boolean | yes | Whether the rule is switched on. |
| `state` | string: `base`, `scaled`, `cooling` | yes | `base`: at the base size, billed at the base price. `scaled`: grown to the target size, billed at the target price. `cooling`: the load is gone but the server keeps the larger size and is billed at the base price until it is returned to base. |
| `base` | object | yes | Base size: the configuration the server returns to. |
| `base.cpu` | integer | yes | Virtual CPU cores. |
| `base.ram_mb` | integer | yes | Memory in MiB. |
| `base.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `current` | object | yes | Size the server has right now. |
| `current.cpu` | integer | yes | Virtual CPU cores. |
| `current.ram_mb` | integer | yes | Memory in MiB. |
| `current.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `target` | object | yes | Size the server grows to when the load is high. |
| `target.cpu` | integer | yes | Target virtual CPU cores; 0 when no rule was ever saved. |
| `target.ram_mb` | integer | yes | Target memory in MiB; 0 when no rule was ever saved. |
| `target.hourly_uusd` | integer | yes | Price per hour of the target size in millionths of a US dollar; 0 when no target is set. |
| `target.monthly_cents` | integer | yes | Price of the target size for a 730-hour month in US cents. |
| `rule` | AutoscaleThresholds | yes | Load thresholds of an Auto Scaling rule. |
| `rule.up_pct` | integer | yes | Grow when load stays at or above this percentage (50 to 95). |
| `rule.up_secs` | integer | yes | ... for at least this many seconds (120 to 1800). |
| `rule.down_pct` | integer | yes | Consider the load gone when it stays at or below this percentage (5 to 60). Always lower than `up_pct`. |
| `rule.down_secs` | integer | yes | ... for at least this many seconds (300 to 7200). |
| `caps` | object | yes | Limits of the rule fields and of the site. |
| `caps.up_pct` | array of integer | yes | [min, max] allowed for `up_pct`. |
| `caps.up_secs` | array of integer | yes | [min, max] allowed for `up_secs`. |
| `caps.down_pct` | array of integer | yes | [min, max] allowed for `down_pct`. |
| `caps.down_secs` | array of integer | yes | [min, max] allowed for `down_secs`. |
| `caps.max_cpu` | integer | yes | Largest `target_cpu` accepted by the site. |
| `caps.max_ram_mb` | integer | yes | Largest `target_ram_mb` accepted by the site. |
| `caps.max_steps_day` | integer | yes | Largest number of automatic size changes per server per day. |
| `pending_revert` | boolean | yes | The server is larger than its base size and will return to base size on its next restart. |
| `cooling_since` | integer or null | yes | When the state became `cooling` (Unix time, seconds, UTC) |
| `revert_available` | boolean | yes | The server is currently larger than its base size because of Auto Scaling and no return is under way, so Return to base size can be called. |
| `revert_manual` | boolean | yes | A return to base size that you requested is waiting or running. |
| `revert_at` | integer or null | yes | When an automatic return to base size is planned (Unix time, seconds, UTC) |
| `revert_phase` | string or null | yes | Step of a return to base size that is under way: `stopping`, `reverting` or `starting`; null when none. |
| `ram_used_mb` | integer or null | yes | Memory in use inside the server at the last measurement, in MiB. |
| `ram_stats_at` | integer or null | yes | When `ram_used_mb` was measured (Unix time, seconds, UTC) |
| `last_error` | string or null | yes | Short code of the most recent automatic step that failed or was held back, for example `insufficient_funds`, `cooldown` or `cluster_full`; null when there is none. |
| `last_error_at` | integer or null | yes | When `last_error` happened (Unix time, seconds, UTC) |
| `blocked` | array of string | yes | Reasons Auto Scaling cannot work on this server right now; empty when it can. Values: `vm_locked`, `vm_not_active`, `job_running`, `ram_slots_exhausted`, `needs_reboot`, `bf_locked` (a trial or refund-pending Black Friday server), `renewal_due` (a prepaid server that has expired), `windows_unsupported`, `template_no_cpu_hotplug`. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "balance_cents": 2500,
  "base": {
    "cpu": 2,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "blocked": [],
  "caps": {
    "down_pct": [
      5,
      60
    ],
    "down_secs": [
      300,
      7200
    ],
    "max_cpu": 8,
    "max_ram_mb": 16384,
    "max_steps_day": 4,
    "up_pct": [
      50,
      95
    ],
    "up_secs": [
      120,
      1800
    ]
  },
  "cooling_since": null,
  "current": {
    "cpu": 4,
    "hourly_uusd": 32920,
    "ram_mb": 8192
  },
  "enabled": true,
  "extra": null,
  "feature": true,
  "last_error": null,
  "last_error_at": null,
  "pending_revert": true,
  "prepaid": false,
  "ram_stats_at": 1790001150,
  "ram_used_mb": 3100,
  "revert_at": 1790001200,
  "revert_available": false,
  "revert_manual": true,
  "revert_phase": null,
  "rule": {
    "down_pct": 30,
    "down_secs": 900,
    "up_pct": 80,
    "up_secs": 300
  },
  "state": "scaled",
  "target": {
    "cpu": 4,
    "hourly_uusd": 32920,
    "monthly_cents": 2403,
    "ram_mb": 8192
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `feature_disabled` | The site does not sell resizing. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `nothing_to_revert` | The server is already at its base size, or was not grown by Auto Scaling. |
| 409 | `revert_in_progress` | A return to base size was already requested and has not finished. |
| 409 | `vm_not_active` | The server is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server. Wait for it to finish. |
| 409 | `has_snapshots` | The server still has VM snapshots, which must be deleted before it can be resized. The body carries `count`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`resize_live`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 2 requests for this server in 5 minutes. The body carries `retry_after` in seconds. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/scale/revert" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Auto Scaling rule and state of the VM

`GET /v1/vm/{id}/autoscale`

Returns the Auto Scaling rule of one server and its live state. Auto Scaling watches the CPU and RAM load of a server billed by the hour or on a prepaid cycle (a prepaid server keeps its plan and expiry; only the extra capacity is billed separately by the hour, see `extra`; a trial Black Friday server cannot use it): when the load stays above `rule.up_pct` for `rule.up_secs` seconds, the server grows to the `target` size and is billed at the target price; when the load stays below `rule.down_pct` for `rule.down_secs` seconds, billing falls back to the base price (`cooling`) while the larger size remains until the server is returned to its base size (see [Return to base size](#operation/vm_scale_revert)).

When no rule was ever saved the defaults are returned with `enabled: false`. `blocked` lists what currently prevents Auto Scaling from working, and `feature` is false when the site does not sell it.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm autoscale get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `feature` | boolean | yes | Whether the site sells Auto Scaling. When `false`, enabling it fails with `403 feature_disabled`. |
| `prepaid` | boolean | yes | `true` for a server on a prepaid cycle (monthly, yearly, multi-year, including a paid Black Friday server). Its prepaid plan, expiry and renewal price never change; only the extra capacity is billed separately by the hour (see `extra`). `false` for an hourly server, which is billed for the whole size by the hour as before. |
| `extra` | object or null | yes | Billing of the extra capacity of a prepaid server; null for an hourly server. |
| `extra.billing` | string | yes | Always `separate_hourly`: the extra capacity is billed by the hour on top of the prepaid plan. |
| `extra.active` | boolean | yes | `true` while the server really runs larger than its base size and the extra is being billed. |
| `extra.hourly_uusd` | integer | yes | Price per hour of the extra capacity (target size minus base size, at the normal hourly price list) in millionths of a US dollar. While `active` this is the price being charged; otherwise the price the saved target would cost. |
| `extra.preview_hourly_uusd` | integer | yes | Price per hour the saved target would add on top of the base size, in millionths of a US dollar. |
| `extra.monthly_cents` | integer | yes | `hourly_uusd` for a 730-hour month in US cents. |
| `extra.wallet_hours` | integer | yes | Hours of extra capacity your balance must cover to turn Auto Scaling on and for every size increase (the `autoscale_wallet_hours` setting, 24 by default). |
| `extra.need_cents` | integer | yes | Balance in US cents that covers `wallet_hours` of the saved target's extra. |
| `extra.billed_until` | integer or null | yes | End of the last hour of extra capacity that has been paid; the next hour is charged when it passes. Null unless `active`. (Unix time, seconds, UTC) |
| `extra.started_at` | integer or null | yes | When the current increase started (the first hour is paid at that moment). Null unless `active`. (Unix time, seconds, UTC) |
| `extra.warn_at` | integer or null | yes | When the low-balance warning was sent; null when none is pending. (Unix time, seconds, UTC) |
| `extra.revert_at` | integer or null | yes | When the server will be restarted back to its base size if the balance is not topped up: `warn_at` plus 24 hours. Topping up before it cancels the schedule. (Unix time, seconds, UTC) |
| `extra.covered_until` | integer or null | yes | When the current balance runs out for the extra capacity at the current price. Null unless `active`. (Unix time, seconds, UTC) |
| `enabled` | boolean | yes | Whether the rule is switched on. |
| `state` | string: `base`, `scaled`, `cooling` | yes | `base`: at the base size, billed at the base price. `scaled`: grown to the target size, billed at the target price. `cooling`: the load is gone but the server keeps the larger size and is billed at the base price until it is returned to base. |
| `base` | object | yes | Base size: the configuration the server returns to. |
| `base.cpu` | integer | yes | Virtual CPU cores. |
| `base.ram_mb` | integer | yes | Memory in MiB. |
| `base.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `current` | object | yes | Size the server has right now. |
| `current.cpu` | integer | yes | Virtual CPU cores. |
| `current.ram_mb` | integer | yes | Memory in MiB. |
| `current.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `target` | object | yes | Size the server grows to when the load is high. |
| `target.cpu` | integer | yes | Target virtual CPU cores; 0 when no rule was ever saved. |
| `target.ram_mb` | integer | yes | Target memory in MiB; 0 when no rule was ever saved. |
| `target.hourly_uusd` | integer | yes | Price per hour of the target size in millionths of a US dollar; 0 when no target is set. |
| `target.monthly_cents` | integer | yes | Price of the target size for a 730-hour month in US cents. |
| `rule` | AutoscaleThresholds | yes | Load thresholds of an Auto Scaling rule. |
| `rule.up_pct` | integer | yes | Grow when load stays at or above this percentage (50 to 95). |
| `rule.up_secs` | integer | yes | ... for at least this many seconds (120 to 1800). |
| `rule.down_pct` | integer | yes | Consider the load gone when it stays at or below this percentage (5 to 60). Always lower than `up_pct`. |
| `rule.down_secs` | integer | yes | ... for at least this many seconds (300 to 7200). |
| `caps` | object | yes | Limits of the rule fields and of the site. |
| `caps.up_pct` | array of integer | yes | [min, max] allowed for `up_pct`. |
| `caps.up_secs` | array of integer | yes | [min, max] allowed for `up_secs`. |
| `caps.down_pct` | array of integer | yes | [min, max] allowed for `down_pct`. |
| `caps.down_secs` | array of integer | yes | [min, max] allowed for `down_secs`. |
| `caps.max_cpu` | integer | yes | Largest `target_cpu` accepted by the site. |
| `caps.max_ram_mb` | integer | yes | Largest `target_ram_mb` accepted by the site. |
| `caps.max_steps_day` | integer | yes | Largest number of automatic size changes per server per day. |
| `pending_revert` | boolean | yes | The server is larger than its base size and will return to base size on its next restart. |
| `cooling_since` | integer or null | yes | When the state became `cooling` (Unix time, seconds, UTC) |
| `revert_available` | boolean | yes | The server is currently larger than its base size because of Auto Scaling and no return is under way, so Return to base size can be called. |
| `revert_manual` | boolean | yes | A return to base size that you requested is waiting or running. |
| `revert_at` | integer or null | yes | When an automatic return to base size is planned (Unix time, seconds, UTC) |
| `revert_phase` | string or null | yes | Step of a return to base size that is under way: `stopping`, `reverting` or `starting`; null when none. |
| `ram_used_mb` | integer or null | yes | Memory in use inside the server at the last measurement, in MiB. |
| `ram_stats_at` | integer or null | yes | When `ram_used_mb` was measured (Unix time, seconds, UTC) |
| `last_error` | string or null | yes | Short code of the most recent automatic step that failed or was held back, for example `insufficient_funds`, `cooldown` or `cluster_full`; null when there is none. |
| `last_error_at` | integer or null | yes | When `last_error` happened (Unix time, seconds, UTC) |
| `blocked` | array of string | yes | Reasons Auto Scaling cannot work on this server right now; empty when it can. Values: `vm_locked`, `vm_not_active`, `job_running`, `ram_slots_exhausted`, `needs_reboot`, `bf_locked` (a trial or refund-pending Black Friday server), `renewal_due` (a prepaid server that has expired), `windows_unsupported`, `template_no_cpu_hotplug`. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "balance_cents": 2500,
  "base": {
    "cpu": 2,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "blocked": [],
  "caps": {
    "down_pct": [
      5,
      60
    ],
    "down_secs": [
      300,
      7200
    ],
    "max_cpu": 8,
    "max_ram_mb": 16384,
    "max_steps_day": 4,
    "up_pct": [
      50,
      95
    ],
    "up_secs": [
      120,
      1800
    ]
  },
  "cooling_since": null,
  "current": {
    "cpu": 2,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "enabled": true,
  "extra": null,
  "feature": true,
  "last_error": null,
  "last_error_at": null,
  "pending_revert": false,
  "prepaid": false,
  "ram_stats_at": 1790001150,
  "ram_used_mb": 1900,
  "revert_at": null,
  "revert_available": false,
  "revert_manual": false,
  "revert_phase": null,
  "rule": {
    "down_pct": 30,
    "down_secs": 900,
    "up_pct": 80,
    "up_secs": 300
  },
  "state": "base",
  "target": {
    "cpu": 4,
    "hourly_uusd": 32920,
    "monthly_cents": 2403,
    "ram_mb": 8192
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`autoscale`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/autoscale" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Enable/disable and set the Auto Scaling rule (grows the VM with load)

`PUT /v1/vm/{id}/autoscale`

Switches Auto Scaling on or off for a server and saves its rule. The call replaces the whole rule: tuning fields you leave out go back to their defaults (not to the previous values), and an omitted `enabled` means `false`. Saving a rule charges nothing; money is only charged when the server actually grows, at the price of the target size.

To enable, send `enabled: true` with `target_cpu` and `target_ram_mb`: the size to grow to, larger than the current size in at least one of the two and within the site ceiling (`caps.max_cpu`, `caps.max_ram_mb`). `up_pct`, `up_secs`, `down_pct` and `down_secs` are optional and are clamped into their allowed ranges (`caps`); `down_pct` must end up lower than `up_pct`. With `enabled: false` the other fields are ignored.

Auto Scaling works only for servers billed by the hour, not running Windows, that have been restarted since live resizing became available and whose image can bring vCPUs online. The call answers with the new [Auto Scaling state](#operation/vm_autoscale_get). Limited to 20 requests per minute per account.

**Required scope:** `vm:plan`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `vm:plan` | CLI: `vm autoscale set` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `enabled` | boolean | yes | `true` to switch Auto Scaling on, `false` to switch it off. Treated as `false` when omitted. |
| `target_cpu` | integer | no | vCPU cores to grow to. Required when `enabled` is true. |
| `target_ram_mb` | integer | no | Memory in MiB to grow to; a multiple of 1024. Required when `enabled` is true. |
| `up_pct` | integer | no | Grow when the load stays at or above this percentage. Clamped to 50..95; default 80. |
| `up_secs` | integer | no | ... for at least this many seconds. Clamped to 120..1800; default 300. |
| `down_pct` | integer | no | Consider the load gone when it stays at or below this percentage. Clamped to 5..60; default 30; must be lower than `up_pct`. |
| `down_secs` | integer | no | ... for at least this many seconds. Clamped to 300..7200; default 900. |

Example:

```json
{
  "down_pct": 30,
  "down_secs": 900,
  "enabled": true,
  "target_cpu": 4,
  "target_ram_mb": 8192,
  "up_pct": 80,
  "up_secs": 300
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `feature` | boolean | yes | Whether the site sells Auto Scaling. When `false`, enabling it fails with `403 feature_disabled`. |
| `prepaid` | boolean | yes | `true` for a server on a prepaid cycle (monthly, yearly, multi-year, including a paid Black Friday server). Its prepaid plan, expiry and renewal price never change; only the extra capacity is billed separately by the hour (see `extra`). `false` for an hourly server, which is billed for the whole size by the hour as before. |
| `extra` | object or null | yes | Billing of the extra capacity of a prepaid server; null for an hourly server. |
| `extra.billing` | string | yes | Always `separate_hourly`: the extra capacity is billed by the hour on top of the prepaid plan. |
| `extra.active` | boolean | yes | `true` while the server really runs larger than its base size and the extra is being billed. |
| `extra.hourly_uusd` | integer | yes | Price per hour of the extra capacity (target size minus base size, at the normal hourly price list) in millionths of a US dollar. While `active` this is the price being charged; otherwise the price the saved target would cost. |
| `extra.preview_hourly_uusd` | integer | yes | Price per hour the saved target would add on top of the base size, in millionths of a US dollar. |
| `extra.monthly_cents` | integer | yes | `hourly_uusd` for a 730-hour month in US cents. |
| `extra.wallet_hours` | integer | yes | Hours of extra capacity your balance must cover to turn Auto Scaling on and for every size increase (the `autoscale_wallet_hours` setting, 24 by default). |
| `extra.need_cents` | integer | yes | Balance in US cents that covers `wallet_hours` of the saved target's extra. |
| `extra.billed_until` | integer or null | yes | End of the last hour of extra capacity that has been paid; the next hour is charged when it passes. Null unless `active`. (Unix time, seconds, UTC) |
| `extra.started_at` | integer or null | yes | When the current increase started (the first hour is paid at that moment). Null unless `active`. (Unix time, seconds, UTC) |
| `extra.warn_at` | integer or null | yes | When the low-balance warning was sent; null when none is pending. (Unix time, seconds, UTC) |
| `extra.revert_at` | integer or null | yes | When the server will be restarted back to its base size if the balance is not topped up: `warn_at` plus 24 hours. Topping up before it cancels the schedule. (Unix time, seconds, UTC) |
| `extra.covered_until` | integer or null | yes | When the current balance runs out for the extra capacity at the current price. Null unless `active`. (Unix time, seconds, UTC) |
| `enabled` | boolean | yes | Whether the rule is switched on. |
| `state` | string: `base`, `scaled`, `cooling` | yes | `base`: at the base size, billed at the base price. `scaled`: grown to the target size, billed at the target price. `cooling`: the load is gone but the server keeps the larger size and is billed at the base price until it is returned to base. |
| `base` | object | yes | Base size: the configuration the server returns to. |
| `base.cpu` | integer | yes | Virtual CPU cores. |
| `base.ram_mb` | integer | yes | Memory in MiB. |
| `base.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `current` | object | yes | Size the server has right now. |
| `current.cpu` | integer | yes | Virtual CPU cores. |
| `current.ram_mb` | integer | yes | Memory in MiB. |
| `current.hourly_uusd` | integer | yes | Price per hour of this size in millionths of a US dollar. |
| `target` | object | yes | Size the server grows to when the load is high. |
| `target.cpu` | integer | yes | Target virtual CPU cores; 0 when no rule was ever saved. |
| `target.ram_mb` | integer | yes | Target memory in MiB; 0 when no rule was ever saved. |
| `target.hourly_uusd` | integer | yes | Price per hour of the target size in millionths of a US dollar; 0 when no target is set. |
| `target.monthly_cents` | integer | yes | Price of the target size for a 730-hour month in US cents. |
| `rule` | AutoscaleThresholds | yes | Load thresholds of an Auto Scaling rule. |
| `rule.up_pct` | integer | yes | Grow when load stays at or above this percentage (50 to 95). |
| `rule.up_secs` | integer | yes | ... for at least this many seconds (120 to 1800). |
| `rule.down_pct` | integer | yes | Consider the load gone when it stays at or below this percentage (5 to 60). Always lower than `up_pct`. |
| `rule.down_secs` | integer | yes | ... for at least this many seconds (300 to 7200). |
| `caps` | object | yes | Limits of the rule fields and of the site. |
| `caps.up_pct` | array of integer | yes | [min, max] allowed for `up_pct`. |
| `caps.up_secs` | array of integer | yes | [min, max] allowed for `up_secs`. |
| `caps.down_pct` | array of integer | yes | [min, max] allowed for `down_pct`. |
| `caps.down_secs` | array of integer | yes | [min, max] allowed for `down_secs`. |
| `caps.max_cpu` | integer | yes | Largest `target_cpu` accepted by the site. |
| `caps.max_ram_mb` | integer | yes | Largest `target_ram_mb` accepted by the site. |
| `caps.max_steps_day` | integer | yes | Largest number of automatic size changes per server per day. |
| `pending_revert` | boolean | yes | The server is larger than its base size and will return to base size on its next restart. |
| `cooling_since` | integer or null | yes | When the state became `cooling` (Unix time, seconds, UTC) |
| `revert_available` | boolean | yes | The server is currently larger than its base size because of Auto Scaling and no return is under way, so Return to base size can be called. |
| `revert_manual` | boolean | yes | A return to base size that you requested is waiting or running. |
| `revert_at` | integer or null | yes | When an automatic return to base size is planned (Unix time, seconds, UTC) |
| `revert_phase` | string or null | yes | Step of a return to base size that is under way: `stopping`, `reverting` or `starting`; null when none. |
| `ram_used_mb` | integer or null | yes | Memory in use inside the server at the last measurement, in MiB. |
| `ram_stats_at` | integer or null | yes | When `ram_used_mb` was measured (Unix time, seconds, UTC) |
| `last_error` | string or null | yes | Short code of the most recent automatic step that failed or was held back, for example `insufficient_funds`, `cooldown` or `cluster_full`; null when there is none. |
| `last_error_at` | integer or null | yes | When `last_error` happened (Unix time, seconds, UTC) |
| `blocked` | array of string | yes | Reasons Auto Scaling cannot work on this server right now; empty when it can. Values: `vm_locked`, `vm_not_active`, `job_running`, `ram_slots_exhausted`, `needs_reboot`, `bf_locked` (a trial or refund-pending Black Friday server), `renewal_due` (a prepaid server that has expired), `windows_unsupported`, `template_no_cpu_hotplug`. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "balance_cents": 2500,
  "base": {
    "cpu": 2,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "blocked": [],
  "caps": {
    "down_pct": [
      5,
      60
    ],
    "down_secs": [
      300,
      7200
    ],
    "max_cpu": 8,
    "max_ram_mb": 16384,
    "max_steps_day": 4,
    "up_pct": [
      50,
      95
    ],
    "up_secs": [
      120,
      1800
    ]
  },
  "cooling_since": null,
  "current": {
    "cpu": 2,
    "hourly_uusd": 16460,
    "ram_mb": 4096
  },
  "enabled": true,
  "extra": null,
  "feature": true,
  "last_error": null,
  "last_error_at": null,
  "pending_revert": false,
  "prepaid": false,
  "ram_stats_at": null,
  "ram_used_mb": null,
  "revert_at": null,
  "revert_available": false,
  "revert_manual": false,
  "revert_phase": null,
  "rule": {
    "down_pct": 30,
    "down_secs": 900,
    "up_pct": 80,
    "up_secs": 300
  },
  "state": "base",
  "target": {
    "cpu": 4,
    "hourly_uusd": 32920,
    "monthly_cents": 2403,
    "ram_mb": 8192
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | `enabled` is true but `target_cpu` or `target_ram_mb` is missing or not a number. |
| 400 | `bad_input` | The target is outside the limits of the site (`detail` explains which value and the allowed range). |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Prepaid server: your balance does not cover 24 hours of the extra capacity of the target size. The body carries `need_cents` and `balance_cents`; nothing is charged. |
| 403 | `feature_disabled` | The site does not sell Auto Scaling. |
| 403 | `quota_exceeded` | The target size would exceed your account resource quota. The body carries the usage, the limit and the next tier. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `needs_reboot` | The server must be restarted once before it can use Auto Scaling, or its image cannot bring added vCPUs online (`detail`: `template_no_cpu_hotplug`). Restart it with [Restart for scaling](#operation/vm_scale_reboot), or reinstall it from a current image. |
| 409 | `bf_locked` | A Black Friday trial server (or one with a pending refund) cannot use Auto Scaling; a paid Black Friday server can. |
| 409 | `autoscale_renewal_due` | A prepaid server has expired: renew it first. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`autoscale`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `windows_unsupported` | Auto Scaling is not available for Windows servers. |
| 422 | `ram_step` | `target_ram_mb` is not a multiple of 1024. |
| 422 | `autoscale_target_too_low` | The target is not larger than the current size in vCPUs or RAM. The body carries `base_cpu` and `base_ram_mb`. |
| 422 | `invalid_argument` | The target is above the site ceiling (the body carries `max_cpu` and `max_ram_mb`), or `down_pct` is not lower than `up_pct` (`field`: `down_pct`). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 429 | `rate_limited` | More than 20 requests in a minute for this account. The body carries `retry_after` in seconds. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/vm/<id>/autoscale" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"down_pct":30,"down_secs":900,"enabled":true,"target_cpu":4,"target_ram_mb":8192,"up_pct":80,"up_secs":300}'
```

---

#### Auto Scaling of all VMs in the account (paged)

`GET /v1/autoscale`

Lists the Auto Scaling configuration of all servers of your account in one call. A server is listed when its rule is enabled, when a target size was saved for it, or when it currently is not in the `base` state. Deleted servers are not listed. Read-only; use [Set Auto Scaling](#operation/vm_autoscale_set) to change a rule.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `autoscale list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page, at most 100. Larger values are clamped. |
| `sort` | string: `name`, `enabled`, `state`, `current`, `target`, `updated_at` | no | Field to sort by: server name, rule switch, state, current vCPUs, target vCPUs or last update. Unknown values fall back to `updated_at`. |
| `dir` | string: `asc`, `desc` | no | Sort direction. Anything other than `asc` means `desc`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AutoscaleListItem | yes |  |
| `items[].vm_id` | string | yes | VM identifier (UUID). |
| `items[].hostname` | string | yes | Host name of the server. |
| `items[].display_name` | string | yes | Display name of the server (empty string when none was set). |
| `items[].vm_state` | string | yes | Lifecycle state of the server, for example `active`. |
| `items[].cs_state` | string or null | yes | Power state reported by the platform, for example `Running`; null until first known. |
| `items[].cycle` | string | yes | Billing cycle slug of the server: `hourly` or a prepaid cycle such as `monthly`. |
| `items[].enabled` | boolean | yes | Whether the rule is switched on. |
| `items[].state` | string: `base`, `scaled`, `cooling` | yes | Auto Scaling state, as in Get Auto Scaling. |
| `items[].base` | object | yes | Base size. |
| `items[].base.cpu` | integer | yes | Base vCPU cores. |
| `items[].base.ram_mb` | integer | yes | Base memory in MiB. |
| `items[].current` | object | yes | Size right now. |
| `items[].current.cpu` | integer | yes | Current vCPU cores. |
| `items[].current.ram_mb` | integer | yes | Current memory in MiB. |
| `items[].target` | object | yes | Size the server grows to. |
| `items[].target.cpu` | integer | yes | Target vCPU cores (0 when unset). |
| `items[].target.ram_mb` | integer | yes | Target memory in MiB (0 when unset). |
| `items[].rule` | AutoscaleThresholds | yes | Load thresholds of an Auto Scaling rule. |
| `items[].rule.up_pct` | integer | yes | Grow when load stays at or above this percentage (50 to 95). |
| `items[].rule.up_secs` | integer | yes | ... for at least this many seconds (120 to 1800). |
| `items[].rule.down_pct` | integer | yes | Consider the load gone when it stays at or below this percentage (5 to 60). Always lower than `up_pct`. |
| `items[].rule.down_secs` | integer | yes | ... for at least this many seconds (300 to 7200). |
| `items[].scaled_at` | integer or null | yes | When the server last grew (Unix time, seconds, UTC) |
| `items[].cooling_since` | integer or null | yes | When the state became `cooling` (Unix time, seconds, UTC) |
| `items[].pending_revert` | boolean | yes | The server will return to base size on its next restart. |
| `items[].last_error` | string or null | yes | Short code of the most recent step that failed or was held back. |
| `items[].last_error_at` | integer or null | yes | When `last_error` happened (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | When the rule was last changed or updated (Unix time, seconds, UTC) |
| `items[].last_event` | object or null | yes | Most recent successful size change of the server; null when there was none. |
| `items[].last_event.at` | integer | yes | When it happened (Unix time, seconds, UTC) |
| `items[].last_event.kind` | string | yes | `up`, `down` or `revert`. |
| `items[].last_event.source` | string | yes | `manual`, `autoscale` or `revert`. |
| `items[].last_event.to_cpu` | integer or null | yes | vCPU cores after the change. |
| `items[].last_event.to_ram_mb` | integer or null | yes | Memory in MiB after the change. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field actually applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "base": {
        "cpu": 2,
        "ram_mb": 4096
      },
      "cooling_since": null,
      "cs_state": "Running",
      "current": {
        "cpu": 4,
        "ram_mb": 8192
      },
      "cycle": "hourly",
      "display_name": "Web frontend",
      "enabled": true,
      "hostname": "web-1",
      "last_error": null,
      "last_error_at": null,
      "last_event": {
        "at": 1790000400,
        "kind": "up",
        "source": "autoscale",
        "to_cpu": 4,
        "to_ram_mb": 8192
      },
      "pending_revert": true,
      "rule": {
        "down_pct": 30,
        "down_secs": 900,
        "up_pct": 80,
        "up_secs": 300
      },
      "scaled_at": 1790000400,
      "state": "scaled",
      "target": {
        "cpu": 4,
        "ram_mb": 8192
      },
      "updated_at": 1790000400,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_state": "active"
    }
  ],
  "page": 1,
  "per_page": 25,
  "sort": "updated_at",
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/autoscale" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Scaling history of the account (paged, filterable)

`GET /v1/vm/scale-events`

Lists the size changes of the servers of your account, newest first: resizes you requested, scheduled ones, automatic growth by Auto Scaling, returns to base size, and automatic growth that was held back (`kind: blocked`, with the `reason`). Each entry shows the size before and after, the hourly prices, what was charged or refunded and whether the change was applied without a restart.

The filters narrow the list; `vm_id` is only a filter, so another account's server id simply matches nothing. Limited to 60 requests per minute per account.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `scale events`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | no | Only events of this server (UUID). |
| `source` | string | no | Only events with this source, for example `manual`, `autoscale` or `revert`. Exact match. |
| `kind` | string | no | Only events of this kind, for example `up`, `down`, `revert` or `blocked`. Exact match. |
| `from` | integer | no | Only events at or after this time (Unix seconds). A value that is not a number is ignored. |
| `to` | integer | no | Only events at or before this time (Unix seconds). A value that is not a number is ignored. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page, at most 100. Larger values are clamped. |
| `sort` | string: `at`, `id`, `cpu_pct`, `charged_cents`, `source`, `kind`, `to_cpu`, `to_ram_mb` | no | Field to sort by. Unknown values fall back to `at`. |
| `dir` | string: `asc`, `desc` | no | Sort direction. Anything other than `asc` means `desc`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of ScaleEvent | yes |  |
| `items[].id` | integer | yes | Event identifier. |
| `items[].at` | integer | yes | When the event was recorded (Unix time, seconds, UTC) |
| `items[].vm_id` | string | yes | VM identifier (UUID). |
| `items[].source` | string | yes | What started it: `manual` (a resize requested through the API or the dashboard, including scheduled ones), `autoscale` (Auto Scaling) or `revert` (return to base size). Other values may appear in future. |
| `items[].kind` | string | yes | What happened: `up` (grew), `down` (shrank), `revert` (returned to base size), `blocked` (Auto Scaling wanted to grow but was held back, see `reason`) or `pending` (a request that is still being processed). Other values may appear in future. |
| `items[].from` | object | yes | Size before the change. |
| `items[].from.cpu` | integer or null | yes | vCPU cores before. |
| `items[].from.ram_mb` | integer or null | yes | Memory in MiB before. |
| `items[].from.disk_gb` | integer or null | yes | Disk in GiB before. |
| `items[].from.hourly_uusd` | integer or null | yes | Hourly price before, in millionths of a US dollar. |
| `items[].to` | object | yes | Size after the change (the target size for a `blocked` event). |
| `items[].to.cpu` | integer or null | yes | vCPU cores after. |
| `items[].to.ram_mb` | integer or null | yes | Memory in MiB after. |
| `items[].to.disk_gb` | integer or null | yes | Disk in GiB after. |
| `items[].to.hourly_uusd` | integer or null | yes | Hourly price after, in millionths of a US dollar; may be 0 or null when not applicable. |
| `items[].cpu_pct` | integer or null | yes | CPU load in percent that triggered an automatic change; null for manual changes. |
| `items[].live` | boolean | yes | The change was applied without restarting the server. |
| `items[].charged_cents` | integer | yes | Amount charged to your wallet for the change, in US cents. |
| `items[].refunded_cents` | integer | yes | Amount refunded to your wallet for the change, in US cents. |
| `items[].job_id` | integer or null | yes | Background job that carried the change out, when there was one. |
| `items[].ok` | boolean | yes | `false` for a change that did not happen (`blocked`, or still `pending`). |
| `items[].reason` | string or null | yes | Short machine-readable note, for example `scheduled`, or the reason a change was held back: `insufficient_funds`, `cooldown`, `max_steps_day`, `cluster_full`, `quota_exceeded`, `under_attack`, ... |
| `items[].actor` | string | yes | Who or what caused the event: `customer:<account id>` for changes made with your account, or an identifier starting with `system:` for automatic actions (`system:autoscale`, `system:scale_sched`, `system:scale_revert`). Treat the value as an opaque label. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field actually applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "actor": "customer:1042",
      "at": 1790001200,
      "charged_cents": 2,
      "cpu_pct": null,
      "from": {
        "cpu": 2,
        "disk_gb": 50,
        "hourly_uusd": 16460,
        "ram_mb": 4096
      },
      "id": 211,
      "job_id": 18342,
      "kind": "up",
      "live": true,
      "ok": true,
      "reason": null,
      "refunded_cents": 0,
      "source": "manual",
      "to": {
        "cpu": 2,
        "disk_gb": 50,
        "hourly_uusd": 21940,
        "ram_mb": 8192
      },
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "page": 1,
  "per_page": 25,
  "sort": "at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 429 | `rate_limited` | More than 60 requests in a minute for this account. The body carries `retry_after` in seconds. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/scale-events" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Block Storage

Extra data volumes you can attach to a server. A volume is billed per GB-hour from the moment it is ready until it is deleted, also while it is detached, and keeps its data when detached. Creating and enlarging a volume costs money and, like deleting one, requires an `Idempotency-Key`. Available only on sites that sell Block Storage; when it is switched off every operation fails with `501 feature_disabled`.

#### Data volumes attached to the VM

`GET /v1/vm/{id}/data-volumes`

Lists the data volumes attached to one server, with how many more it can take and the total size attached. These are the extra volumes you bought; the system disk of the server is not included. Use [List volumes](#operation/volume_list) for all volumes of the account, attached or not.

**Required scope:** `vm:read`.

Scope: `vm:read` | CLI: `vm data-volumes`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID) as returned by List VMs. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BlockVolume | yes |  |
| `items[].id` | integer | yes | Volume identifier. Use it as `vid` in the volume operations. |
| `items[].name` | string | yes | Name of the volume. |
| `items[].size_gb` | integer | yes | Size in GB. |
| `items[].state` | string: `Creating`, `Ready`, `Attaching`, `Attached`, `Detaching`, `Resizing`, `Deleting`, `Error` | yes | Lifecycle state. `Ready`: created and not attached. `Attached`: attached to the server in `vm_id`. `Creating`, `Attaching`, `Detaching`, `Resizing` and `Deleting` are transitions in progress (`busy` is true). `Error`: the volume could not be created; see `last_error`. |
| `items[].busy` | boolean | yes | `true` while a transition is in progress; the volume rejects new operations with `409 volume_busy` until it ends. |
| `items[].vm_id` | string or null | yes | Server (UUID) the volume is attached to; null when it is not attached. |
| `items[].device_id` | integer or null | yes | Device number the volume got inside the server; null when not attached. |
| `items[].hourly_uusd` | integer | yes | What this volume costs per hour at its rate, in millionths of a US dollar (`size_gb` times `rate_uusd_gb_hour`). |
| `items[].rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour that applies to this volume, in millionths of a US dollar. It is fixed when the volume is created and never goes up; if the site lowers its price the lower price applies. |
| `items[].cents_per_month` | integer | yes | What this volume costs for a month of `hours_per_month` hours, in US cents. |
| `items[].hours_per_month` | integer | yes | Hours in a billing month used for `cents_per_month` (730 by default). |
| `items[].paid_cents` | integer | yes | Total charged to your wallet for this volume so far, in US cents. |
| `items[].debt_since` | integer or null | yes | Since when the wallet could not cover the hourly charges; null when nothing is owed (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the volume was requested (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Human-readable reason the last operation on this volume failed; null when it did not. |
| `items[].error_code` | string or null | yes | Short code for `last_error`, for example `capacity`, `timeout`, `resize` or `error`; null when there is no error. |
| `meta` | object | yes | Counts and site limits. |
| `meta.count` | integer | yes | Number of volumes attached to the server. |
| `meta.max_per_vm` | integer | yes | Most volumes that may be attached to one server. |
| `meta.remaining` | integer | yes | How many more volumes the server can take. |
| `meta.min_gb` | integer | yes | Smallest allowed volume size in GB. |
| `meta.max_gb` | integer | yes | Largest allowed volume size in GB. |
| `meta.step_gb` | integer | yes | Sizes must be the smallest size plus a multiple of this step, in GB. |
| `meta.total_gb` | integer | yes | Total size of the attached volumes in GB. |
| `price` | VolumePrice | yes |  |
| `price.size_gb` | integer | yes | Size in GB this price is computed for. |
| `price.rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour, in millionths of a US dollar. |
| `price.uusd_per_hour` | integer | yes | Price per hour for `size_gb`, in millionths of a US dollar. |
| `price.cents_per_hour` | integer | yes | Price per hour for `size_gb` rounded to US cents; can be 0 for small volumes. |
| `price.cents_per_month` | integer | yes | Price for `hours_per_month` hours in US cents. |
| `price.hours_per_month` | integer | yes | Hours in a billing month used to compute `cents_per_month` (730 by default). |

Example:

```json
{
  "items": [
    {
      "busy": false,
      "cents_per_month": 248,
      "created_at": 1789990000,
      "debt_since": null,
      "device_id": 1,
      "error_code": null,
      "hourly_uusd": 3400,
      "hours_per_month": 730,
      "id": 4172,
      "last_error": null,
      "name": "data-1",
      "paid_cents": 41,
      "rate_uusd_gb_hour": 34,
      "size_gb": 100,
      "state": "Attached",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "meta": {
    "count": 1,
    "max_gb": 2000,
    "max_per_vm": 5,
    "min_gb": 10,
    "remaining": 4,
    "step_gb": 10,
    "total_gb": 100
  },
  "price": {
    "cents_per_hour": 0,
    "cents_per_month": 25,
    "hours_per_month": 730,
    "rate_uusd_gb_hour": 34,
    "size_gb": 10,
    "uusd_per_hour": 340
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`volumes`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/data-volumes" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List data volumes (paged, sortable)

`GET /v1/volumes`

Lists the data volumes of your account, attached or not, with the limits and the price of the smallest volume. Deleted volumes are not listed.

The answer has the shape `{items, meta, price}`: `items` are the volumes of the requested page, `meta` carries the paging details and the site limits (smallest and largest size, size step, volumes allowed per account and per server) and `price` is the unit price of your site, computed for the smallest allowed volume. Use [Quote a volume](#operation/volume_quote) for another size.

**Required scope:** `volume:read`.

Scope: `volume:read` | CLI: `volume list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page, at most 100. Larger values are clamped. |
| `sort` | string: `created_at`, `name`, `size_gb`, `state`, `paid_cents` | no | Field to sort by. Unknown values fall back to `created_at`. |
| `dir` | string: `asc`, `desc` | no | Sort direction. Anything other than `asc` means `desc`. |
| `vm_id` | string | no | Only volumes attached to this server (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BlockVolume | yes |  |
| `items[].id` | integer | yes | Volume identifier. Use it as `vid` in the volume operations. |
| `items[].name` | string | yes | Name of the volume. |
| `items[].size_gb` | integer | yes | Size in GB. |
| `items[].state` | string: `Creating`, `Ready`, `Attaching`, `Attached`, `Detaching`, `Resizing`, `Deleting`, `Error` | yes | Lifecycle state. `Ready`: created and not attached. `Attached`: attached to the server in `vm_id`. `Creating`, `Attaching`, `Detaching`, `Resizing` and `Deleting` are transitions in progress (`busy` is true). `Error`: the volume could not be created; see `last_error`. |
| `items[].busy` | boolean | yes | `true` while a transition is in progress; the volume rejects new operations with `409 volume_busy` until it ends. |
| `items[].vm_id` | string or null | yes | Server (UUID) the volume is attached to; null when it is not attached. |
| `items[].device_id` | integer or null | yes | Device number the volume got inside the server; null when not attached. |
| `items[].hourly_uusd` | integer | yes | What this volume costs per hour at its rate, in millionths of a US dollar (`size_gb` times `rate_uusd_gb_hour`). |
| `items[].rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour that applies to this volume, in millionths of a US dollar. It is fixed when the volume is created and never goes up; if the site lowers its price the lower price applies. |
| `items[].cents_per_month` | integer | yes | What this volume costs for a month of `hours_per_month` hours, in US cents. |
| `items[].hours_per_month` | integer | yes | Hours in a billing month used for `cents_per_month` (730 by default). |
| `items[].paid_cents` | integer | yes | Total charged to your wallet for this volume so far, in US cents. |
| `items[].debt_since` | integer or null | yes | Since when the wallet could not cover the hourly charges; null when nothing is owed (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the volume was requested (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Human-readable reason the last operation on this volume failed; null when it did not. |
| `items[].error_code` | string or null | yes | Short code for `last_error`, for example `capacity`, `timeout`, `resize` or `error`; null when there is no error. |
| `meta` | object | yes | Paging details and site limits. |
| `meta.total` | integer | yes | Number of volumes matching the filter, across all pages. |
| `meta.page` | integer | yes | Current page number (1-based). |
| `meta.per_page` | integer | yes | Page size actually applied. |
| `meta.last_page` | integer | yes | Number of the last page; 0 when there are no volumes. |
| `meta.sort` | string | yes | Sort field actually applied. |
| `meta.dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |
| `meta.max_per_account` | integer | yes | Most volumes one account may have. |
| `meta.max_per_vm` | integer | yes | Most volumes that may be attached to one server. |
| `meta.min_gb` | integer | yes | Smallest allowed volume size in GB. |
| `meta.max_gb` | integer | yes | Largest allowed volume size in GB. |
| `meta.step_gb` | integer | yes | Sizes must be the smallest size plus a multiple of this step, in GB. |
| `price` | VolumePrice | yes |  |
| `price.size_gb` | integer | yes | Size in GB this price is computed for. |
| `price.rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour, in millionths of a US dollar. |
| `price.uusd_per_hour` | integer | yes | Price per hour for `size_gb`, in millionths of a US dollar. |
| `price.cents_per_hour` | integer | yes | Price per hour for `size_gb` rounded to US cents; can be 0 for small volumes. |
| `price.cents_per_month` | integer | yes | Price for `hours_per_month` hours in US cents. |
| `price.hours_per_month` | integer | yes | Hours in a billing month used to compute `cents_per_month` (730 by default). |

Example:

```json
{
  "items": [
    {
      "busy": false,
      "cents_per_month": 248,
      "created_at": 1789990000,
      "debt_since": null,
      "device_id": 1,
      "error_code": null,
      "hourly_uusd": 3400,
      "hours_per_month": 730,
      "id": 4172,
      "last_error": null,
      "name": "data-1",
      "paid_cents": 41,
      "rate_uusd_gb_hour": 34,
      "size_gb": 100,
      "state": "Attached",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "meta": {
    "dir": "desc",
    "last_page": 1,
    "max_gb": 2000,
    "max_per_account": 20,
    "max_per_vm": 5,
    "min_gb": 10,
    "page": 1,
    "per_page": 20,
    "sort": "created_at",
    "step_gb": 10,
    "total": 1
  },
  "price": {
    "cents_per_hour": 0,
    "cents_per_month": 25,
    "hours_per_month": 730,
    "rate_uusd_gb_hour": 34,
    "size_gb": 10,
    "uusd_per_hour": 340
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl "https://api.onie.net/v1/volumes" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a data volume by size

`GET /v1/volumes/quote`

Returns the price of a volume of the given size at your site, per hour and per month, without creating anything and without charging. The price is per GB-hour, so the monthly figure is only an estimate for a volume kept for a whole month. Omit `size_gb` to quote the smallest allowed size.

**Required scope:** `volume:read`.

Scope: `volume:read` | CLI: `volume quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `size_gb` | integer | no | Volume size in GB: between the smallest and largest size of the site, in steps of the size step (see `meta` of List volumes). Defaults to the smallest size. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `size_gb` | integer | yes | Size in GB this price is computed for. |
| `rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour, in millionths of a US dollar. |
| `uusd_per_hour` | integer | yes | Price per hour for `size_gb`, in millionths of a US dollar. |
| `cents_per_hour` | integer | yes | Price per hour for `size_gb` rounded to US cents; can be 0 for small volumes. |
| `cents_per_month` | integer | yes | Price for `hours_per_month` hours in US cents. |
| `hours_per_month` | integer | yes | Hours in a billing month used to compute `cents_per_month` (730 by default). |

Example:

```json
{
  "cents_per_hour": 0,
  "cents_per_month": 248,
  "hours_per_month": 730,
  "rate_uusd_gb_hour": 34,
  "size_gb": 100,
  "uusd_per_hour": 3400
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 422 | `invalid_argument` | `size_gb` is outside the allowed range or not on the size step. The body carries `field`, `min_gb`, `max_gb` and `step_gb`. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl "https://api.onie.net/v1/volumes/quote" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one data volume

`GET /v1/volumes/{vid}`

Returns one volume with its state, the server it is attached to, its price and what it has cost so far. Poll this operation after a create, attach, detach, resize or delete call until `busy` is false; a deleted volume answers `404`.

**Required scope:** `volume:read`.

Scope: `volume:read` | CLI: `volume get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vid` | string | yes | Volume identifier (integer) as returned by List volumes. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Volume identifier. Use it as `vid` in the volume operations. |
| `name` | string | yes | Name of the volume. |
| `size_gb` | integer | yes | Size in GB. |
| `state` | string: `Creating`, `Ready`, `Attaching`, `Attached`, `Detaching`, `Resizing`, `Deleting`, `Error` | yes | Lifecycle state. `Ready`: created and not attached. `Attached`: attached to the server in `vm_id`. `Creating`, `Attaching`, `Detaching`, `Resizing` and `Deleting` are transitions in progress (`busy` is true). `Error`: the volume could not be created; see `last_error`. |
| `busy` | boolean | yes | `true` while a transition is in progress; the volume rejects new operations with `409 volume_busy` until it ends. |
| `vm_id` | string or null | yes | Server (UUID) the volume is attached to; null when it is not attached. |
| `device_id` | integer or null | yes | Device number the volume got inside the server; null when not attached. |
| `hourly_uusd` | integer | yes | What this volume costs per hour at its rate, in millionths of a US dollar (`size_gb` times `rate_uusd_gb_hour`). |
| `rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour that applies to this volume, in millionths of a US dollar. It is fixed when the volume is created and never goes up; if the site lowers its price the lower price applies. |
| `cents_per_month` | integer | yes | What this volume costs for a month of `hours_per_month` hours, in US cents. |
| `hours_per_month` | integer | yes | Hours in a billing month used for `cents_per_month` (730 by default). |
| `paid_cents` | integer | yes | Total charged to your wallet for this volume so far, in US cents. |
| `debt_since` | integer or null | yes | Since when the wallet could not cover the hourly charges; null when nothing is owed (Unix time, seconds, UTC) |
| `created_at` | integer | yes | When the volume was requested (Unix time, seconds, UTC) |
| `last_error` | string or null | yes | Human-readable reason the last operation on this volume failed; null when it did not. |
| `error_code` | string or null | yes | Short code for `last_error`, for example `capacity`, `timeout`, `resize` or `error`; null when there is no error. |

Example:

```json
{
  "busy": false,
  "cents_per_month": 248,
  "created_at": 1789990000,
  "debt_since": null,
  "device_id": 1,
  "error_code": null,
  "hourly_uusd": 3400,
  "hours_per_month": 730,
  "id": 4172,
  "last_error": null,
  "name": "data-1",
  "paid_cents": 41,
  "rate_uusd_gb_hour": 34,
  "size_gb": 100,
  "state": "Attached",
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl "https://api.onie.net/v1/volumes/<vid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a data volume (billed per GB-hour)

`POST /v1/volumes`

Creates an empty data volume, and optionally attaches it to one of your servers when it is ready. **This operation costs money, but nothing is charged at creation.** Billing starts when the volume becomes `Ready` and runs per GB-hour until the volume is deleted (also while it is detached); whole cents are taken from your wallet as they accrue. You need a positive wallet balance to create a volume.

The call answers `202` with the new volume (state `Creating`) and the background `job_id`; poll [Get a volume](#operation/volume_get) until it is `Ready` (or `Attached`). The volume is empty and unformatted: after attaching, create a file system on it inside the server. The size must be between the smallest and largest size of the site, on the size step (see [List volumes](#operation/volume_list)).

`name` keeps only letters, digits, `-`, `_` and `.` (at most 40 characters); without a name the volume is called `data-N`. When `vm_id` is given the server must be yours, active, unlocked and without another operation running; it must not already hold the maximum number of volumes, and when it has backups the site may not allow attaching (`409 has_backups`).

Repeating a request with the same `Idempotency-Key` returns the original response with the header `Idempotency-Replayed: 1` instead of creating a second volume. A repeat that reaches the service by another route (for example with another API key of the same account) is answered `200` with `idempotent_replay: true` and `job_id: null`.

**Required scope:** `volume:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `volume:create` | CLI: `volume create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `size_gb` | integer | yes | Size in GB: between the smallest and largest size of the site, on the size step. |
| `name` | string | no | Name of the volume; letters, digits, `-`, `_` and `.` only (other characters are dropped), at most 40 characters. Defaults to `data-N`. |
| `vm_id` | string | no | Attach the volume to this server (UUID) as soon as it is ready. |

Example:

```json
{
  "name": "data-1",
  "size_gb": 100,
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `volume` | BlockVolume | yes |  |
| `volume.id` | integer | yes | Volume identifier. Use it as `vid` in the volume operations. |
| `volume.name` | string | yes | Name of the volume. |
| `volume.size_gb` | integer | yes | Size in GB. |
| `volume.state` | string: `Creating`, `Ready`, `Attaching`, `Attached`, `Detaching`, `Resizing`, `Deleting`, `Error` | yes | Lifecycle state. `Ready`: created and not attached. `Attached`: attached to the server in `vm_id`. `Creating`, `Attaching`, `Detaching`, `Resizing` and `Deleting` are transitions in progress (`busy` is true). `Error`: the volume could not be created; see `last_error`. |
| `volume.busy` | boolean | yes | `true` while a transition is in progress; the volume rejects new operations with `409 volume_busy` until it ends. |
| `volume.vm_id` | string or null | yes | Server (UUID) the volume is attached to; null when it is not attached. |
| `volume.device_id` | integer or null | yes | Device number the volume got inside the server; null when not attached. |
| `volume.hourly_uusd` | integer | yes | What this volume costs per hour at its rate, in millionths of a US dollar (`size_gb` times `rate_uusd_gb_hour`). |
| `volume.rate_uusd_gb_hour` | integer | yes | Price of 1 GB for 1 hour that applies to this volume, in millionths of a US dollar. It is fixed when the volume is created and never goes up; if the site lowers its price the lower price applies. |
| `volume.cents_per_month` | integer | yes | What this volume costs for a month of `hours_per_month` hours, in US cents. |
| `volume.hours_per_month` | integer | yes | Hours in a billing month used for `cents_per_month` (730 by default). |
| `volume.paid_cents` | integer | yes | Total charged to your wallet for this volume so far, in US cents. |
| `volume.debt_since` | integer or null | yes | Since when the wallet could not cover the hourly charges; null when nothing is owed (Unix time, seconds, UTC) |
| `volume.created_at` | integer | yes | When the volume was requested (Unix time, seconds, UTC) |
| `volume.last_error` | string or null | yes | Human-readable reason the last operation on this volume failed; null when it did not. |
| `volume.error_code` | string or null | yes | Short code for `last_error`, for example `capacity`, `timeout`, `resize` or `error`; null when there is no error. |
| `job_id` | integer or null | yes | Background job that creates the volume; null on an idempotent replay. |
| `idempotent_replay` | boolean | no | Present and `true` when the answer repeats an earlier request with the same `Idempotency-Key`. Such an answer has status 200. |

Example:

```json
{
  "job_id": 18420,
  "volume": {
    "busy": true,
    "cents_per_month": 248,
    "created_at": 1789990000,
    "debt_since": null,
    "device_id": null,
    "error_code": null,
    "hourly_uusd": 3400,
    "hours_per_month": 730,
    "id": 4172,
    "last_error": null,
    "name": "data-1",
    "paid_cents": 0,
    "rate_uusd_gb_hour": 34,
    "size_gb": 100,
    "state": "Creating",
    "vm_id": null
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or a field has the wrong type. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is zero or negative. The body carries `balance_cents`. |
| 403 | `quota_exceeded` | The new volume would exceed your account resource quota. The body carries the usage, the limit and the next tier. |
| 404 | `not_found` | `vm_id` does not exist or is not yours. |
| 409 | `volume_limit` | You already have the maximum number of volumes (`scope`: `account`) or the server already holds the maximum (`scope`: `vm`). The body carries `limit`. |
| 409 | `has_backups` | The server has backups and the site does not allow attaching volumes to such servers. |
| 409 | `vm_not_active` | The server in `vm_id` is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server in `vm_id`. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`volumes`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `size_gb` is outside the allowed range or not on the size step. The body carries `field`, `min_gb`, `max_gb` and `step_gb`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server in `vm_id` is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 10 volumes were requested in a minute by this account from this address. |
| 501 | `feature_disabled` | The site does not sell Block Storage, or Block Storage is not set up yet (`why`: `no_offering`). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/volumes" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"data-1","size_gb":100,"vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

#### Enlarge a data volume (grow only, costs money)

`POST /v1/volumes/{vid}/resize`

Enlarges a volume. **This operation costs money**: from the moment the resize is done the volume is billed per GB-hour at the new size. A volume can only grow, never shrink; a new size equal to or below the current one is rejected. The data on the volume is kept, but the file system has to be extended inside the server afterwards.

The call answers `202` with the background `job_id`; poll [Get a volume](#operation/volume_get) until `busy` is false. The volume must not be busy with another operation. When it is attached, its server must be active, unlocked and without another operation running. The new size must lie within the site limits and on the size step, and the added space must fit your account resource quota.

**Required scope:** `volume:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `volume:create` | CLI: `volume resize` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vid` | string | yes | Volume identifier (integer) as returned by List volumes. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `size_gb` | integer | yes | New size in GB. Must be larger than the current size, within the site limits and on the size step. |

Example:

```json
{
  "size_gb": 200
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that resizes the volume. |

Example:

```json
{
  "job_id": 18433
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or `size_gb` is not a number. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `quota_exceeded` | The extra space would exceed your account resource quota. The body carries the usage, the limit and the next tier. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `volume_busy` | Another operation on the volume has not finished. The body carries the current `state`. |
| 409 | `vm_not_active` | The server the volume is attached to is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server the volume is attached to. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `size_gb` is outside the allowed range or not on the size step. The body carries `field`, `min_gb`, `max_gb` and `step_gb`. |
| 422 | `shrink_not_supported` | `size_gb` is not larger than the current size. The body carries `current_gb`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server the volume is attached to is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 10 resize requests in a minute from this account and address. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/volumes/<vid>/resize" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"size_gb":200}'
```

---

#### Attach a volume to a VM

`POST /v1/volumes/{vid}/attach`

Attaches a detached volume to one of your servers. The call answers `202` with the background `job_id`; poll [Get a volume](#operation/volume_get) until its state is `Attached`, then format and mount it inside the server. Attaching costs nothing; the volume is billed the same attached or not.

The volume must be `Ready` (not attached, not busy) and the server must belong to your account and to the same site as the volume. The server must be active, unlocked, without another operation running, must not already hold the maximum number of volumes, and when it has backups the site may not allow attaching. A missing or unknown `vm_id` is answered `404 not_found`.

**Required scope:** `volume:write`.

Scope: `volume:write` | CLI: `volume attach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vid` | string | yes | Volume identifier (integer) as returned by List volumes. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vm_id` | string | yes | Server (UUID) to attach the volume to. |

Example:

```json
{
  "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that attaches the volume. |

Example:

```json
{
  "job_id": 18434
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The body is not valid JSON or a field has the wrong type. |
| 404 | `not_found` | The volume does not exist or is not yours, or `vm_id` is missing, unknown or belongs to another account. |
| 409 | `volume_busy` | Another operation on the volume has not finished. The body carries the current `state`. |
| 409 | `volume_attached` | The volume is already attached. The body carries the `vm_id` it is attached to. |
| 409 | `volume_limit` | The server already holds the maximum number of volumes. The body carries `limit`. |
| 409 | `has_backups` | The server has backups and the site does not allow attaching volumes to such servers. |
| 409 | `vm_not_active` | The server is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`volumes`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 423 | `vm_locked` | The server is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 10 attach requests in a minute from this account and address. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/volumes/<vid>/attach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vm_id":"3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"}'
```

---

#### Detach a volume from its VM (data kept, still billed)

`POST /v1/volumes/{vid}/detach`

Detaches a volume from its server. The data on the volume is kept and **the volume is still billed per GB-hour** while detached; delete it to stop the charges. Unmount the volume inside the server first so no data is lost. The call answers `202` with the background `job_id`; poll [Get a volume](#operation/volume_get) until its state is `Ready`.

The volume must be attached and not busy; the server it is attached to must be active, unlocked and without another operation running, and when it has backups the site may not allow detaching.

**Required scope:** `volume:write`.

Scope: `volume:write` | CLI: `volume detach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vid` | string | yes | Volume identifier (integer) as returned by List volumes. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that detaches the volume. |

Example:

```json
{
  "job_id": 18435
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `volume_busy` | Another operation on the volume has not finished. The body carries the current `state`. |
| 409 | `volume_detached` | The volume is not attached to a server. |
| 409 | `has_backups` | The server has backups and the site does not allow detaching volumes from such servers. |
| 409 | `vm_not_active` | The server is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server. |
| 423 | `vm_locked` | The server is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 10 detach requests in a minute from this account and address. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/volumes/<vid>/detach" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Delete a data volume (data is lost permanently)

`DELETE /v1/volumes/{vid}`

Deletes a volume and **destroys its data permanently**. If the volume is attached it is detached first. Billing stops when the deletion is done.

The call normally answers `202` with the background `job_id`; poll [Get a volume](#operation/volume_get) until it answers `404`. A volume that was never actually created on the platform is removed on the spot and the call answers `200` with `{"deleted": true, "job_id": null}`. The volume must not be busy with another operation; when it is attached, its server must be active, unlocked and without another operation running.

**Required scope:** `volume:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `volume:destroy` | CLI: `volume delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `vid` | string | yes | Volume identifier (integer) as returned by List volumes. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer or null | yes | Background job that deletes the volume; null when the volume was removed immediately. |
| `deleted` | boolean | no | Present and `true` when the volume was removed immediately (status 200). |

Example:

```json
{
  "job_id": 18436
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `volume_busy` | Another operation on the volume has not finished. The body carries the current `state`. |
| 409 | `vm_not_active` | The server the volume is attached to is not in the `active` state. |
| 409 | `job_running` | Another operation is running on the server the volume is attached to. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server the volume is attached to is locked, for example because of unpaid charges. |
| 429 | `rate_limited` | More than 10 delete requests in a minute from this account and address. |
| 501 | `feature_disabled` | The site does not sell Block Storage. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/volumes/<vid>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

### Backups

Backups of a virtual server disk, taken on demand or automatically on a schedule and kept on separate backup storage. Backup is switched on per server. Storage is billed per GB-hour of the space a backup really uses, taken from the wallet balance; deleting a backup stops its charge. If the account falls into debt (a negative wallet balance, or servers locked for lack of funds) its backups are deleted automatically and its schedules are switched off, so keep the balance positive. Restoring a backup overwrites the server disk. Destroying a server also deletes its backups. Operations that change something run in the background and return a `job_id` (follow it with the VM jobs call). When the site does not sell Backup, every operation fails with `501 feature_disabled`.

#### Backups of all VMs in the account (paged)

`GET /v1/backups`

Lists the backups of all your servers in one paged list. Each item includes the server it belongs to. Backups that were deleted are not shown. Use `vm_id` to narrow the list to one server, or [List the backups of a VM](#operation/vm_backup_list) for the per-server variant.

The list is limited to your own servers; a `vm_id` that is not yours simply returns an empty list.

**Required scope:** `backup:read`.

Scope: `backup:read` | CLI: `backup list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `name`, `size_bytes`, `status`, `interval_type`, `vm` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. `order` is accepted as an alias. |
| `vm_id` | string | no | Only return backups of this server (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BackupListItem | yes |  |
| `items[].id` | integer | yes | Backup identifier. Use it as `bid` in the delete and restore operations. |
| `items[].name` | string | yes | Backup name. For manual backups it is the `name` you gave, or `<hostname>-<date>-<time>`. |
| `items[].type` | string | yes | Backup type. Always `FULL` (every backup is a complete copy of the disk). |
| `items[].interval_type` | string | yes | How the backup was taken: `MANUAL` for backups created on demand, `AUTO` for the nightly automatic backup, or `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` for backups created by the schedule. |
| `items[].status` | string | yes | Current state: `BackingUp` (being created), `BackedUp` (ready, the only state that can be restored), `Restoring`, `Deleting` or `Error`. |
| `items[].size_bytes` | integer | yes | Space the backup uses on backup storage, in bytes. It is 0 until the backup finishes and it is what you are billed for. |
| `items[].size_gb` | number | yes | Same as `size_bytes`, in GiB (1 GiB = 1,073,741,824 bytes). |
| `items[].virtual_size_bytes` | integer | yes | Size of the disk that was backed up, in bytes. It is not what you are billed for. |
| `items[].rate_uusd` | integer | yes | Price locked for this backup, in millionths of a US dollar per GB-hour. If the site price drops, the lower price applies; it never rises for an existing backup. |
| `items[].uusd_per_hour` | integer | yes | What this backup costs now, in millionths of a US dollar per hour (`size_gb` x `rate_uusd`, rounded). 1,000,000 = US$1. |
| `items[].paid_cents` | integer | yes | Total charged so far for this backup, in US cents. |
| `items[].billable` | boolean | yes | Whether the backup is being billed right now. Only finished backups (`BackedUp`) with data are billed. |
| `items[].pinned` | boolean | yes | `true` when the backup is kept: the nightly rotation never deletes it and it is always billed. `false` for rotating nightly backups. |
| `items[].free` | boolean | yes | `true` for the one backup per server that is not billed: the newest rotating (not pinned) backup. Everything else is billed. |
| `items[].auto` | boolean | yes | `true` for backups taken by the nightly automatic schedule (`interval_type` is `AUTO`). |
| `items[].created_at` | integer | yes | When the backup was created (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Short explanation when the backup failed, in the account language. `null` when there was no error. |
| `items[].error_code` | string or null: `cancelled`, `capacity`, `timeout`, `ip_alloc`, `network`, `provision`, `destroy`, `resize`, `error` | yes | Short machine-readable reason when `last_error` is set (`error` = unspecified failure). `null` when there was no error. |
| `items[].vm_id` | string | yes | UUID of the server the backup belongs to. |
| `items[].hostname` | string | yes | Hostname of that server. |
| `items[].vm_name` | string | yes | Display name of that server (its hostname when no display name is set). |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field actually applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Same as the top-level `total`. |
| `meta.page` | integer | yes | Same as the top-level `page`. |
| `meta.per_page` | integer | yes | Same as the top-level `per_page`. |
| `meta.last_page` | integer | yes | Number of the last page. |
| `meta.max_per_vm` | integer | yes | Maximum number of backups the site allows per server. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "auto": false,
      "billable": true,
      "created_at": 1792263600,
      "error_code": null,
      "free": false,
      "hostname": "web-1",
      "id": 41,
      "interval_type": "DAILY",
      "last_error": null,
      "name": "web-1-20261018-0200",
      "paid_cents": 3,
      "pinned": true,
      "rate_uusd": 76,
      "size_bytes": 2147483648,
      "size_gb": 2.0,
      "status": "BackedUp",
      "type": "FULL",
      "uusd_per_hour": 152,
      "virtual_size_bytes": 26843545600,
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_name": "web-1"
    }
  ],
  "meta": {
    "last_page": 1,
    "max_per_vm": 10,
    "page": 1,
    "per_page": 20,
    "total": 1
  },
  "page": 1,
  "per_page": 20,
  "sort": "created_at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl "https://api.onie.net/v1/backups" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### VMs with backup enabled and their schedule (paged)

`GET /v1/backup-schedules`

Lists the servers that have Backup switched on, with the automatic schedule (if one is set) and the number of backups kept. A server with Backup on but no schedule has `has_schedule` false and null schedule fields. Servers without Backup are not listed. Use [Get the backup status of a VM](#operation/vm_backup_get) for one server.

**Required scope:** `backup:read`.

Scope: `backup:read` | CLI: `backup schedule list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `vm`, `interval_type`, `max_backups`, `last_backup_at`, `backups` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. `order` is accepted as an alias. |
| `vm_id` | string | no | Only return this server (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of BackupScheduleListItem | yes |  |
| `items[].enabled` | boolean | yes | Always `true`: only servers with Backup enabled have a schedule object. |
| `items[].interval_type` | string or null: `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` | yes | How often backups are taken automatically. `null` when Backup is enabled but no schedule is set. |
| `items[].schedule` | string or null | yes | Schedule as a compact string: `MM` (HOURLY), `MM:HH` (DAILY) or `MM:HH:DD` (WEEKLY, MONTHLY). `null` when there is no schedule. |
| `items[].minute` | integer or null | yes | Minute of the hour, 0 to 59. `null` when there is no schedule. |
| `items[].hour` | integer or null | yes | Hour of the day, 0 to 23, in `timezone`. `null` for HOURLY schedules and when there is no schedule. |
| `items[].day` | integer or null | yes | Day of the week 1 to 7 (WEEKLY, 1 = Monday) or day of the month 1 to 28 (MONTHLY). `null` for HOURLY and DAILY schedules and when there is no schedule. |
| `items[].timezone` | string | yes | Time zone in which `hour` and `minute` are interpreted, an IANA name such as `Asia/Ho_Chi_Minh`. Set by the site, you cannot change it. |
| `items[].max_backups` | integer | yes | How many backups the schedule keeps. Older scheduled backups are removed automatically when the limit is exceeded. |
| `items[].last_backup_at` | integer or null | yes | When the schedule last produced a backup, `null` if never (Unix time, seconds, UTC) |
| `items[].vm_id` | string | yes | UUID of the server. |
| `items[].hostname` | string | yes | Hostname of the server. |
| `items[].vm_name` | string | yes | Display name of the server (its hostname when no display name is set). |
| `items[].vm_state` | string | yes | Lifecycle state of the server, for example `active`, `provisioning` or `locked`. |
| `items[].cs_state` | string or null | yes | Power state of the server as last seen, for example `Running` or `Stopped`. `null` when unknown. |
| `items[].backups` | integer | yes | Number of backups currently kept for the server. |
| `items[].has_schedule` | boolean | yes | Whether an automatic schedule is set. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field actually applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Same as the top-level `total`. |
| `meta.page` | integer | yes | Same as the top-level `page`. |
| `meta.per_page` | integer | yes | Same as the top-level `per_page`. |
| `meta.last_page` | integer | yes | Number of the last page. |
| `meta.max_per_vm` | integer | yes | Maximum number of backups the site allows per server. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "backups": 1,
      "cs_state": "Running",
      "day": null,
      "enabled": true,
      "has_schedule": true,
      "hostname": "web-1",
      "hour": 2,
      "interval_type": "DAILY",
      "last_backup_at": 1792263600,
      "max_backups": 5,
      "minute": 0,
      "schedule": "0:2",
      "timezone": "Asia/Ho_Chi_Minh",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "vm_name": "web-1",
      "vm_state": "active"
    }
  ],
  "meta": {
    "last_page": 1,
    "max_per_vm": 10,
    "page": 1,
    "per_page": 20,
    "total": 1
  },
  "page": 1,
  "per_page": 20,
  "sort": "created_at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl "https://api.onie.net/v1/backup-schedules" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Backup status of one VM: schedule, kept backups, price

`GET /v1/vm/{id}/backup`

Returns the backup status of one server in a single call: whether Backup is enabled, the automatic schedule, every backup that is kept, the price and what you can do right now. Use `meta.can_create` before asking for a new backup. `pending_job` is true while an enable, disable, create, delete or restore operation is still running on the server.

For a paged and sortable list of the backups only, use [List the backups of a VM](#operation/vm_backup_list).

**Required scope:** `backup:read`.

Scope: `backup:read` | CLI: `vm backup get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether Backup is switched on for the server. |
| `schedule` | BackupSchedule or null | yes |  |
| `items` | array of Backup | yes | All backups kept for the server, newest first. |
| `items[].id` | integer | yes | Backup identifier. Use it as `bid` in the delete and restore operations. |
| `items[].name` | string | yes | Backup name. For manual backups it is the `name` you gave, or `<hostname>-<date>-<time>`. |
| `items[].type` | string | yes | Backup type. Always `FULL` (every backup is a complete copy of the disk). |
| `items[].interval_type` | string | yes | How the backup was taken: `MANUAL` for backups created on demand, `AUTO` for the nightly automatic backup, or `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` for backups created by the schedule. |
| `items[].status` | string | yes | Current state: `BackingUp` (being created), `BackedUp` (ready, the only state that can be restored), `Restoring`, `Deleting` or `Error`. |
| `items[].size_bytes` | integer | yes | Space the backup uses on backup storage, in bytes. It is 0 until the backup finishes and it is what you are billed for. |
| `items[].size_gb` | number | yes | Same as `size_bytes`, in GiB (1 GiB = 1,073,741,824 bytes). |
| `items[].virtual_size_bytes` | integer | yes | Size of the disk that was backed up, in bytes. It is not what you are billed for. |
| `items[].rate_uusd` | integer | yes | Price locked for this backup, in millionths of a US dollar per GB-hour. If the site price drops, the lower price applies; it never rises for an existing backup. |
| `items[].uusd_per_hour` | integer | yes | What this backup costs now, in millionths of a US dollar per hour (`size_gb` x `rate_uusd`, rounded). 1,000,000 = US$1. |
| `items[].paid_cents` | integer | yes | Total charged so far for this backup, in US cents. |
| `items[].billable` | boolean | yes | Whether the backup is being billed right now. Only finished backups (`BackedUp`) with data are billed. |
| `items[].pinned` | boolean | yes | `true` when the backup is kept: the nightly rotation never deletes it and it is always billed. `false` for rotating nightly backups. |
| `items[].free` | boolean | yes | `true` for the one backup per server that is not billed: the newest rotating (not pinned) backup. Everything else is billed. |
| `items[].auto` | boolean | yes | `true` for backups taken by the nightly automatic schedule (`interval_type` is `AUTO`). |
| `items[].created_at` | integer | yes | When the backup was created (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Short explanation when the backup failed, in the account language. `null` when there was no error. |
| `items[].error_code` | string or null: `cancelled`, `capacity`, `timeout`, `ip_alloc`, `network`, `provision`, `destroy`, `resize`, `error` | yes | Short machine-readable reason when `last_error` is set (`error` = unspecified failure). `null` when there was no error. |
| `meta` | object | yes |  |
| `meta.count` | integer | yes | Number of backups kept. |
| `meta.max` | integer | yes | Maximum number of backups allowed per server on this site. |
| `meta.remaining` | integer | yes | How many more backups can be created (`max` minus `count`). |
| `meta.total_size_bytes` | integer | yes | Space used by all billed backups of the server, in bytes. |
| `meta.uusd_per_hour` | integer | yes | Current cost of all backups of the server, in millionths of a US dollar per hour. |
| `meta.cents_per_month` | integer | yes | The same cost over a month of `hours_per_month` hours, in US cents. |
| `meta.hours_per_month` | integer | yes | Hours in a billing month used for `cents_per_month` (730 by default). |
| `meta.rate_uusd_gb_hour` | integer | yes | Current price per GB-hour of backup storage on this site, in millionths of a US dollar. |
| `meta.keep_default` | integer | yes | Number of backups a schedule keeps when you do not choose `max_backups`. |
| `meta.can_create` | boolean | yes | Whether a backup can be created right now: Backup is enabled, the limit is not reached, no other operation is running and the server is active. |
| `meta.vm_running` | boolean | yes | Whether the server is running. A backup can only be created while it is. |
| `pending_job` | boolean | yes | Whether a backup operation is currently running on the server. |

Example:

```json
{
  "enabled": true,
  "items": [
    {
      "auto": false,
      "billable": true,
      "created_at": 1792263600,
      "error_code": null,
      "free": false,
      "id": 41,
      "interval_type": "DAILY",
      "last_error": null,
      "name": "web-1-20261018-0200",
      "paid_cents": 3,
      "pinned": true,
      "rate_uusd": 76,
      "size_bytes": 2147483648,
      "size_gb": 2.0,
      "status": "BackedUp",
      "type": "FULL",
      "uusd_per_hour": 152,
      "virtual_size_bytes": 26843545600
    }
  ],
  "meta": {
    "can_create": true,
    "cents_per_month": 11,
    "count": 1,
    "hours_per_month": 730,
    "keep_default": 3,
    "max": 10,
    "rate_uusd_gb_hour": 76,
    "remaining": 9,
    "total_size_bytes": 2147483648,
    "uusd_per_hour": 152,
    "vm_running": true
  },
  "pending_job": false,
  "schedule": {
    "day": null,
    "enabled": true,
    "hour": 2,
    "interval_type": "DAILY",
    "last_backup_at": 1792263600,
    "max_backups": 5,
    "minute": 0,
    "schedule": "0:2",
    "timezone": "Asia/Ho_Chi_Minh"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/backup" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Backups of one VM (paged, sortable)

`GET /v1/vm/{id}/backups`

Lists the backups of one server with paging and sorting. Backups that were deleted are not shown. The paging details are in `meta` (this list has no top-level `total`, `page` or `per_page`). For an overview that also includes the schedule and the price, use [Get the backup status of a VM](#operation/vm_backup_get).

**Required scope:** `backup:read`.

Scope: `backup:read` | CLI: `vm backup list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `name`, `size_bytes`, `status`, `interval_type` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Backup | yes |  |
| `items[].id` | integer | yes | Backup identifier. Use it as `bid` in the delete and restore operations. |
| `items[].name` | string | yes | Backup name. For manual backups it is the `name` you gave, or `<hostname>-<date>-<time>`. |
| `items[].type` | string | yes | Backup type. Always `FULL` (every backup is a complete copy of the disk). |
| `items[].interval_type` | string | yes | How the backup was taken: `MANUAL` for backups created on demand, `AUTO` for the nightly automatic backup, or `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` for backups created by the schedule. |
| `items[].status` | string | yes | Current state: `BackingUp` (being created), `BackedUp` (ready, the only state that can be restored), `Restoring`, `Deleting` or `Error`. |
| `items[].size_bytes` | integer | yes | Space the backup uses on backup storage, in bytes. It is 0 until the backup finishes and it is what you are billed for. |
| `items[].size_gb` | number | yes | Same as `size_bytes`, in GiB (1 GiB = 1,073,741,824 bytes). |
| `items[].virtual_size_bytes` | integer | yes | Size of the disk that was backed up, in bytes. It is not what you are billed for. |
| `items[].rate_uusd` | integer | yes | Price locked for this backup, in millionths of a US dollar per GB-hour. If the site price drops, the lower price applies; it never rises for an existing backup. |
| `items[].uusd_per_hour` | integer | yes | What this backup costs now, in millionths of a US dollar per hour (`size_gb` x `rate_uusd`, rounded). 1,000,000 = US$1. |
| `items[].paid_cents` | integer | yes | Total charged so far for this backup, in US cents. |
| `items[].billable` | boolean | yes | Whether the backup is being billed right now. Only finished backups (`BackedUp`) with data are billed. |
| `items[].pinned` | boolean | yes | `true` when the backup is kept: the nightly rotation never deletes it and it is always billed. `false` for rotating nightly backups. |
| `items[].free` | boolean | yes | `true` for the one backup per server that is not billed: the newest rotating (not pinned) backup. Everything else is billed. |
| `items[].auto` | boolean | yes | `true` for backups taken by the nightly automatic schedule (`interval_type` is `AUTO`). |
| `items[].created_at` | integer | yes | When the backup was created (Unix time, seconds, UTC) |
| `items[].last_error` | string or null | yes | Short explanation when the backup failed, in the account language. `null` when there was no error. |
| `items[].error_code` | string or null: `cancelled`, `capacity`, `timeout`, `ip_alloc`, `network`, `provision`, `destroy`, `resize`, `error` | yes | Short machine-readable reason when `last_error` is set (`error` = unspecified failure). `null` when there was no error. |
| `meta` | object | yes |  |
| `meta.total` | integer | yes | Total number of backups of the server. |
| `meta.page` | integer | yes | Current page (1-based). |
| `meta.per_page` | integer | yes | Page size applied (clamped to 100). |
| `meta.last_page` | integer | yes | Number of the last page. |
| `meta.sort` | string | yes | Sort field actually applied. |
| `meta.dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |

Example:

```json
{
  "items": [
    {
      "auto": false,
      "billable": true,
      "created_at": 1792263600,
      "error_code": null,
      "free": false,
      "id": 41,
      "interval_type": "DAILY",
      "last_error": null,
      "name": "web-1-20261018-0200",
      "paid_cents": 3,
      "pinned": true,
      "rate_uusd": 76,
      "size_bytes": 2147483648,
      "size_gb": 2.0,
      "status": "BackedUp",
      "type": "FULL",
      "uusd_per_hour": 152,
      "virtual_size_bytes": 26843545600
    }
  ],
  "meta": {
    "dir": "desc",
    "last_page": 1,
    "page": 1,
    "per_page": 20,
    "sort": "created_at",
    "total": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/backups" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Enable backup for the VM (storage is billed)

`POST /v1/vm/{id}/backup/enable`

Switches Backup on for the server, which is required before any backup or schedule can be created. Switching it on costs nothing by itself; you are billed only for backups that exist, per GB-hour of the space they use. The change runs in the background and returns a `job_id`; follow it with the VM jobs call or poll [Get the backup status of a VM](#operation/vm_backup_get) until `enabled` is true.

This operation requires an `Idempotency-Key` header so a retry never queues it twice.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup enable` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that carries out the operation. Follow it with the VM jobs call. |

Example:

```json
{
  "job_id": 8812
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `already_enabled` | Backup is already enabled for this server. |
| 409 | `vm_not_ready` | The server has not finished being created, so Backup cannot be attached yet. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backup/enable" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Disable backup (only when no backups remain)

`POST /v1/vm/{id}/backup/disable`

Switches Backup off for the server. All backups of the server must be deleted first (see [Delete a backup](#operation/vm_backup_delete)); otherwise the call fails with `backups_exist`. Switching it off also stops the schedule. The change runs in the background and returns a `job_id`.

This operation requires an `Idempotency-Key` header.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup disable` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that carries out the operation. Follow it with the VM jobs call. |

Example:

```json
{
  "job_id": 8813
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_enabled` | Backup is not enabled for this server. |
| 409 | `backups_exist` | The server still has backups. Delete every backup before switching Backup off. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backup/disable" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Set the automatic backup schedule

`PUT /v1/vm/{id}/backup/schedule`

Sets the automatic backup schedule of the server, replacing the previous one (a server has at most one schedule). The call is synchronous and returns the new schedule. Scheduled backups are billed like manual ones; the oldest scheduled backups are removed automatically so that no more than `max_backups` are kept.

`minute` is always used (0 to 59). `hour` (0 to 23) is used by DAILY, WEEKLY and MONTHLY and has no effect on HOURLY, but a value outside 0 to 23 is rejected for every interval. `day` is required for WEEKLY (1 to 7, 1 = Monday) and MONTHLY (1 to 28) and ignored otherwise. Times are in the `timezone` reported by [Get the backup status of a VM](#operation/vm_backup_get). Backup must be enabled first.

**Required scope:** `backup:write`.

Scope: `backup:write` | CLI: `vm backup schedule set`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `interval_type` | string: `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` | yes | How often a backup is taken. |
| `minute` | integer | no | Minute of the hour, 0 to 59. Defaults to 0. |
| `hour` | integer | no | Hour of the day, 0 to 23. Defaults to 0. |
| `day` | integer | no | Day of the week (1 to 7, WEEKLY) or day of the month (1 to 28, MONTHLY). Defaults to 0, which is rejected for WEEKLY and MONTHLY. |
| `max_backups` | integer | no | How many scheduled backups to keep, from 1 up to the site maximum per server (values outside the range are clamped). Defaults to the current setting of the server. |

Example:

```json
{
  "hour": 2,
  "interval_type": "DAILY",
  "max_backups": 5,
  "minute": 0
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `schedule` | BackupSchedule | yes | Backup settings of a server: the automatic schedule and the retention limit. |
| `schedule.enabled` | boolean | yes | Always `true`: only servers with Backup enabled have a schedule object. |
| `schedule.interval_type` | string or null: `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY` | yes | How often backups are taken automatically. `null` when Backup is enabled but no schedule is set. |
| `schedule.schedule` | string or null | yes | Schedule as a compact string: `MM` (HOURLY), `MM:HH` (DAILY) or `MM:HH:DD` (WEEKLY, MONTHLY). `null` when there is no schedule. |
| `schedule.minute` | integer or null | yes | Minute of the hour, 0 to 59. `null` when there is no schedule. |
| `schedule.hour` | integer or null | yes | Hour of the day, 0 to 23, in `timezone`. `null` for HOURLY schedules and when there is no schedule. |
| `schedule.day` | integer or null | yes | Day of the week 1 to 7 (WEEKLY, 1 = Monday) or day of the month 1 to 28 (MONTHLY). `null` for HOURLY and DAILY schedules and when there is no schedule. |
| `schedule.timezone` | string | yes | Time zone in which `hour` and `minute` are interpreted, an IANA name such as `Asia/Ho_Chi_Minh`. Set by the site, you cannot change it. |
| `schedule.max_backups` | integer | yes | How many backups the schedule keeps. Older scheduled backups are removed automatically when the limit is exceeded. |
| `schedule.last_backup_at` | integer or null | yes | When the schedule last produced a backup, `null` if never (Unix time, seconds, UTC) |

Example:

```json
{
  "schedule": {
    "day": null,
    "enabled": true,
    "hour": 2,
    "interval_type": "DAILY",
    "last_backup_at": null,
    "max_backups": 5,
    "minute": 0,
    "schedule": "0:2",
    "timezone": "Asia/Ho_Chi_Minh"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON or a field has the wrong type. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_enabled` | Backup is not enabled for this server. Enable it first. |
| 409 | `vm_not_ready` | The server has not finished being created. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 422 | `invalid_argument` | A schedule field is out of range. The response field `field` names it: `bad_interval` (unknown `interval_type`), `bad_time` (`minute` or `hour` out of range) or `bad_day` (`day` missing or out of range for WEEKLY and MONTHLY). |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |
| 502 | `cloudstack_error` | The backup service could not apply the schedule. Nothing was changed; retry later. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/vm/<id>/backup/schedule" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"hour":2,"interval_type":"DAILY","max_backups":5,"minute":0}'
```

---

#### Remove the backup schedule (existing backups are kept)

`DELETE /v1/vm/{id}/backup/schedule`

Removes the automatic schedule of the server. Backups that already exist are kept (and keep being billed until you delete them), and Backup stays enabled so you can still create backups by hand. Removing a schedule that is not set succeeds and returns `schedule: null`.

**Required scope:** `backup:write`.

Scope: `backup:write` | CLI: `vm backup schedule delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `schedule` | BackupSchedule or null | yes |  |

Example:

```json
{
  "schedule": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_enabled` | Backup is not enabled for this server. |
| 409 | `vm_not_ready` | The server has not finished being created. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/backup/schedule" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a backup now (storage is billed)

`POST /v1/vm/{id}/backups`

Creates a backup of the server now. The server must be running and Backup must be enabled. The backup is created in the background: the call returns a `job_id` immediately and the backup appears in the list with status `BackingUp`, then `BackedUp` when it is ready. Find it with [List the backups of a VM](#operation/vm_backup_list); the response does not contain its id.

**Costs money.** From the moment the backup is ready you are billed per GB-hour of the space it really uses (see `rate_uusd`), taken from the wallet balance until you delete it. If the wallet balance is zero or negative the call fails with `insufficient_funds`. This operation requires an `Idempotency-Key` header so a retry never creates two backups.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup create` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | Name for the backup. Only letters, digits, spaces and `- _ .` are kept, at most 60 characters. When empty, the name is `<hostname>-<date>-<time>`. |

Example:

```json
{
  "name": "before-upgrade"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that carries out the operation. Follow it with the VM jobs call. |

Example:

```json
{
  "job_id": 8814
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON or a field has the wrong type. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is zero or negative, so no new billable backup can be created. Top up the wallet and retry. The response includes `balance_cents`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_running` | The server must be running to take a backup. The response includes its current `state`. |
| 409 | `not_enabled` | Backup is not enabled for this server. Enable it first. |
| 409 | `backup_limit` | The server already has the maximum number of backups. The response includes the `limit`. Delete one first. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backups" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"before-upgrade"}'
```

---

#### Delete one backup

`DELETE /v1/vm/{id}/backups/{bid}`

Deletes one backup permanently. It cannot be undone. Billing for the backup stops as soon as the deletion starts. The deletion runs in the background and returns a `job_id`; a backup that never finished being created is removed immediately and the response is `deleted: true` with a null `job_id`. A backup that is being restored or deleted cannot be deleted again.

**Required scope:** `backup:write`.

Scope: `backup:write` | CLI: `vm backup delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `bid` | string | yes | Backup identifier (integer) as returned by the list operations. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer or null | yes | Background job that deletes the backup, or `null` when the backup was removed immediately. |
| `deleted` | boolean | no | `true` only when the backup was removed immediately (no background job). |

Example:

```json
{
  "job_id": 8815
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `backup_busy` | The backup is being restored or deleted. Wait for that to finish. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/vm/<id>/backups/<bid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Pin a backup (never rotated away, billed)

`POST /v1/vm/{id}/backups/{bid}/pin`

Keeps a backup: the nightly rotation never deletes a pinned backup, and it is billed per GB-hour like any other backup. Pinning a backup that is already pinned succeeds with `changed: false`. Only a backup with status `BackedUp` can be pinned. The nightly backup must be switched on by the site, otherwise the call fails with `501 feature_disabled`.

**Costs money.** The free copy is the newest backup that is not pinned; pinning it starts billing. If the wallet balance is zero or negative the call fails with `insufficient_funds`. This operation requires an `Idempotency-Key` header.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup pin` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `bid` | string | yes | Backup identifier (integer) as returned by the list operations. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Backup identifier. |
| `pinned` | boolean | yes | The new pinned state. |
| `changed` | boolean | yes | `false` when the backup was already in that state. |

Example:

```json
{
  "changed": true,
  "id": 91,
  "pinned": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is zero or negative. Top up and retry. |
| 404 | `not_found` | The backup does not exist on this server. |
| 409 | `backup_busy` | The backup is not in the `BackedUp` state (it is being created, restored or deleted). |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backups/<bid>/pin" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Unpin a backup (back into the nightly rotation)

`POST /v1/vm/{id}/backups/{bid}/unpin`

Puts a backup back into the nightly rotation. It is deleted automatically once newer nightly backups exceed the number you keep (see [Set how many backups to keep](#operation/vm_backup_auto_set)). The newest unpinned backup is the free copy. Unpinning a backup that is not pinned succeeds with `changed: false`. This operation requires an `Idempotency-Key` header.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup unpin` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `bid` | string | yes | Backup identifier (integer) as returned by the list operations. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Backup identifier. |
| `pinned` | boolean | yes | The new pinned state. |
| `changed` | boolean | yes | `false` when the backup was already in that state. |

Example:

```json
{
  "changed": true,
  "id": 91,
  "pinned": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The backup does not exist on this server. |
| 409 | `backup_busy` | The backup is not in the `BackedUp` state. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backups/<bid>/unpin" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Set how many nightly backups are kept (extra copies are billed)

`PUT /v1/vm/{id}/backup/auto`

Sets how many rotating (not pinned) nightly backups are kept for the server. `keep` 1 is the default: one free copy. Every copy beyond the first is billed per GB-hour. Lowering `keep` deletes the oldest rotating backups at the next nightly cycle. The maximum is the per-server limit minus your pinned backups minus one. Fails with `501 feature_disabled` until the site switches nightly backups on.

**Costs money** when you raise `keep`: the wallet balance must be positive. This operation requires an `Idempotency-Key` header.

**Required scope:** `backup:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:write` | CLI: `vm backup auto set` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `keep` | integer | yes | Number of rotating backups to keep, at least 1. |

Example:

```json
{
  "keep": 2
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keep` | integer | yes | The saved value. |
| `keep_max` | integer | yes | The highest value allowed right now. |
| `changed` | boolean | yes | `false` when the value was already set. |

Example:

```json
{
  "changed": true,
  "keep": 2,
  "keep_max": 8
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is zero or negative, so more billable copies cannot be kept. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_enabled` | Backup is not enabled for this server. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `keep` is missing or outside 1..`max` (the response includes the range). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/vm/<id>/backup/auto" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"keep":2}'
```

---

#### Restore the VM from a backup (stops, overwrites the disk, restarts)

`POST /v1/vm/{id}/backups/{bid}/restore`

Restores the server from a backup, in place. **This overwrites the server disk**: everything written after the backup was taken is lost. A running server is stopped, its disk is replaced with the contents of the backup and it is started again; a server that was already stopped stays stopped. It takes roughly 11 minutes for a 20 GB disk and longer for bigger disks, and the call returns a `job_id` straight away. The backup itself is kept.

Only a backup with status `BackedUp` can be restored. This operation needs the separate scope `backup:restore` and an `Idempotency-Key` header. Take a fresh backup first if you may need the current state.

**Required scope:** `backup:restore`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `backup:restore` | CLI: `vm backup restore` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | VM identifier (UUID). |
| `bid` | string | yes | Backup identifier (integer) as returned by the list operations. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `job_id` | integer | yes | Background job that carries out the operation. Follow it with the VM jobs call. |

Example:

```json
{
  "job_id": 8816
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `backup_not_ready` | Only a backup with status `BackedUp` can be restored. The response includes the backup's current `status`. |
| 409 | `vm_not_active` | The server is not in the `active` state, for example it is still being created. The response includes the current `state`. |
| 409 | `job_running` | Another operation is already running on this server. Wait for it to finish (see the VM jobs call) and retry. |
| 409 | `not_supported_in_zone` | The server runs in a region whose infrastructure does not offer this feature, so it is refused for this server. The error carries `capability` (`backup`); check the server's `capabilities` before offering the action. Servers in other regions are not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `vm_locked` | The server is locked (for example for lack of funds) and cannot be changed. |
| 501 | `feature_disabled` | The site does not sell Backup (or has not set it up yet). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/backups/<bid>/restore" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

### Account

Your account at a glance and read-only access to your API keys: profile, dashboard overview, activity timeline, bandwidth, notifications, resource quota, printable invoices and DDoS analyses. The only call here that changes anything is marking notifications as read. Editing the profile, password, e-mail or two-factor settings, and creating, editing or revoking API keys, are not available through the API and can only be done from the dashboard.

#### Printable HTML invoice (?cur=usd|vnd)

`GET /v1/billing/invoices/{id}/print`

Returns one of your invoices as a self-contained HTML page ready to print or save as PDF from a browser. The page contains the seller, buyer, line items and totals, in your account language. Amounts are shown in US dollars or Vietnamese dong according to `cur`; dong amounts use the exchange rate recorded when the invoice was issued. The response is HTML, not JSON.

An invoice that does not exist or belongs to another account returns `404 not_found`.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing invoice-print`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Invoice identifier (integer), as returned by the invoice list. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `cur` | string: `usd`, `vnd`, `auto` | no | Currency of the printed amounts. `auto` picks dong for Vietnamese-language accounts and dollars otherwise. When omitted (or any other value) your account's display currency preference is used. |

**Response 200** - Success.

Content type: `text/html`

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/billing/invoices/<id>/print" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Resource quota of the account

`GET /v1/client/quota`

Returns the resource limits of your account and how much you use. When quota is switched on for the site, limits follow the money you have really deposited (`deposited_cents`): your tier `level` (L0..L5, one scale for every service) caps the number of servers and the TOTAL vCPU, memory and disk (`caps`, `limit`), and `tier` is the largest single machine your deposits cover (`cost_hours` of running cost, default 720). Bonuses, vouchers, promotions, affiliate commission and admin credits marked as gifts do not count; refunds lower it; manual admin credits count by default. Servers you already run above a cap are never stopped or downsized: only new servers, resizes and scale-ups are refused. `max_vms_24h`, `max_vms_30d`, `is_30d_achieved` and `need_for_10_cents` are deprecated and only kept for old clients. `next` tells how much more to deposit to reach the next largest machine; `levels` and `services.table` give the tier scale.

`applies` is false when quota is off for the site or lifted for your account; `limit` is then `null`, which means no limit. Also reports the OS image limits of the Images service under `images`.

**Required scope:** `billing:read`.

Scope: `billing:read` | CLI: `billing quota`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether quota is switched on for the site. |
| `applies` | boolean | yes | Whether the limits apply to your account. |
| `deposited_cents` | integer | yes | Real money you have deposited, in US cents: completed payments and bank transfers minus refunds. This decides your resource step. Bonuses, vouchers and promotions are not included. |
| `balance_cents` | integer | yes | Wallet balance in US cents (can be negative). |
| `funds_cents` | integer | yes | Wallet balance counted as available funds, never below 0. |
| `tier_funds_cents` | integer | yes | Deprecated. Equal to `deposited_cents`. |
| `tier_rule` | string | yes | How the largest single machine is decided: `deposit_30d` = real deposits against the cost (`cost_hours`, default 720) of each plan. |
| `level` | integer | yes | Your tier L0..L5, decided by `deposited_cents` against `levels`. One tier scale serves every service, VMs included. |
| `levels` | array of integer | yes |  |
| `caps` | object | yes |  |
| `caps.vm_count` | integer or null | yes | Most servers (VMs + Kubernetes workers) your tier allows, or null when unlimited. |
| `caps.vcpu` | integer or null | yes | Most vCPU across all servers, or null. |
| `caps.ram_gb` | integer or null | yes | Most RAM in GiB across all servers, or null. |
| `caps.disk_gb` | integer or null | yes | Most disk in GiB across all servers and data volumes, or null. |
| `cost_hours` | integer | yes | Hours of running cost a plan must be covered for (default 720 = 30 days) to count as unlocked for a single machine. |
| `funds_source` | string | yes | Where funds are counted from (`wallet_ledger`). |
| `used` | AccountQuotaResources | yes | An amount of resources. |
| `used.cpu` | integer | yes | vCPU cores. |
| `used.ram_mb` | integer | yes | Memory in MiB. |
| `used.disk_gb` | integer | yes | Disk in GiB. |
| `used.vm` | integer | yes | Number of servers. |
| `used_by` | object | yes |  |
| `used_by.vms` | AccountQuotaResources | yes | An amount of resources. |
| `used_by.vms.cpu` | integer | yes | vCPU cores. |
| `used_by.vms.ram_mb` | integer | yes | Memory in MiB. |
| `used_by.vms.disk_gb` | integer | yes | Disk in GiB. |
| `used_by.vms.vm` | integer | yes | Number of servers. |
| `used_by.volumes_disk_gb` | integer | yes | Disk used by data volumes, in GiB. |
| `used_by.k8s` | AccountQuotaResources | yes | An amount of resources. |
| `used_by.k8s.cpu` | integer | yes | vCPU cores. |
| `used_by.k8s.ram_mb` | integer | yes | Memory in MiB. |
| `used_by.k8s.disk_gb` | integer | yes | Disk in GiB. |
| `used_by.k8s.vm` | integer | yes | Number of servers. |
| `vms` | integer | yes | Number of servers in use. |
| `max_vms_24h` | integer | yes | Server cap while funds are below the 720-hour level. |
| `max_vms_30d` | integer | yes | Server cap once funds cover 720 hours of the fleet. |
| `min_hours` | integer | yes | Hours of the new server's price the balance must cover to create one. |
| `max_vms` | integer | yes | Server cap that applies to you right now (`max_vms_30d` when `is_30d_achieved`, otherwise `max_vms_24h`). |
| `is_30d_achieved` | boolean | yes | Whether your funds cover 720 hours of the fleet plus one more server. |
| `services` | object | yes |  |
| `services.enabled` | boolean | yes | Whether per-service quotas are switched on. |
| `services.applies` | boolean | yes | Whether the per-service limits apply to your account. |
| `services.level` | integer | yes | Your quota level (0-5). Levels follow your total real deposits; spending never lowers it, refunding a deposit does. |
| `services.levels` | array of integer | yes |  |
| `services.funds_cents` | integer | yes | The funds figure used to pick the level. |
| `services.next_level_cents` | integer or null | yes | How much more to fund to reach the next level, or null at the top. |
| `services.items` | array of object | yes |  |
| `services.items[].key` | string | yes | Quota key, such as `vpn.ips`, `gpu.instances`, `k8s.workers`, `s3.storage_gb`. |
| `services.items[].service` | string | yes | Service the key belongs to. |
| `services.items[].unit` | string | yes | Unit of `used` and `limit`. |
| `services.items[].used` | integer | yes | Amount in use now, measured from live data. |
| `services.items[].limit` | integer or null | yes | Your limit, or null when unlimited. |
| `services.items[].pct` | integer or null | yes | `used` as a percentage of `limit`, or null when unlimited. |
| `services.items[].source` | string | yes | `tier` (default for your level), `override` (set for your account) or `disabled`. |
| `services.items[].default` | integer or null | yes | Default limit for your level, or null when unlimited. |
| `cost_24h_cents` | integer | yes | Deprecated. Cost of 24 hours of your current resource step, in US cents. Use `tier.cost_30d_cents`. |
| `cost_30d_running_cents` | integer | yes | Cost of 720 hours of all your running servers, in US cents. |
| `cost_30d_next_vm_cents` | integer | yes | Cost of 720 hours of one more server of the cheapest plan, in US cents. |
| `need_for_10_cents` | integer | yes | How much more to add to the wallet to reach the 720-hour level, in US cents. 0 when already reached or at the hard cap. |
| `limit` | AccountQuotaResources or null | yes |  |
| `tier` | AccountQuotaTier or null | yes |  |
| `tiers` | array of AccountQuotaTier | yes | All steps, from the smallest to the largest. |
| `tiers[].plan_id` | integer | yes | Plan this step corresponds to. |
| `tiers[].slug` | string | yes | Plan short name. |
| `tiers[].name` | string | yes | Plan display name. |
| `tiers[].cpu` | integer | yes | vCPU cores a step of this size allows. |
| `tiers[].ram_mb` | integer | yes | Memory in MiB allowed. |
| `tiers[].disk_gb` | integer | yes | Disk in GiB allowed. |
| `tiers[].hourly_uusd` | integer | yes | Price per hour of that plan, in millionths of a US dollar. |
| `tiers[].cost_24h_cents` | integer | yes | Deprecated. Cost of running that plan for 24 hours, in US cents. No longer decides anything: a step opens by `cost_30d_cents`. |
| `tiers[].cost_30d_cents` | integer | yes | Cost of running that plan for 720 hours (30 days), in US cents. You unlock this step once your real deposits reach this amount. |
| `tiers[].month_cents` | integer | yes | Price of that plan for a billing month, in US cents. For display only. |
| `next` | object or null | yes |  |
| `next.tier` | AccountQuotaTier | yes | A resource step, defined by one plan on sale. |
| `next.tier.plan_id` | integer | yes | Plan this step corresponds to. |
| `next.tier.slug` | string | yes | Plan short name. |
| `next.tier.name` | string | yes | Plan display name. |
| `next.tier.cpu` | integer | yes | vCPU cores a step of this size allows. |
| `next.tier.ram_mb` | integer | yes | Memory in MiB allowed. |
| `next.tier.disk_gb` | integer | yes | Disk in GiB allowed. |
| `next.tier.hourly_uusd` | integer | yes | Price per hour of that plan, in millionths of a US dollar. |
| `next.tier.cost_24h_cents` | integer | yes | Deprecated. Cost of running that plan for 24 hours, in US cents. No longer decides anything: a step opens by `cost_30d_cents`. |
| `next.tier.cost_30d_cents` | integer | yes | Cost of running that plan for 720 hours (30 days), in US cents. You unlock this step once your real deposits reach this amount. |
| `next.tier.month_cents` | integer | yes | Price of that plan for a billing month, in US cents. For display only. |
| `next.need_more_cents` | integer | yes | Amount still to deposit to unlock that step, in US cents (same as `need_cents`). |
| `next.need_cents` | integer | yes | Amount still to deposit to unlock that step, in US cents. |
| `next.required_deposit_cents` | integer | yes | Total deposits that unlock that step: its 720-hour cost, in US cents. |
| `override` | object or null | yes |  |
| `override.kind` | string | yes | `unlimited`, `plan` (pinned to a step) or `default`. |
| `override.plan_id` | integer or null | yes | Plan the account is pinned to. |
| `override.reason` | string | yes | Reason recorded for the override. |
| `override.actor` | string | yes | Who set the override. |
| `override.at` | integer | yes | When it was set (Unix time, seconds, UTC) |
| `source` | string: `disabled`, `override_unlimited`, `override_plan`, `balance`, `none` | yes | Why these limits apply: quota off, an unlimited override, a pinned step, your wallet funds, or `none` when the funds do not reach the cheapest step yet. |
| `images` | object | no |  |
| `images.count` | integer | yes | Images and ISOs you have. |
| `images.gb` | integer | yes | Space they use, in GiB. |
| `images.max_count` | integer | yes | Maximum number of images and ISOs. |
| `images.max_gb` | integer | yes | Maximum total size, in GiB. |
| `images.iso_max_gb` | integer | yes | Largest ISO accepted, in GiB. |
| `images.template_max_gb` | integer | yes | Largest OS image accepted, in GiB. |

Example:

```json
{
  "applies": true,
  "balance_cents": 1850,
  "cost_24h_cents": 11,
  "cost_30d_next_vm_cents": 339,
  "cost_30d_running_cents": 339,
  "deposited_cents": 2000,
  "enabled": true,
  "funds_cents": 1850,
  "funds_source": "wallet_ledger",
  "images": {
    "count": 0,
    "gb": 0,
    "iso_max_gb": 10,
    "max_count": 10,
    "max_gb": 200,
    "template_max_gb": 50
  },
  "is_30d_achieved": false,
  "limit": {
    "cpu": 2,
    "disk_gb": 60,
    "ram_mb": 4096,
    "vm": 0
  },
  "max_vms": 2,
  "max_vms_24h": 2,
  "max_vms_30d": 10,
  "min_hours": 2,
  "need_for_10_cents": 520,
  "next": null,
  "override": null,
  "services": {
    "applies": true,
    "enabled": true,
    "funds_cents": 2000,
    "items": [
      {
        "default": 10,
        "key": "vpn.ips",
        "limit": 10,
        "pct": 30,
        "service": "vpn",
        "source": "tier",
        "unit": "ip",
        "used": 3
      },
      {
        "default": 2000,
        "key": "proxy6.ips",
        "limit": 2000,
        "pct": 0,
        "service": "vpn",
        "source": "tier",
        "unit": "ip",
        "used": 0
      },
      {
        "default": 10,
        "key": "ai.keys",
        "limit": null,
        "pct": null,
        "service": "ai",
        "source": "override",
        "unit": "key",
        "used": 1
      }
    ],
    "level": 1,
    "levels": [
      0,
      1000,
      5000,
      20000,
      100000
    ],
    "next_level_cents": 3000
  },
  "source": "balance",
  "tier": {
    "cost_24h_cents": 11,
    "cost_30d_cents": 339,
    "cpu": 2,
    "disk_gb": 60,
    "hourly_uusd": 4704,
    "month_cents": 343,
    "name": "Standard 2/4",
    "plan_id": 3,
    "ram_mb": 4096,
    "slug": "s-2c-4g"
  },
  "tier_funds_cents": 2000,
  "tier_rule": "deposit_30d",
  "tiers": [
    {
      "cost_24h_cents": 11,
      "cost_30d_cents": 339,
      "cpu": 2,
      "disk_gb": 60,
      "hourly_uusd": 4704,
      "month_cents": 343,
      "name": "Standard 2/4",
      "plan_id": 3,
      "ram_mb": 4096,
      "slug": "s-2c-4g"
    }
  ],
  "used": {
    "cpu": 2,
    "disk_gb": 60,
    "ram_mb": 4096,
    "vm": 1
  },
  "used_by": {
    "k8s": {
      "cpu": 0,
      "disk_gb": 0,
      "ram_mb": 0,
      "vm": 0
    },
    "vms": {
      "cpu": 2,
      "disk_gb": 60,
      "ram_mb": 4096,
      "vm": 1
    },
    "volumes_disk_gb": 0
  },
  "vms": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/client/quota" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Account profile (read-only)

`GET /v1/portal/me`

Returns the profile of the account the API key belongs to: identity, status, preferred language and display currency, whether a password is set, and the DDoS protection workspace. It is read-only; changing the profile, password, e-mail or two-factor settings is only possible from the dashboard.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account get`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `account` | AccountProfile | yes | The account behind the API key. |
| `account.id` | integer | yes | Account identifier. |
| `account.email` | string | yes | Sign-in e-mail address. |
| `account.name` | string | yes | Display name. |
| `account.status` | string | yes | Account status. Calls made with an API key only succeed while it is `active`. |
| `account.created_at` | integer | yes | When the account was created (Unix time, seconds, UTC) |
| `account.last_login` | integer | yes | When the account last signed in to the dashboard, 0 if never (Unix time, seconds, UTC) |
| `account.currency` | string: `auto`, `usd`, `vnd` | yes | Currency used to display prices: `usd`, `vnd`, or `auto` (dong for Vietnamese-language accounts, dollars otherwise). Billing itself is always in US dollars. |
| `account.email_verified_at` | integer | yes | Unix time the e-mail address was verified, 0 while it is not verified. Servers cannot be created before it is verified. |
| `account.lang` | string | yes | Preferred language code, `en` or `vi`. |
| `account.blocked_reason` | string or null | yes | Why the account is blocked. `null` for an active account. |
| `account.has_password` | boolean | yes | Whether the account has a password. Accounts created through a social sign-in may have none. |
| `account.tenant` | object | yes |  |
| `account.tenant.id` | string | yes | Identifier of your DDoS protection workspace; it is the `tid` used by the DDoS Shield operations. |
| `account.tenant.name` | string | yes | Workspace name, empty if none. |
| `account.tenant.status` | string | yes | Workspace status, empty if none. |
| `account.tenant.targets` | integer | yes | Number of protected IP addresses in the workspace. |

Example:

```json
{
  "account": {
    "blocked_reason": null,
    "created_at": 1786000000,
    "currency": "auto",
    "email": "alex@example.com",
    "email_verified_at": 1786000600,
    "has_password": true,
    "id": 1042,
    "lang": "en",
    "last_login": 1792200000,
    "name": "Alex Nguyen",
    "status": "active",
    "tenant": {
      "id": "acc-4f9c2a1b",
      "name": "Alex Nguyen",
      "status": "active",
      "targets": 2
    }
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/me" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Overview: balance, burn rate, VMs, checklist

`GET /v1/portal/overview`

Returns everything the dashboard home page shows, in one call: the wallet balance, how long it will last at the current spend (`runway`), spend this month with a forecast, your servers, a getting-started checklist, the current announcement and the number of attacks blocked in the last 7 days. Money is in US cents unless a field name says otherwise (`*_uusd` is millionths of a dollar).

Only the 6 most urgent servers are included (`vms.shown` of `vms.total`): servers being built first, then locked or failed ones, then busy ones, then the newest; use the VM list call for all of them. `runway` is `null` when nothing is billed by the hour or due for renewal.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account overview`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |
| `greeting` | string: `morning`, `afternoon`, `evening`, `night` | yes | Part of the day in the billing time zone (UTC+7), for a greeting. |
| `tz_offset_secs` | integer | yes | Offset of the billing time zone from UTC, in seconds (25200). Month boundaries in this response follow it. |
| `account` | object | yes |  |
| `account.name` | string | yes | Display name. |
| `account.email_verified` | boolean | yes | Whether the e-mail address is verified. |
| `account.lang` | string | yes | Preferred language code. |
| `account.currency` | string | yes | Display currency preference: `auto`, `usd` or `vnd`. |
| `account.site` | string: `master`, `reseller` | yes | `master` on the operator's own site, `reseller` on a partner-run site. |
| `fx` | object | yes |  |
| `fx.usd_vnd` | integer | yes | Dong per US dollar used to display dong prices, 0 if unset. |
| `fx.source` | string | yes | Where the rate comes from. |
| `fx.vcb_sell` | integer | yes | Bank selling rate the price is based on, 0 if unknown. |
| `fx.vcb_at` | integer | yes | When that bank rate was published (Unix time), 0 if unknown. |
| `fx.updated_at` | integer | yes | When the displayed rate was last updated (Unix time). |
| `fx.margin_bp` | integer | yes | Margin added to the bank rate, in basis points. |
| `fx.stale` | boolean | yes | Whether the rate is out of date. |
| `fx.round_step` | integer | yes | Dong amounts are rounded to this step. |
| `balance_cents` | integer | yes | Wallet balance in US cents. Negative when the account is in debt. |
| `runway` | object or null | yes |  |
| `runway.burn_uusd_per_hour` | integer | yes | What running servers cost now, in millionths of a dollar per hour. |
| `runway.burn_cents_per_day` | integer | yes | The same per day, in US cents. |
| `runway.burn_cents_per_month` | integer | yes | The same per billing month, in US cents. |
| `runway.hours_per_month` | integer | yes | Hours in a billing month used for the monthly figure (730 by default). |
| `runway.vms_charged` | integer | yes | Number of servers billed by the hour that are running. |
| `runway.renewals_cents_window` | integer | yes | Prepaid renewals due in the next 30 days that the wallet must also cover, in US cents. |
| `runway.days` | number | yes | How many days the balance lasts at the current spend, including those renewals. Capped at 3650. |
| `runway.hours` | integer | yes | The same in hours. |
| `runway.low` | boolean | yes | Whether `days` is below `low_threshold_days`. |
| `runway.low_threshold_days` | number | yes | Threshold for a low-balance warning, in days. |
| `runway.autotopup_enabled` | boolean | yes | Whether automatic top-up is on for the account. |
| `spend` | object | yes |  |
| `spend.month_start` | integer | yes | Start of the current billing month (Unix time, seconds, UTC) |
| `spend.month_end` | integer | yes | Start of the next billing month (Unix time, seconds, UTC) |
| `spend.hours_left` | integer | yes | Hours remaining in the month. |
| `spend.spent_cents` | integer | yes | Spent so far this month in US cents (charges minus refunds). |
| `spend.forecast_cents` | integer | yes | Expected total for the month in US cents: spent so far plus the running servers for the rest of the month plus renewals due. |
| `spend.forecast_parts` | object | yes |  |
| `spend.forecast_parts.spent_cents` | integer | yes | Spent so far. |
| `spend.forecast_parts.burn_cents` | integer | yes | Expected cost of running servers for the rest of the month. |
| `spend.forecast_parts.renewals_cents` | integer | yes | Prepaid renewals due before the month ends. |
| `spend.sparkline` | array of object | yes | Spend per day since the start of the month. |
| `spend.sparkline[].d` | string | yes | Day, `YYYY-MM-DD` in the billing time zone. |
| `spend.sparkline[].t` | integer | yes | Start of that day (Unix time, seconds, UTC) |
| `spend.sparkline[].cents` | integer | yes | Spent that day in US cents. |
| `vms` | object | yes |  |
| `vms.total` | integer | yes | Number of servers (deleted ones excluded). |
| `vms.shown` | integer | yes | Number of servers in `items`. |
| `vms.limit` | integer | yes | Maximum number of servers returned (6). |
| `vms.counts` | object | yes |  |
| `vms.counts.active` | integer | yes | Servers in the `active` state. |
| `vms.counts.running` | integer | yes | Active servers that are powered on. |
| `vms.counts.stopped` | integer | yes | Active servers that are powered off. |
| `vms.counts.provisioning` | integer | yes | Servers still being created. |
| `vms.counts.locked` | integer | yes | Locked servers. |
| `vms.items` | array of object | yes |  |
| `vms.items[].id` | string | yes | Server UUID. |
| `vms.items[].hostname` | string | yes | Hostname. |
| `vms.items[].display_name` | string or null | yes | Display name, `null` when not set. |
| `vms.items[].os_family` | string | yes | Operating system family, `other` when unknown. |
| `vms.items[].os_label` | string or null | yes | Operating system name. |
| `vms.items[].ip` | string or null | yes | Public IP address, `null` until one is assigned. |
| `vms.items[].state` | string | yes | Lifecycle state, for example `active`, `provisioning` or `locked`. |
| `vms.items[].power` | string or null: `running`, `stopped` | yes | Power state. `null` when unknown or not recently confirmed. |
| `vms.items[].locked` | boolean | yes | Whether the server is locked. |
| `vms.items[].cycle` | string | yes | Billing cycle, `hourly` or a prepaid cycle name. |
| `vms.items[].cpu` | integer | yes | vCPU cores. |
| `vms.items[].ram_mb` | integer | yes | Memory in MiB. |
| `vms.items[].disk_gb` | integer | yes | System disk in GiB. |
| `vms.items[].hourly_uusd` | integer | yes | Price per hour in millionths of a US dollar. |
| `vms.items[].monthly_cents` | integer | yes | Price per billing month in US cents. |
| `vms.items[].paid_until` | integer or null | yes | End of the prepaid period, `null` for hourly servers (Unix time, seconds, UTC) |
| `vms.items[].created_at` | integer | yes | When the server was ordered (Unix time, seconds, UTC) |
| `vms.items[].charged_hourly` | boolean | yes | Whether the server is being billed by the hour right now (hourly, active and running). |
| `vms.items[].autoscale_enabled` | boolean | yes | Whether Auto Scaling is on. |
| `vms.items[].autoscale_state` | string or null | yes | Auto Scaling state, `null` when no rule exists. |
| `vms.items[].autoscale_target_cpu` | integer or null | yes | CPU ceiling of the Auto Scaling rule. |
| `vms.items[].autoscale_target_ram_mb` | integer or null | yes | Memory ceiling of the Auto Scaling rule in MiB. |
| `vms.items[].progress` | object or null | yes |  |
| `vms.items[].metrics` | object or null | yes |  |
| `vms.items[].bw` | object or null | yes |  |
| `checklist` | object | yes |  |
| `checklist.done` | integer | yes | Steps completed. |
| `checklist.total` | integer | yes | Number of steps. |
| `checklist.complete` | boolean | yes | Whether every step is done. |
| `checklist.items` | array of object | yes |  |
| `checklist.items[].key` | string: `create_vm`, `ssh_key`, `topup`, `autotopup`, `verify_email` | yes | Step: create a server, add an SSH key, top up the wallet, turn on automatic top-up, verify the e-mail. |
| `checklist.items[].done` | boolean | yes | Whether the step is done. |
| `announcement` | object or null | yes |  |
| `announcement.id` | integer | yes | Announcement identifier. |
| `announcement.level` | string: `info`, `warn` | yes | Severity. |
| `announcement.title` | string | yes | Title in your language. |
| `announcement.body` | string | yes | Text in your language. |
| `announcement.starts_at` | integer or null | yes | When it becomes visible, `null` for immediately (Unix time, seconds, UTC) |
| `announcement.ends_at` | integer or null | yes | When it stops being visible, `null` for no end (Unix time, seconds, UTC) |
| `announcement.scope` | string: `all_sites`, `site` | yes | Whether it was published for every site or only yours. |
| `announcement.updated_at` | integer | yes | When it was last changed (Unix time, seconds, UTC) |
| `region` | object | yes |  |
| `region.code` | string | yes | Region code. |
| `region.i18n` | string | yes | Translation key of the region name. |
| `region.status` | string: `ok`, `degraded`, `maintenance` | yes | Region status. |
| `shield` | object | yes |  |
| `shield.attacks_7d` | integer | yes | Attacks against your IP addresses in the last 7 days. |
| `shield.protected_ips` | integer | yes | Number of your IP addresses under protection. |
| `shield.enabled` | boolean | yes | Always `true`. |

Example:

```json
{
  "account": {
    "currency": "auto",
    "email_verified": true,
    "lang": "en",
    "name": "Alex Nguyen",
    "site": "master"
  },
  "announcement": null,
  "at": 1792300000,
  "balance_cents": 1850,
  "checklist": {
    "complete": false,
    "done": 3,
    "items": [
      {
        "done": true,
        "key": "create_vm"
      },
      {
        "done": true,
        "key": "ssh_key"
      },
      {
        "done": true,
        "key": "topup"
      },
      {
        "done": false,
        "key": "autotopup"
      },
      {
        "done": false,
        "key": "verify_email"
      }
    ],
    "total": 5
  },
  "fx": {
    "margin_bp": 40,
    "round_step": 1000,
    "source": "bank",
    "stale": false,
    "updated_at": 1792290000,
    "usd_vnd": 26200,
    "vcb_at": 1792290000,
    "vcb_sell": 26100
  },
  "greeting": "morning",
  "region": {
    "code": "HCM",
    "i18n": "region.HCM",
    "status": "ok"
  },
  "runway": {
    "autotopup_enabled": false,
    "burn_cents_per_day": 11,
    "burn_cents_per_month": 343,
    "burn_uusd_per_hour": 4704,
    "days": 168.1,
    "hours": 4034,
    "hours_per_month": 730,
    "low": false,
    "low_threshold_days": 3.0,
    "renewals_cents_window": 0,
    "vms_charged": 1
  },
  "shield": {
    "attacks_7d": 0,
    "enabled": true,
    "protected_ips": 1
  },
  "spend": {
    "forecast_cents": 350,
    "forecast_parts": {
      "burn_cents": 152,
      "renewals_cents": 0,
      "spent_cents": 198
    },
    "hours_left": 324,
    "month_end": 1793466000,
    "month_start": 1790787600,
    "sparkline": [
      {
        "cents": 11,
        "d": "2026-10-01",
        "t": 1790787600
      },
      {
        "cents": 11,
        "d": "2026-10-02",
        "t": 1790874000
      }
    ],
    "spent_cents": 198
  },
  "tz_offset_secs": 25200,
  "vms": {
    "counts": {
      "active": 1,
      "locked": 0,
      "provisioning": 0,
      "running": 1,
      "stopped": 0
    },
    "items": [
      {
        "autoscale_enabled": false,
        "autoscale_state": null,
        "autoscale_target_cpu": null,
        "autoscale_target_ram_mb": null,
        "bw": {
          "in_bps": 5200.0,
          "out_bps": 8100.0
        },
        "charged_hourly": true,
        "cpu": 2,
        "created_at": 1790000000,
        "cycle": "hourly",
        "disk_gb": 60,
        "display_name": null,
        "hostname": "web-1",
        "hourly_uusd": 4704,
        "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
        "ip": "203.0.113.10",
        "locked": false,
        "metrics": {
          "at": 1792299990,
          "cpu_pct": 12.5,
          "ram_pct": 41.0
        },
        "monthly_cents": 343,
        "os_family": "ubuntu",
        "os_label": "Ubuntu 24.04 LTS",
        "paid_until": null,
        "power": "running",
        "progress": null,
        "ram_mb": 4096,
        "state": "active"
      }
    ],
    "limit": 6,
    "shown": 1,
    "total": 1
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/overview" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### One call for profile, catalog, notifications, service counts and overview (each part follows the key's own scopes)

`GET /v1/portal/bootstrap`

Returns, in ONE call, the data an app needs when it opens: the profile, the catalog rules and prices, notifications, how many services of each kind the account has and, optionally, the dashboard overview. Instead of 15 or more separate requests you make one.

Every entry of `parts` is **exactly the body** of the call named in the table below, so you can reuse the same parsing code. Each part is checked on its own with the rules of that call: a part you may not read with your API key (the call is not public, or the key lacks its scope) is simply **absent**, as is a service that is switched off for the site. A part that fails on the server does not fail the response; it is listed in `errors` with its HTTP status and error code and the other parts are still returned. Only the data of your own account is ever returned.

| Part | Same as | Group |
|---|---|---|
| `me` | `GET /v1/portal/me` | `shell` |
| `catalog_lite` | `GET /v1/vm/catalog?view=shell` (the rules and feature flags only: `cycles`, `settings`, `account`) | `shell` |
| `catalog` | `GET /v1/vm/catalog` (every plan, operating system and region — about 340 KB, so it is only returned when you ask for it) | `catalog` |
| `prices` | `GET /v1/vm/prices` | `shell` |
| `notifications` | `GET /v1/billing/notifications` | `shell` |
| `promos` | `GET /v1/portal/promos` (dashboard only) | `shell` |
| `nav_counts` | `GET /v1/portal/nav-counts` (how many services of each kind; used for the menu badges) | `shell` |
| `vm`, `gpu`, `s3`, `vpn`, `k8s`, `dedicated`, `ai_keys` | the first page of the matching service list, exactly as that service's own list call returns it (used for the counters). A service that is switched off for the site is absent. | `shell` |
| `overview` | `GET /v1/portal/overview` | `dashboard` |
| `bandwidth_live` | `GET /v1/portal/bandwidth?live=1` | `dashboard` |
| `bandwidth_range` | `GET /v1/portal/bandwidth?range=<bw_range>` | `dashboard` |
| `activity` | `GET /v1/portal/activity?page=1&per_page=8` | `dashboard` |
| `ai_analyses` | `GET /v1/portal/ai-analyses?limit=5` | `dashboard` |

The time each part took is in the `Server-Timing` response header. With an API key every part counts as one request for the rate limit.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account bootstrap`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `include` | string | no | Comma-separated groups of parts to return: `shell` (default), `dashboard` and/or `catalog` (the full catalog of plans, operating systems and regions). An unknown group is rejected with `400`. |
| `bw_range` | string: `1h`, `6h`, `12h`, `24h`, `7d`, `30d` | no | Range of the `bandwidth_range` part (default `24h`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |
| `parts` | object | yes | Map of part name to the body of the matching call. Parts you may not read, or that do not exist on this site, are absent. |
| `errors` | object | yes | Parts that failed on the server, by name. Empty when everything succeeded. |

Example:

```json
{
  "at": 1792300000,
  "errors": {},
  "parts": {
    "gpu": {
      "items": [],
      "total": 0
    },
    "vm": {
      "counts": {
        "all": 0
      },
      "items": [],
      "page": 1,
      "per_page": 1,
      "total": 0
    }
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/bootstrap" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Account activity timeline (paged)

`GET /v1/portal/activity`

Returns one timeline of what happened on your account, newest first: server events (create, start, stop, reboot, reinstall, destroy, lock, plan change, renewal), wallet deposits and refunds, important notifications and blocked attacks. Paging is done by the server. Entries carry a translation key in `i18n` and its values in `params` instead of a finished sentence, so render the text on your side.

Pages above 100 are rejected. `total`, `pages` and `unread` (unread notifications of the account) describe the filtered result; `group` narrows the timeline to one category.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account activity`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `group` | string: `vm`, `billing`, `security`, `account` | no | Only return one category: server events, billing (wallet, renewals, price changes, balance warnings), security (blocked attacks) or account (support replies, e-mail and password events). An unknown value is ignored. |
| `vm_id` | string | no | Only return events of this server (UUID). Wallet entries and notifications are left out when it is set. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AccountActivityItem | yes |  |
| `items[].id` | string | yes | Stable identifier of the entry, prefixed by its origin (`e:` server event, `l:` wallet, `n:` notification, `s:` blocked attack, `a:` AI analysis). |
| `items[].source` | string: `vm_event`, `ledger`, `notification`, `ddos_event`, `ai_analysis` | yes | Where the entry comes from. `ai_analysis` is an automatic analysis of an attack on one of your IP addresses; its `params.task_id` is the id to pass to `GET /v1/portal/ai-analyses/{id}`. |
| `items[].at` | integer | yes | When it happened (Unix time, seconds, UTC) |
| `items[].group` | string: `vm`, `billing`, `security`, `account` | yes | Category of the entry. Use it as the `group` filter. |
| `items[].i18n` | string | yes | Translation key that describes the entry, for example `act.vm.start` or `act.wallet.topup`. Render the text on your side with `params`; the key is stable, new keys may appear. |
| `items[].params` | object | yes | Values to substitute into the text, for example `hostname`, `amount_cents`, `ip`. The keys depend on `i18n`. |
| `items[].vm_id` | string or null | yes | UUID of the related server, if any. |
| `items[].vm_hostname` | string or null | yes | Hostname of the related server, if any. |
| `items[].level` | string: `info`, `warn` | yes | `warn` for problems that may need attention (failed deployment, locked server, low balance, blocked attack). |
| `items[].read_at` | integer or null | yes | For notifications: when it was marked as read, `null` while unread. Always `null` for other entries (Unix time, seconds, UTC) |
| `items[].amount_cents` | integer or null | yes | Money involved in US cents, if any. |
| `items[].invoice_id` | integer or null | yes | Related invoice, if any. Use it with the invoice calls. |
| `total` | integer | yes | Total number of entries matching the filters. |
| `page` | integer | yes | Current page (1-based). |
| `per_page` | integer | yes | Page size applied (clamped to 100). |
| `pages` | integer | yes | Number of pages. |
| `unread` | integer | yes | Number of unread notifications of the account. |
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792300000,
  "items": [
    {
      "amount_cents": null,
      "at": 1792290000,
      "group": "vm",
      "i18n": "act.vm.start",
      "id": "e:5120",
      "invoice_id": null,
      "level": "info",
      "params": {
        "hostname": "web-1"
      },
      "read_at": null,
      "source": "vm_event",
      "vm_hostname": "web-1",
      "vm_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10"
    }
  ],
  "page": 1,
  "pages": 1,
  "per_page": 20,
  "total": 1,
  "unread": 0
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | `page` is above 100. The response includes `field` (`page`) and `max` (100). |

**Example request**

```bash
curl "https://api.onie.net/v1/portal/activity" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### How many services of each kind the account has (VMs, GPU, volumes, snapshots, backups, VPN…) — for menu badges

`GET /v1/portal/nav-counts`

Returns how many services of each kind the account has right now, in one call. The dashboard uses it for the small number next to each menu item. A number is what the matching list page would show by default: deleted, cancelled, expired and hidden items are not counted (a VPN or IPv6 proxy plan counts while it is pending or active and not past its end date; a bandwidth add-on while it is paid or granted and its period has not ended).

`s3` and `dedicated` are only present on the operator's own site. `snapshots` is `null` when the infrastructure could not be read in time (do not treat it as zero). `ddos` is the number of distinct public IPs the DDoS shield lists for you: servers, rented bare-metal machines and active VPN addresses. Only your own account is counted.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account service counts`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |
| `counts` | object | yes |  |
| `counts.vm` | integer | yes | Virtual machines (not deleted). |
| `counts.gpu` | integer | yes | GPU instances (not deleted). |
| `counts.k8s` | integer | yes | Managed container clusters (not deleted). |
| `counts.vpc` | integer | yes | Private cloud networks (not deleted). |
| `counts.autoscale` | integer | yes | Servers with an auto-scaling rule set up. |
| `counts.ssh_keys` | integer | yes | SSH keys. |
| `counts.volumes` | integer | yes | Block-storage volumes. |
| `counts.snapshots` | integer or null | yes | VM snapshots; `null` when they could not be read. |
| `counts.snapshot_schedules` | integer | yes | Snapshot schedules of your servers. |
| `counts.backups` | integer | yes | Backups of your servers. |
| `counts.backup_schedules` | integer | yes | Backup schedules of your servers. |
| `counts.os_images` | integer | yes | Your own OS images. |
| `counts.iso_images` | integer | yes | Your own ISO images. |
| `counts.byoip` | integer | yes | Bring-your-own-IP ranges that are still held (pending, active or suspended). |
| `counts.bandwidth` | integer | yes | Bandwidth add-ons whose period has not ended. |
| `counts.ddos` | integer | yes | Public IPs listed by the DDoS shield. |
| `counts.vpn` | integer | yes | VPN plans that are pending or active. |
| `counts.proxy6` | integer | yes | IPv6 proxy plans that are pending or active. |
| `counts.tickets_answered` | integer | yes | Support tickets that staff has answered and you have not replied to or closed yet. |
| `counts.s3` | integer | yes | S3 accounts. Operator's own site only. |
| `counts.dedicated` | integer | yes | Bare-metal servers you rent. Operator's own site only. |

Example:

```json
{
  "at": 1792300000,
  "counts": {
    "autoscale": 0,
    "backup_schedules": 1,
    "backups": 2,
    "bandwidth": 0,
    "byoip": 0,
    "ddos": 2,
    "dedicated": 0,
    "gpu": 0,
    "iso_images": 0,
    "k8s": 0,
    "os_images": 0,
    "proxy6": 0,
    "s3": 1,
    "snapshot_schedules": 1,
    "snapshots": 4,
    "ssh_keys": 1,
    "tickets_answered": 0,
    "vm": 2,
    "volumes": 3,
    "vpc": 0,
    "vpn": 1
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/nav-counts" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Bandwidth used by the account

`GET /v1/portal/bandwidth`

Returns the traffic of all your servers and VPN addresses added together: live rates, a time series of the chosen range, the attacks seen in that range and totals. With `live=1` only the `live` block is returned, which is cheap enough to poll every 5 seconds. Rates are bits per second and packets per second; `live` values are averaged over the last minute, so they do not flicker to zero between samples.

This call is rate limited per account: 10 full requests or 30 `live=1` requests per minute, then `429 rate_limited`.

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `account bandwidth`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `1h`, `6h`, `12h`, `24h`, `7d`, `30d` | no | Time range of `series`, `attacks` and `totals`. An unknown value falls back to `24h`. Buckets are 1 minute for `1h`, 1 hour for `6h`, `12h`, `24h` and `7d`, and 1 day for `30d`. |
| `live` | integer | no | Set to `1` to return only the `live` block (and `at`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |
| `live` | object | yes |  |
| `live.in_bps` | number | yes | Inbound traffic of all your servers and VPN addresses, in bits per second (average of the last minute). |
| `live.out_bps` | number | yes | Outbound traffic, in bits per second. |
| `live.in_pps` | number | yes | Inbound packets per second. |
| `live.out_pps` | number | yes | Outbound packets per second. |
| `live.ips` | integer | yes | Number of IP addresses measured. |
| `live.attack_ips` | integer | yes | How many of those IP addresses are under an attack right now. |
| `live.vms` | array of object | yes | Per-server rates. Servers with no measurement yet are left out. |
| `live.vms[].id` | string | yes | Server UUID. |
| `live.vms[].in_bps` | number | yes | Inbound bits per second. |
| `live.vms[].out_bps` | number | yes | Outbound bits per second. |
| `live.vms[].in_pps` | number | yes | Inbound packets per second. |
| `live.vms[].out_pps` | number | yes | Outbound packets per second. |
| `live.vms[].attack` | boolean | yes | Whether the server's IP address is under attack right now. |
| `live.has_any` | boolean | yes | Whether there is anything to measure (at least one server or active VPN address). |
| `live.by_ip` | object | yes | The same rates for every IP address you own (servers and VPN), keyed by address. |
| `range` | string: `1h`, `6h`, `12h`, `24h`, `7d`, `30d` | no | Range applied. Absent with `live=1`. |
| `bucket_secs` | integer | no | Length of one `series` bucket in seconds. Absent with `live=1`. |
| `from` | integer | no | Start of the range. Absent with `live=1` (Unix time, seconds, UTC) |
| `to` | integer | no | End of the range. Absent with `live=1` (Unix time, seconds, UTC) |
| `series` | array of object | no | Traffic over time, only buckets that have data. Absent with `live=1`. |
| `series[].t` | integer | yes | Start of the bucket (Unix time, seconds, UTC) |
| `series[].in_bps` | number | yes | Average inbound bits per second in the bucket. |
| `series[].out_bps` | number | yes | Average outbound bits per second in the bucket. |
| `series[].bytes_in` | integer | yes | Bytes received in the bucket. |
| `series[].bytes_out` | integer | yes | Bytes sent in the bucket. |
| `attacks` | array of object | no | Attacks against your addresses in the range. Absent with `live=1`. |
| `attacks[].t` | integer | yes | When the attack started (Unix time, seconds, UTC) |
| `attacks[].ended` | integer or null | yes | When it ended, `null` while it is still going on (Unix time, seconds, UTC) |
| `attacks[].severity` | string | yes | Attack severity, for example `low`, `medium` or `high`. |
| `attacks[].ips` | integer | yes | Number of addresses involved (1 per entry). |
| `attacks[].peak_pps` | integer or null | yes | Peak packets per second, `null` if not measured. |
| `totals` | object | no |  |
| `totals.bytes_in` | integer | yes | Total bytes received in the range. |
| `totals.bytes_out` | integer | yes | Total bytes sent in the range. |
| `totals.peak_in_bps` | number | yes | Highest inbound bits per second of any bucket. |
| `totals.peak_out_bps` | number | yes | Highest outbound bits per second of any bucket. |
| `port_speed` | string | no | Port speed of the site, for example `10 Gbps`. Absent with `live=1`. |
| `source` | string | no | Where the figures come from (`edge_counter`). Absent with `live=1`. |

Example:

```json
{
  "at": 1792300000,
  "attacks": [],
  "bucket_secs": 3600,
  "from": 1792213600,
  "live": {
    "attack_ips": 0,
    "by_ip": {
      "203.0.113.10": {
        "attack": false,
        "in_bps": 5200.0,
        "in_pps": 9.5,
        "out_bps": 8100.0,
        "out_pps": 11.0
      }
    },
    "has_any": true,
    "in_bps": 5200.0,
    "in_pps": 9.5,
    "ips": 1,
    "out_bps": 8100.0,
    "out_pps": 11.0,
    "vms": [
      {
        "attack": false,
        "id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
        "in_bps": 5200.0,
        "in_pps": 9.5,
        "out_bps": 8100.0,
        "out_pps": 11.0
      }
    ]
  },
  "port_speed": "10 Gbps",
  "range": "24h",
  "series": [
    {
      "bytes_in": 2160000,
      "bytes_out": 3420000,
      "in_bps": 4800.0,
      "out_bps": 7600.0,
      "t": 1792292400
    }
  ],
  "source": "edge_counter",
  "to": 1792300000,
  "totals": {
    "bytes_in": 2160000,
    "bytes_out": 3420000,
    "peak_in_bps": 4800.0,
    "peak_out_bps": 7600.0
  }
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### AI analyses of attacks on your IPs

`GET /v1/portal/ai-analyses`

Returns the latest automatic analyses of attacks against your IP addresses: what the attack looked like, the verdict, a confidence figure and a short summary. Only analyses of addresses that belong to you are returned. The list is empty when you have no server with an IP address or nothing has been analysed yet.

This call needs the scope `shield:read` (the DDoS Shield scope), not `account:read`. It is rate limited to 20 requests per minute per account.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `account ai-analyses`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `limit` | integer | no | Number of analyses to return, 1 to 20 (values outside the range are clamped). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string | yes | Analysis identifier. |
| `items[].at` | integer | yes | When the analysis was produced (Unix time, seconds, UTC) |
| `items[].ip` | string | yes | The IP address of yours that was attacked. |
| `items[].event_id` | string or null | yes | Identifier of the attack event the analysis belongs to. |
| `items[].verdict` | string or null | yes | Outcome of the analysis, for example `attack` or `false_positive`. |
| `items[].confidence` | number or null | yes | Confidence of the verdict, from 0 to 1. |
| `items[].kind` | string or null | yes | Type of attack, for example `syn_flood` or `udp_flood`. |
| `items[].severity` | string or null | yes | Severity, for example `low`, `medium` or `high`. |
| `items[].summary` | string | yes | Short human-readable summary. |
| `items[].evidence` | array of string | yes | Up to 3 lines of supporting evidence. |
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792300000,
  "items": [
    {
      "at": 1792250000,
      "confidence": 0.93,
      "event_id": "ev-20261017-0412",
      "evidence": [
        "Sharp rise in SYN packets without matching ACKs",
        "Many sources from one network range"
      ],
      "id": "ai-7f3a91c2",
      "ip": "203.0.113.10",
      "kind": "syn_flood",
      "severity": "medium",
      "summary": "SYN flood against port 443 lasting about 6 minutes; filtered at the edge.",
      "verdict": "attack"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/ai-analyses" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### One AI analysis in full (conclusion, evidence, recommended actions)

`GET /v1/portal/ai-analyses/{id}`

Returns ONE automatic analysis of an attack on your IP addresses in full: the verdict, confidence, the complete conclusion, up to 8 lines of evidence and the recommended actions, if any. Text is plain text, never HTML. Internal and private addresses, and addresses protected for other customers, are replaced with `x.x.x.x`.

`reanalysis` tells whether you may ask for a fresh analysis of the same address right now (see `POST /v1/portal/ai-analyses/{id}/reanalyze`) and, after you did, whether the new one is `queued`, `done` (its id is `task_id`) or `error`.

This call needs the scope `shield:read`. It is rate limited to 60 requests per minute per account.

**Required scope:** `shield:read`.

Scope: `shield:read` | CLI: `account ai-analysis`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Analysis identifier, as returned by the analysis list or in `params.task_id` of an activity entry. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `item` | object | yes |  |
| `item.id` | string | yes | Analysis identifier. |
| `item.at` | integer | yes | When the analysis was produced (Unix time, seconds, UTC) |
| `item.ip` | string | yes | The IP address of yours that was analysed. |
| `item.event_id` | string or null | yes | Identifier of the attack event the analysis belongs to. |
| `item.verdict` | string or null | yes | Outcome: `attack`, `suspicious` or `normal`. |
| `item.confidence` | number or null | yes | Confidence of the verdict, from 0 to 1. |
| `item.kind` | string or null | yes | Type of attack in a few words. |
| `item.severity` | string or null | yes | Severity, for example `low`, `medium` or `high`. |
| `item.summary` | string | yes | The full conclusion, plain text. |
| `item.evidence` | array of string | yes | Up to 8 lines of supporting evidence. |
| `item.actions` | array of object | yes | Recommended actions. They are advice only; nothing is applied by reading this. |
| `item.actions[].type` | string | yes | Kind of action, for example `block`. |
| `item.actions[].value` | string | yes | What to apply it to, for example an attacking address. |
| `item.actions[].reason` | string | yes | Why the action is recommended. |
| `item.own` | boolean | yes | True when this analysis was produced because you asked for it. |
| `reanalysis` | object | yes |  |
| `reanalysis.status` | string | yes | `idle`, `queued` (waiting for the result), `done` (a newer analysis exists, see `task_id`) or `error` (the last request failed). |
| `reanalysis.task_id` | string or null | yes | Id of the newer analysis when `status` is `done`. |
| `reanalysis.request_id` | string or null | yes | Id of the pending request when `status` is `queued`. |
| `reanalysis.retry_after_secs` | integer | yes | Seconds before you may ask again for this address, 0 when you may. |
| `reanalysis.allowed` | boolean | yes | Whether a new analysis can be requested right now. |
| `reanalysis.quota` | object | yes |  |
| `reanalysis.quota.ip_used` | integer | yes | Requests you made today (UTC) for this address. |
| `reanalysis.quota.ip_max` | integer | yes | Daily limit per address. |
| `reanalysis.quota.account_used` | integer | yes | Requests you made today (UTC) in total. |
| `reanalysis.quota.account_max` | integer | yes | Daily limit per account. |
| `at` | integer | yes | Time of the response (Unix time, seconds, UTC) |

Example:

```json
{
  "at": 1792300000,
  "item": {
    "actions": [
      {
        "reason": "All attacking sources are in this range",
        "type": "block",
        "value": "198.51.100.0/24"
      }
    ],
    "at": 1792250000,
    "confidence": 0.93,
    "event_id": "ev-20261017-0412",
    "evidence": [
      "Sharp rise in SYN packets without matching ACKs",
      "Many sources from one network range"
    ],
    "id": "t-1792250000-a1b2c3",
    "ip": "203.0.113.10",
    "kind": "SYN flood on tcp/443",
    "own": false,
    "severity": "medium",
    "summary": "SYN flood against port 443 lasting about 6 minutes from many sources of one network range; filtered at the edge, no impact on the service.",
    "verdict": "attack"
  },
  "reanalysis": {
    "allowed": true,
    "quota": {
      "account_max": 10,
      "account_used": 0,
      "ip_max": 3,
      "ip_used": 0
    },
    "request_id": null,
    "retry_after_secs": 0,
    "status": "idle",
    "task_id": null
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/portal/ai-analyses/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Ask the AI to analyse this IP again (10 min per IP, daily quota)

`POST /v1/portal/ai-analyses/{id}/reanalyze`

Asks the AI for a fresh analysis of the address (and attack event) that analysis `{id}` is about. The request is queued and takes a minute or two; poll `GET /v1/portal/ai-analyses/{id}` and read `reanalysis.status` until it is `done`, then open the analysis named by `reanalysis.task_id`.

Only addresses that belong to you can be analysed (`404 not_found` otherwise, indistinguishable from an unknown id). Limits: one request per address every 10 minutes, no new request while one is waiting, and 3 requests per address and 10 per account per UTC day. A refused request returns `429 rate_limited`; the `error` object also carries `retry_after_secs`, `reason` (`cooldown`, `pending` or `daily_quota`) and `quota`.

This call needs the scope `shield:write`. It sends no body.

**Required scope:** `shield:write`.

Scope: `shield:write` | CLI: `account ai-reanalyze`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Identifier of the analysis to repeat. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always true when the request was queued. |
| `request_id` | string | yes | Identifier of the queued request. |
| `retry_after_secs` | integer | yes | Seconds until you may ask again for this address. |
| `reanalysis` | object | yes |  |
| `reanalysis.status` | string | yes | `queued` right after the call. |
| `reanalysis.task_id` | string or null | yes | Always null right after the call. |
| `reanalysis.request_id` | string or null | yes | Identifier of the pending request. |
| `reanalysis.retry_after_secs` | integer | yes | Seconds before you may ask again for this address. |
| `reanalysis.allowed` | boolean | yes | Whether a new analysis can be requested right now (false right after the call). |
| `reanalysis.quota` | object | yes |  |
| `reanalysis.quota.ip_used` | integer | yes | Requests you made today (UTC) for this address. |
| `reanalysis.quota.ip_max` | integer | yes | Daily limit per address. |
| `reanalysis.quota.account_used` | integer | yes | Requests you made today (UTC) in total. |
| `reanalysis.quota.account_max` | integer | yes | Daily limit per account. |

Example:

```json
{
  "ok": true,
  "reanalysis": {
    "allowed": false,
    "quota": {
      "account_max": 10,
      "account_used": 1,
      "ip_max": 3,
      "ip_used": 1
    },
    "request_id": "q-1792300000-a1b2c3",
    "retry_after_secs": 600,
    "status": "queued",
    "task_id": null
  },
  "request_id": "q-1792300000-a1b2c3",
  "retry_after_secs": 600
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 429 | `rate_limited` | Too soon after the previous request for this address, a request is still waiting, or today's limit is used up. See `retry_after_secs` and `reason`. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/portal/ai-analyses/<id>/reanalyze" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Latest 50 notifications and the unread count

`GET /v1/billing/notifications`

Returns your 50 newest notifications, newest first, with a count of unread ones. `unread` counts only the notifications in `items`, so it is at most 50. One-time credential messages are never included. Mark notifications as read with [Mark notifications as read](#operation/notification_read).

**Required scope:** `account:read`.

Scope: `account:read` | CLI: `notification list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AccountNotification | yes |  |
| `items[].id` | integer | yes | Notification identifier. Use it in the `ids` of the mark-as-read call. |
| `items[].vm_id` | string or null | yes | UUID of the server the notification is about, when it is about one. |
| `items[].kind` | string | yes | Notification type, for example `low_balance`, `autotopup_failed` or `ticket_reply`. New types may be added. |
| `items[].title` | string | yes | Short title, in the language the notification was sent in. |
| `items[].body` | string or null | yes | Longer text, when there is one. |
| `items[].key` | string or null | yes | Message code of the title, for example `n.vm_ready.title`; `null` for older notifications. With `args` it lets you show the notification in your own language; the body is in `data.b` (`k` + `a`). |
| `items[].args` | object | yes | Raw values to fill into the message named by `key` (host names, amounts in cents `*_cents`, timestamps in seconds `*_at`). An empty object when `key` is `null`. |
| `items[].read_at` | integer or null | yes | When the notification was marked as read, `null` while unread (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the notification was created (Unix time, seconds, UTC) |
| `items[].dedupe_key` | string or null | yes | Opaque key that identifies the event the notification belongs to, such as a ticket id. May be used to link to the related resource. |
| `items[].data` | object or null | yes | Structured details used to rebuild the message: `lang` and `vars` (the values substituted in the text), and for newer notifications `t` / `b` (message code `k` and values `a` of the title and the body). `null` for older notifications. |
| `unread` | integer | yes | Number of unread notifications among `items`. |

Example:

```json
{
  "items": [
    {
      "args": {},
      "body": "Your wallet balance is below the amount needed for the next 3 days.",
      "created_at": 1792290000,
      "data": {
        "lang": "en",
        "vars": {
          "days": 3
        }
      },
      "dedupe_key": "low_balance:2026-10-19",
      "id": 1201,
      "key": null,
      "kind": "low_balance",
      "read_at": null,
      "title": "Low balance",
      "vm_id": null
    }
  ],
  "unread": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/billing/notifications" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Mark notifications as read (empty = all)

`POST /v1/billing/notifications/read`

Marks notifications as read. Send `ids` to mark specific notifications, or send an empty body (or an empty `ids`) to mark every unread notification of the account. Identifiers that do not exist, belong to another account or are already read are ignored. `updated` is the number of notifications that actually changed. This is the only call in this group that changes anything.

**Required scope:** `account:write`.

Scope: `account:write` | CLI: `notification read`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `ids` | array of integer | no | Notifications to mark as read. Empty or omitted means all. |

Example:

```json
{
  "ids": [
    1201
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |
| `updated` | integer | yes | Number of notifications that were unread and are now read. |

Example:

```json
{
  "ok": true,
  "updated": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | The request body is not valid JSON or `ids` is not a list of integers. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/billing/notifications/read" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ids":[1201]}'
```

---

#### List the account's API keys (never the raw key)

`GET /v1/apikeys`

Lists all API keys of your account, newest first, including expired and revoked ones. The list is not paged. The secret key and its hash are never returned, and `hint` shows only the first characters (7 when listed through an API key) so you can tell the keys apart. Creating, editing and revoking keys is only possible from the dashboard; a key cannot manage other keys.

**Required scope:** `apikey:read`.

Scope: `apikey:read` | CLI: `apikey list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `keys` | array of AccountApiKey | yes |  |
| `keys[].id` | string | yes | Key identifier (not the secret), for example `ak3f9c2d1e7a`. |
| `keys[].name` | string | yes | Name you gave the key. |
| `keys[].hint` | string | yes | Beginning of the key so you can recognise it. Never enough to use it. When listed through an API key it is 7 characters (`vk_` plus 4). |
| `keys[].scopes` | array of string | yes | Permissions granted to the key. See the scope list in the API reference. |
| `keys[].allow_ips` | array of string | yes | If not empty, the key only works from these addresses. |
| `keys[].expires_at` | integer or null | yes | When the key expires, `null` for no expiry (Unix time, seconds, UTC) |
| `keys[].created_at` | integer | yes | When the key was created (Unix time, seconds, UTC) |
| `keys[].last_used_at` | integer or null | yes | When the key was last used, `null` if never (Unix time, seconds, UTC) |
| `keys[].last_ip` | string or null | yes | IP address of the last call made with the key. |
| `keys[].req_count` | integer | yes | Number of calls made with the key. |
| `keys[].revoked_at` | integer or null | yes | When the key was revoked, `null` if it was not (Unix time, seconds, UTC) |
| `keys[].status` | string: `active`, `expired`, `revoked` | yes | `revoked` once revoked, `expired` after `expires_at`, otherwise `active`. |
| `enabled` | boolean | yes | Whether API access is switched on for the site. When false every key is rejected. |

Example:

```json
{
  "enabled": true,
  "keys": [
    {
      "allow_ips": [],
      "created_at": 1790000000,
      "expires_at": null,
      "hint": "vk_Ab3x",
      "id": "ak3f9c2d1e7a",
      "last_ip": "198.51.100.7",
      "last_used_at": 1792290000,
      "name": "ci-deploy",
      "req_count": 128,
      "revoked_at": null,
      "scopes": [
        "vm:read",
        "vm:write"
      ],
      "status": "active"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/apikeys" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### API key usage log of the account (paged)

`GET /v1/apikeys/log`

Returns the usage log of all API keys of your account, newest first by default. Only calls that change something (any method except GET) and every failed call (HTTP status 400 and above) are logged; successful reads are not. The path is logged without its query string. Entries are kept for 60 days.

**Required scope:** `apikey:read`.

Scope: `apikey:read` | CLI: `apikey log`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `status`, `method` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Log entry identifier. |
| `items[].key_id` | string | yes | Identifier of the key that made the call (`id` in the key list). |
| `items[].account_id` | integer | yes | Your account identifier. |
| `items[].reseller_id` | integer | yes | Identifier of the site the key belongs to; 0 for the main site. |
| `items[].at` | integer | yes | When the call was made (Unix time, seconds, UTC) |
| `items[].method` | string | yes | HTTP method. |
| `items[].path` | string | yes | Request path, without the query string. |
| `items[].status` | integer | yes | HTTP status returned. |
| `items[].ip` | string | yes | IP address the call came from. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "account_id": 1042,
      "at": 1792290000,
      "id": 9021,
      "ip": "198.51.100.7",
      "key_id": "ak3f9c2d1e7a",
      "method": "POST",
      "path": "/v1/vm/3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10/start",
      "reseller_id": 0,
      "status": 200
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/apikeys/log" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### The calling key itself: scopes, expiry, allowed IPs, rate limits

`GET /v1/apikeys/self`

Returns information about the API key making the call: its permissions, expiry, allowed IP addresses, usage, and how many requests it may still make in the current minute. Every key can call this operation whatever its scopes, which makes it the way to check that a key works and what it may do. It does not reveal any other key. It can only be called with an API key.

**Required scope:** `apikey:self`.

Scope: `apikey:self` | CLI: `apikey self`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | AccountApiKey | yes | An API key of the account. The secret itself is shown only once, when the key is created in the dashboard, and is never returned by the API. |
| `key.id` | string | yes | Key identifier (not the secret), for example `ak3f9c2d1e7a`. |
| `key.name` | string | yes | Name you gave the key. |
| `key.hint` | string | yes | Beginning of the key so you can recognise it. Never enough to use it. When listed through an API key it is 7 characters (`vk_` plus 4). |
| `key.scopes` | array of string | yes | Permissions granted to the key. See the scope list in the API reference. |
| `key.allow_ips` | array of string | yes | If not empty, the key only works from these addresses. |
| `key.expires_at` | integer or null | yes | When the key expires, `null` for no expiry (Unix time, seconds, UTC) |
| `key.created_at` | integer | yes | When the key was created (Unix time, seconds, UTC) |
| `key.last_used_at` | integer or null | yes | When the key was last used, `null` if never (Unix time, seconds, UTC) |
| `key.last_ip` | string or null | yes | IP address of the last call made with the key. |
| `key.req_count` | integer | yes | Number of calls made with the key. |
| `key.revoked_at` | integer or null | yes | When the key was revoked, `null` if it was not (Unix time, seconds, UTC) |
| `key.status` | string: `active`, `expired`, `revoked` | yes | `revoked` once revoked, `expired` after `expires_at`, otherwise `active`. |
| `account_id` | integer | yes | Account the key belongs to. |
| `site` | object | yes |  |
| `site.brand` | string | yes | Name of the site. |
| `site.url` | string | yes | Base address of the API for this site. |
| `rate_limit` | object | yes |  |
| `rate_limit.per_key_per_minute` | integer | yes | Requests per minute allowed for each key. |
| `rate_limit.per_account_per_minute` | integer | yes | Requests per minute allowed for the whole account across its keys. |
| `rate_limit.key_remaining` | integer | yes | Requests this key may still make in the current window. |
| `rate_limit.account_remaining` | integer | yes | Requests the account may still make in the current window. |
| `rate_limit.key_reset` | integer | yes | When the key's window resets (Unix time, seconds, UTC) |
| `rate_limit.account_reset` | integer | yes | When the account's window resets (Unix time, seconds, UTC) |

Example:

```json
{
  "account_id": 1042,
  "key": {
    "allow_ips": [],
    "created_at": 1790000000,
    "expires_at": null,
    "hint": "vk_Ab3x",
    "id": "ak3f9c2d1e7a",
    "last_ip": "198.51.100.7",
    "last_used_at": 1792290000,
    "name": "ci-deploy",
    "req_count": 129,
    "revoked_at": null,
    "scopes": [
      "vm:read",
      "vm:write"
    ],
    "status": "active"
  },
  "rate_limit": {
    "account_remaining": 299,
    "account_reset": 1792290060,
    "key_remaining": 119,
    "key_reset": 1792290060,
    "per_account_per_minute": 300,
    "per_key_per_minute": 120
  },
  "site": {
    "brand": "Example Cloud",
    "url": "https://api.example.com"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `key_required` | The call was made with a dashboard session instead of an API key. |

**Example request**

```bash
curl "https://api.onie.net/v1/apikeys/self" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Object Storage

S3-compatible object storage. An **account** owns **buckets**, buckets hold **objects**, and **access keys** let S3 clients (AWS CLI, SDKs, rclone) connect to it. These operations manage accounts, buckets, access keys, usage reports and share links, and can issue short-lived signed URLs for uploading and downloading objects. To move large amounts of data, use the S3 protocol itself with an access key.

Usage is billed pay-as-you-go from your wallet: stored data above the free allowance and downloaded data are charged, uploads are free, and downloads covered by a monthly download quota or bandwidth add-on are not charged. Object storage prices and costs are expressed in Vietnamese dong (VND). The secret of an access key is shown once, when the key is created or rotated, and cannot be retrieved later. Available on the main site only.

#### List S3 accounts

`GET /v1/s3`

Returns the S3 accounts you own, newest first. The list is not paginated. Accounts that are being deleted are not listed. Object storage is available on the main site only. Use the `id` of an account in every other S3 path.

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 account list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of S3Account | yes |  |
| `items[].id` | string | yes | Account identifier. Use it as `{id}` in every S3 path. |
| `items[].name` | string | yes | Display name of the account (1 to 80 characters). |
| `items[].state` | string: `provisioning`, `active`, `suspended_billing`, `suspended_account`, `suspended_admin` | yes | Lifecycle state. `provisioning`: being created. `active`: normal. `suspended_billing`: unpaid usage is above the allowed limit; it reactivates by itself once the balance is paid. `suspended_account`: your account is blocked. `suspended_admin`: suspended by support. Operations that write data fail with 423 unless the state is `active`. |
| `items[].billing_owner` | string: `native`, `legacy` | no | Billing system that manages the account. `legacy` marks an account that still belongs to a previous billing system: it can be read but not modified until it is migrated. |
| `items[].billing_start` | integer | yes | Start of the first billed hour (Unix time, seconds, UTC) |
| `items[].quota_gb` | integer | yes | Storage quota of the account in GiB. Writes are refused once the stored size reaches it. |
| `items[].zone_id` | integer | yes | Region where the account's data is stored. |
| `items[].created_at` | integer | yes | When the account was created (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "billing_start": 1792400400,
      "created_at": 1792402313,
      "id": "mR7xQ2vK9tLp4WnZc8YbH1sJdGfE6uAoVi3TyNkX0Mw",
      "name": "Backups",
      "quota_gb": 2048,
      "state": "active",
      "zone_id": 1
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | Object storage is not available on this site (it is offered on the main site only). |

**Example request**

```bash
curl "https://api.onie.net/v1/s3" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create an S3 account (usage-billed)

`POST /v1/s3`

Creates an S3 account in a region and returns its `id` together with the ID of its first access key. Creating an account is free; you pay for what you store and download (see `policy` in [Get an S3 account](#operation/s3_account_get)), but your wallet must hold the minimum balance, and the number of accounts per user is limited. For safety, the secret of the first key is **not** returned over the API: rotate that key with [Rotate an access key](#operation/s3_key_rotate) to receive a fresh secret, or create another key. Creation is limited to 10 per hour per account (429).

If provisioning fails part-way, the call fails with 502 and the account may remain listed in the `provisioning` state. Contact support instead of retrying with a new idempotency key, which would create a second account.

**Required scope:** `s3:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `s3:create` | CLI: `s3 account create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Display name of the account, 1 to 80 characters. |
| `zone_id` | integer | yes | Region that will store the data. Choose one from the object storage catalog; it must be a region where object storage is sold. |

Example:

```json
{
  "name": "Backups",
  "zone_id": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Identifier of the new account. |
| `state` | string | yes | State of the account; `active` when the call succeeds. |
| `key` | object | no |  |
| `key.access_key` | string | yes | ID of the first access key. Its secret is not returned here. |
| `note` | string | no | Reminder on how to obtain the secret of the first key. |

Example:

```json
{
  "id": "mR7xQ2vK9tLp4WnZc8YbH1sJdGfE6uAoVi3TyNkX0Mw",
  "key": {
    "access_key": "AKIAIOSFODNN7EXAMPLE"
  },
  "note": "The secret of this first key is not returned over the API: rotate the key to receive a new secret.",
  "state": "active"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `s3_error` | Object storage is not available on this site (it is offered on the main site only). |
| 409 | `s3_error` | The request was refused by a business rule: new accounts are paused, the region does not sell object storage or has no storage capacity ready, you reached the maximum number of accounts, or your wallet is below the minimum balance. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `s3_error` | `name` is empty or longer than 80 characters, or `zone_id` is missing. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 502 | `s3_error` | The storage service could not create the account. The account may remain listed in the `provisioning` state; contact support. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"name":"Backups","zone_id":1}'
```

---

#### Get one S3 account: endpoint, quota, stats

`GET /v1/s3/{id}`

Returns one account with what you need to connect and to understand its cost: the S3 endpoint and region to configure in your client, the region that stores the data, the quota and suspension status of the storage user, live totals (stored bytes, objects, buckets), the pricing policy that applies, and your cost-alert threshold. Totals are read live from the storage service, so the call is slower than the list and fails with 502 if the storage service cannot be reached.

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 account get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `resource` | S3Account | yes |  |
| `resource.id` | string | yes | Account identifier. Use it as `{id}` in every S3 path. |
| `resource.name` | string | yes | Display name of the account (1 to 80 characters). |
| `resource.state` | string: `provisioning`, `active`, `suspended_billing`, `suspended_account`, `suspended_admin` | yes | Lifecycle state. `provisioning`: being created. `active`: normal. `suspended_billing`: unpaid usage is above the allowed limit; it reactivates by itself once the balance is paid. `suspended_account`: your account is blocked. `suspended_admin`: suspended by support. Operations that write data fail with 423 unless the state is `active`. |
| `resource.billing_owner` | string: `native`, `legacy` | no | Billing system that manages the account. `legacy` marks an account that still belongs to a previous billing system: it can be read but not modified until it is migrated. |
| `resource.billing_start` | integer | yes | Start of the first billed hour (Unix time, seconds, UTC) |
| `resource.quota_gb` | integer | yes | Storage quota of the account in GiB. Writes are refused once the stored size reaches it. |
| `resource.zone_id` | integer | yes | Region where the account's data is stored. |
| `resource.created_at` | integer | yes | When the account was created (Unix time, seconds, UTC) |
| `endpoint` | string | yes | S3 endpoint URL to configure in S3 clients. |
| `region` | string | yes | Signing region name to configure in S3 clients. |
| `zone` | S3Zone | yes |  |
| `zone.id` | integer | yes | Region identifier. |
| `zone.slug` | string | yes | Short name of the region. |
| `zone.name` | string | yes | Display name. |
| `zone.name_en` | string or null | yes | English display name. |
| `zone.country` | string | yes | ISO country code. |
| `zone.city` | string or null | yes | City. |
| `zone.is_default` | boolean | yes | Whether this is the default region of the site. |
| `zone.services` | array of string | yes |  |
| `user` | object | yes |  |
| `user.suspended` | integer or boolean | yes | Whether the storage user is suspended: 1 or `true` when suspended, 0 or `false` otherwise. |
| `user.max_buckets` | integer | yes | Maximum number of buckets the account may own. |
| `user.user_quota` | S3Quota | yes |  |
| `user.user_quota.enabled` | boolean | no | Whether the quota is enforced. |
| `user.user_quota.max_size` | integer | no | Maximum stored size in bytes. -1 means unlimited. |
| `user.user_quota.max_objects` | integer | no | Maximum number of objects. -1 means unlimited. |
| `user.bucket_quota` | S3Quota | yes |  |
| `user.bucket_quota.enabled` | boolean | no | Whether the quota is enforced. |
| `user.bucket_quota.max_size` | integer | no | Maximum stored size in bytes. -1 means unlimited. |
| `user.bucket_quota.max_objects` | integer | no | Maximum number of objects. -1 means unlimited. |
| `stats` | object | yes |  |
| `stats.storage_bytes` | integer | yes | Total bytes stored in all buckets. |
| `stats.objects` | integer | yes | Total number of objects. |
| `stats.buckets` | integer | yes | Number of buckets. |
| `policy` | S3Policy | yes |  |
| `policy.storage_price_per_gb_month` | number | yes | Price of storing 1 GiB for a 730-hour month, in VND. Storage is metered every hour at this price divided by 730. |
| `policy.bandwidth_out_price_per_gb` | number | yes | Price of 1 GiB downloaded, in VND. |
| `policy.bandwidth_in_price_per_gb` | number | yes | Price of 1 GiB uploaded, in VND. Always 0: uploads are free. |
| `policy.free_tier_gb` | number | yes | Free storage allowance in GiB. It applies while you have a running server (see `free_eligible`) and is shared by all your S3 accounts. |
| `policy.max_debt` | number | yes | Unpaid usage in VND above which your wallet is charged immediately. If the wallet cannot cover it, your S3 accounts are suspended until the balance is paid. |
| `policy.min_settle` | number | yes | Smallest amount in VND that is invoiced in a daily settlement. Smaller amounts are carried over to the next day; everything is settled on the first day of each month. |
| `policy.min_balance_create` | number | yes | Wallet balance, in VND (converted at the current exchange rate), required to create a new account. |
| `policy.max_accounts_per_user` | integer | yes | Maximum number of S3 accounts one user may have. |
| `policy.default_quota_gb` | integer | yes | Storage quota in GiB given to a new account. |
| `free_eligible` | boolean | yes | Whether you currently qualify for the free storage allowance (you have a running server). |
| `preferences` | S3Preferences | yes |  |
| `preferences.alert_threshold_vnd` | number | yes | Monthly usage cost in VND at which you are notified. 0 means no alert. |

Example:

```json
{
  "endpoint": "https://s3.example.com",
  "free_eligible": true,
  "policy": {
    "bandwidth_in_price_per_gb": 0.0,
    "bandwidth_out_price_per_gb": 999.0,
    "default_quota_gb": 2048,
    "free_tier_gb": 100.0,
    "max_accounts_per_user": 10,
    "max_debt": 50000.0,
    "min_balance_create": 50000.0,
    "min_settle": 500.0,
    "storage_price_per_gb_month": 399.0
  },
  "preferences": {
    "alert_threshold_vnd": 0.0
  },
  "region": "default",
  "resource": {
    "billing_start": 1792400400,
    "created_at": 1792402313,
    "id": "mR7xQ2vK9tLp4WnZc8YbH1sJdGfE6uAoVi3TyNkX0Mw",
    "name": "Backups",
    "quota_gb": 2048,
    "state": "active",
    "zone_id": 1
  },
  "stats": {
    "buckets": 3,
    "objects": 1284,
    "storage_bytes": 53687091200
  },
  "user": {
    "bucket_quota": {
      "enabled": false,
      "max_objects": -1,
      "max_size": -1
    },
    "max_buckets": 1000,
    "suspended": 0,
    "user_quota": {
      "enabled": true,
      "max_objects": -1,
      "max_size": 2199023255552
    }
  },
  "zone": {
    "city": "Ho Chi Minh City",
    "country": "VN",
    "id": 1,
    "is_default": true,
    "name": "Ho Chi Minh City",
    "name_en": "Ho Chi Minh City",
    "services": [
      "vm",
      "s3"
    ],
    "slug": "hcm-1"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 502 | `s3_error` | The storage service could not be reached. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rename / set the cost alert threshold

`PATCH /v1/s3/{id}`

Renames the account and/or sets its monthly cost alert. Send only the fields you want to change. When the cost of the usage accumulated in the current month reaches `alert_threshold_vnd`, a notification is created for you; 0 turns the alert off. Works in every account state, including suspended ones.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 account update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | New display name, 1 to 80 characters. |
| `alert_threshold_vnd` | number | no | Monthly cost in VND that triggers a notification. 0 disables the alert. Must be a number between 0 and 1,000,000,000,000. |

Example:

```json
{
  "alert_threshold_vnd": 500000,
  "name": "Production backups"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |
| `preferences` | S3Preferences | yes |  |
| `preferences.alert_threshold_vnd` | number | yes | Monthly usage cost in VND at which you are notified. 0 means no alert. |

Example:

```json
{
  "ok": true,
  "preferences": {
    "alert_threshold_vnd": 500000.0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 422 | `s3_error` | `name` is empty or longer than 80 characters, or `alert_threshold_vnd` is not a number in the allowed range. |
| 502 | `s3_error` | The account is waiting for a migration from a previous billing system to finish and cannot be changed yet. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/s3/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"alert_threshold_vnd":500000,"name":"Production backups"}'
```

---

#### Delete the S3 account (all buckets must be removed first)

`DELETE /v1/s3/{id}`

Deletes an S3 account. Every bucket must be deleted first (empty a bucket with the `purge-bucket` action or by deleting its objects, then delete the bucket); otherwise the call fails. The account is locked and disappears from the API immediately; usage up to the end of the current hour is still billed, then the storage user is removed. This cannot be undone. Deletions are limited to 10 per hour per account (429).

**Required scope:** `s3:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `s3:destroy` | CLI: `s3 account delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 502 | `s3_error` | The account still has buckets (delete them first), or the storage service could not be reached. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/s3/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Hourly storage, traffic and cost

`GET /v1/s3/{id}/usage`

Returns the hourly usage records of the account, newest first, with the cost computed for each hour, plus the pricing policy that applies. Each record covers one hour: the bytes stored at the end of the hour, the bytes uploaded and downloaded during it, and the resulting cost in VND. At most 1000 records are returned. Records appear a few minutes after the hour ends. For a per-day view of one month use [Get S3 usage summary](#operation/s3_account_usage_summary).

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 account usage`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `from` | integer | no | Earliest hour to include, as Unix time in seconds. Defaults to 31 days ago. Values older than 366 days are raised to that limit; a value that is not a number is ignored. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of S3UsageHour | yes |  |
| `items[].hour` | integer | yes | Start of the measured hour (Unix time, seconds, UTC) |
| `items[].storage_bytes` | integer | yes | Bytes stored at the end of the hour. |
| `items[].free_bytes` | integer | yes | Part of the stored bytes covered by the free allowance. |
| `items[].bytes_in` | integer | yes | Bytes uploaded during the hour. |
| `items[].bytes_out` | integer | yes | Bytes downloaded during the hour. |
| `items[].storage_cost_vnd` | number | yes | Storage cost of the hour in VND. |
| `items[].bandwidth_cost_vnd` | number | yes | Download cost of the hour in VND. |
| `items[].cost_vnd` | number | yes | Total cost of the hour in VND (storage plus download). |
| `items[].status` | string | yes | How the hour is billed. `accrued`: added to your usage bill. `forgiven_account_suspended`: not billed because your account was blocked. Values starting with `legacy_` are hours that were billed by a previous billing system. |
| `policy` | S3Policy or null | yes |  |

Example:

```json
{
  "items": [
    {
      "bandwidth_cost_vnd": 1998.0,
      "bytes_in": 1073741824,
      "bytes_out": 2147483648,
      "cost_vnd": 1998.0,
      "free_bytes": 53687091200,
      "hour": 1792400400,
      "status": "accrued",
      "storage_bytes": 53687091200,
      "storage_cost_vnd": 0.0
    }
  ],
  "policy": {
    "bandwidth_in_price_per_gb": 0.0,
    "bandwidth_out_price_per_gb": 999.0,
    "default_quota_gb": 2048,
    "free_tier_gb": 100.0,
    "max_accounts_per_user": 10,
    "max_debt": 50000.0,
    "min_balance_create": 50000.0,
    "min_settle": 500.0,
    "storage_price_per_gb_month": 399.0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/usage" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Daily usage summary for a month

`GET /v1/s3/{id}/usage-summary`

Aggregates the hourly records of one calendar month into days (UTC) and returns the month total. Days with no records are omitted. `cost_vnd` counts only hours that are billed, so hours forgiven while your account was blocked do not add to it. Stored sizes are daily averages. Use it for monthly charts and to see how close you are to your cost alert.

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 account usage-summary`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `month` | string | no | Month to summarise as `YYYY-MM` (years 2000 to 2100). Defaults to the current month in UTC. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `month` | string | yes | The month that was summarised, `YYYY-MM`. |
| `daily` | array of object | yes |  |
| `daily[].day` | integer | yes | Start of the day (00:00 UTC) (Unix time, seconds, UTC) |
| `daily[].bytes_in` | integer | yes | Bytes uploaded during the day. |
| `daily[].bytes_out` | integer | yes | Bytes downloaded during the day. |
| `daily[].cost_vnd` | number | yes | Billed cost of the day in VND. |
| `daily[].storage_bytes` | number | yes | Average bytes stored during the day. |
| `daily[].free_bytes` | number | yes | Average bytes covered by the free allowance during the day. |
| `cost_vnd` | number | yes | Total billed cost of the month in VND. |
| `preferences` | S3Preferences | yes |  |
| `preferences.alert_threshold_vnd` | number | yes | Monthly usage cost in VND at which you are notified. 0 means no alert. |

Example:

```json
{
  "cost_vnd": 47952.0,
  "daily": [
    {
      "bytes_in": 5368709120,
      "bytes_out": 2147483648,
      "cost_vnd": 47952.0,
      "day": 1792281600,
      "free_bytes": 53687091200.0,
      "storage_bytes": 53687091200.0
    }
  ],
  "month": "2026-10",
  "preferences": {
    "alert_threshold_vnd": 500000.0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 422 | `s3_error` | `month` is not a valid `YYYY-MM` value. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/usage-summary" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List buckets

`GET /v1/s3/{id}/buckets`

Lists the buckets of the account with their creation time, object count and size. Counts and sizes are statistics reported by the storage service and may lag slightly behind very recent uploads or deletions. To list the objects inside a bucket use [List objects](#operation/s3_object_list).

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 bucket list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of S3Bucket | yes |  |
| `items[].name` | string | yes | Bucket name. |
| `items[].created_at` | string or null | yes | Creation time as an ISO 8601 timestamp. |
| `items[].objects` | integer | yes | Number of objects in the bucket. |
| `items[].size_bytes` | integer | yes | Total size of the objects in bytes. |

Example:

```json
{
  "items": [
    {
      "created_at": "2026-10-19T03:21:08.512347Z",
      "name": "my-bucket",
      "objects": 1284,
      "size_bytes": 53687091200
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 502 | `s3_error` | The storage service could not be reached. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/buckets" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a bucket

`POST /v1/s3/{id}/buckets`

Creates a bucket. Bucket names are 3 to 63 characters long, use only lowercase letters, digits, hyphens and dots, begin and end with a letter or digit, contain no consecutive dots and must not look like an IP address. Names are unique across the whole service, so a name already used by anyone fails. A new bucket is private. It also receives a default CORS rule that allows the web dashboard to upload to it; replace it with the `cors-set` action of [Run a bucket action](#operation/s3_bucket_action) if you need a different policy. The account must be `active`.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 bucket create`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Bucket name, 3 to 63 characters (lowercase letters, digits, hyphens, dots). |

Example:

```json
{
  "name": "my-bucket"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 422 | `s3_error` | The bucket name is not valid. |
| 423 | `s3_error` | The account is not `active` (it is still being created or is suspended), so it cannot create buckets. |
| 502 | `s3_error` | The storage service refused the request, for example because the bucket name is already taken, or it could not be reached. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3/<id>/buckets" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"my-bucket"}'
```

---

#### List objects in a bucket (paged)

`GET /v1/s3/{id}/buckets/{bucket}`

Lists the objects of a bucket one folder level at a time. The listing uses `/` as delimiter: objects directly under `prefix` are returned in `objects` and deeper folders are returned as `prefixes`. A page holds at most 100 entries; when `truncated` is true pass `next` as `continuation-token` to get the following page. Works in every account state. For very large listings use the S3 protocol with an access key.

**Required scope:** `s3:read`.

Scope: `s3:read` | CLI: `s3 object list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `bucket` | string | yes | Name of a bucket that belongs to the S3 account. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | no | Only list keys that start with this prefix, at most 1024 bytes without control characters. Use a folder prefix ending in `/` to look inside a folder. |
| `continuation-token` | string | no | Page token returned as `next` by the previous call, at most 4096 bytes. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `objects` | array of object | yes |  |
| `objects[].key` | string | yes | Object key. |
| `objects[].size` | integer | yes | Size in bytes. |
| `objects[].modified` | string | yes | Last modification time as an ISO 8601 timestamp. |
| `objects[].etag` | string | yes | Entity tag of the object, including the surrounding quotes. Empty when unknown. |
| `prefixes` | array of object | yes |  |
| `prefixes[].prefix` | string | yes | Folder prefix ending in `/`. Pass it as `prefix` to list inside that folder. |
| `next` | string or null | yes | Token for the next page, or null on the last page. Pass it as `continuation-token`. |
| `truncated` | boolean | yes | True when more entries exist beyond this page. |

Example:

```json
{
  "next": null,
  "objects": [
    {
      "etag": "\"9e107d9d372bb6826bd81d3542a419d6\"",
      "key": "reports/2026-10.pdf",
      "modified": "2026-10-19T08:55:12.000Z",
      "size": 482113
    }
  ],
  "prefixes": [
    {
      "prefix": "reports/archive/"
    }
  ],
  "truncated": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist, or the bucket belongs to a different account. |
| 422 | `s3_error` | `prefix` or `continuation-token` is too long or contains control characters. |
| 502 | `s3_error` | The storage service refused the request (for example the bucket does not exist) or could not be reached. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/buckets/<bucket>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Delete a bucket (must be empty)

`DELETE /v1/s3/{id}/buckets/{bucket}`

Deletes an empty bucket. A bucket that still holds objects, including old versions, cannot be deleted and the call fails; to remove a bucket together with everything in it use the `purge-bucket` action of [Run a bucket action](#operation/s3_bucket_action). The bucket name becomes available to anyone once it is deleted. The account must be `active`.

**Required scope:** `s3:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `s3:destroy` | CLI: `s3 bucket delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `bucket` | string | yes | Name of a bucket that belongs to the S3 account. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `s3_error` | The account does not exist, or the bucket belongs to a different account. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `s3_error` | The account is not `active`. |
| 502 | `s3_error` | The bucket is not empty or does not exist, or the storage service could not be reached. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/s3/<id>/buckets/<bucket>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Bucket and object operations selected by the op field (delete ops also need s3:destroy)

`POST /v1/s3/{id}/buckets/{bucket}/action`

Runs one operation on a bucket or on an object inside it. The operation is chosen with `op`; the other body fields depend on it (table below). Use it for management tasks and to obtain signed URLs. For bulk transfers, large uploads or listings of very many objects, use the S3 protocol directly with an access key.

**Scopes and states.** Every operation needs `s3:write`. Operations that delete data additionally need `s3:destroy` and fail with 403 `scope_required` without it: `purge-bucket`, `delete-object`, `delete-objects`, `delete-folder`, `delete-version`, `move-object` (it removes the source) and `lifecycle-set` (a lifecycle rule can schedule deletions). All operations need the account to be `active` (otherwise 423), except the read-only ones: `info`, `versions`, `versioning-get`, `acl-get`, `object-acl-get`, `cors-get`, `lifecycle-get`, `policy-get`, `metadata-get` and `public-url`. Object keys are 1 to 1024 bytes, without control characters and without `.` or `..` path segments. A `destination_bucket` must belong to the same S3 account.

**Signed URLs.** `download`, `preview`, `upload` and `multipart-part` return a pre-signed URL. For the first three, `expires_seconds` sets its lifetime (60 to 900, default 900; other values are clamped); a `multipart-part` URL is valid for 900 seconds. The `upload` URL must be used with an HTTP `PUT` that sends the same `Content-Type` that was requested (default `application/octet-stream`).

| `op` | Fields | Result |
|---|---|---|
| `info` | `key` | `{size, content_type, etag, modified}`: size in bytes, `modified` as an HTTP date. |
| `download` | `key`, `expires_seconds` | `{url, expires_seconds}`: signed `GET` URL that downloads the object as an attachment. |
| `preview` | `key`, `expires_seconds` | `{url, expires_seconds}`: signed `GET` URL that lets a browser display the object. |
| `upload` | `key`, `content_type`, `expires_seconds` | `{url, expires_seconds}`: signed `PUT` URL for uploading the object. |
| `create-folder` | `key` (ends with `/`) | `{ok}`: creates an empty folder marker. |
| `copy-object` | `key`, `destination`, `destination_bucket` | `{ok}`: copies the object. The destination must differ from the source. |
| `move-object` | `key`, `destination`, `destination_bucket` | `{ok}`: copies the object, then removes the source. Needs `s3:destroy`. |
| `delete-object` | `key` | `{ok}`. Needs `s3:destroy`. |
| `delete-objects` | `keys` (1 to 1000) | `{deleted, errors}`: `deleted` is the number removed; `errors` lists `{key, code}` for the keys that failed. Needs `s3:destroy`. |
| `delete-folder` | `key` (ends with `/`) | `{deleted, more}` (plus `errors` if some deletions failed, in which case it stops). Removes up to about 500 objects per call; call again while `more` is true. Needs `s3:destroy`. |
| `versions` | `key`, `key-marker`, `version-id-marker` | `{items, next_key, next_version, truncated}`: versions and delete markers of that exact key, each `{key, version_id, latest, modified, size, etag, delete_marker}`. Page with the returned markers. |
| `restore-version` | `key`, `version_id`, `destination_bucket` | `{ok}`: copies that version over the current object. |
| `delete-version` | `key`, `version_id` | `{ok}`. Needs `s3:destroy`. |
| `versioning-get` | none | `{enabled}`. |
| `versioning-set` | `enabled` | `{ok}`: turns versioning on, or suspends it. |
| `acl-get` | none | `{permission}`: `private` or `public-read` for the bucket. |
| `acl-set` | `permission` | `{ok}`: sets the bucket permission. |
| `object-acl-get` | `key` | `{permission}` for the object. |
| `object-acl-set` | `key`, `permission` | `{ok}`. |
| `cors-get`, `lifecycle-get`, `policy-get` | none | `{xml}`: the configuration document as text, empty when none is set. For `policy-get` the text is the JSON bucket policy. |
| `cors-set`, `lifecycle-set` | `xml` (up to 16000 bytes; root element `CORSConfiguration` or `LifecycleConfiguration`) | `{ok}`: replaces the configuration. `lifecycle-set` needs `s3:destroy`. |
| `cors-delete`, `lifecycle-delete` | none | `{ok}`. |
| `multipart-init` | `key`, `content_type` | `{upload_id}`: starts a multipart upload. |
| `multipart-part` | `key`, `upload_id`, `part_number` (1 to 10000) | `{url}`: signed `PUT` URL for one part. Read the `ETag` response header of the upload. |
| `multipart-complete` | `key`, `upload_id`, `parts` | `{ok}`: `parts` is a list of `{part_number, etag}` in ascending order. |
| `multipart-abort` | `key`, `upload_id` | `{ok}`. |
| `purge-bucket` | `confirm` (the bucket name) | `{ok}`: deletes the bucket and ALL objects in it. Cannot be undone. Needs `s3:destroy`. |
| `metadata-get` | none | `{public_prefixes, custom_domain, referer_allow}`: settings stored with the bucket. |
| `metadata-set` | `custom_domain`, `referer_allow` | The updated settings. Both fields are replaced: one you omit is cleared. |
| `public-prefixes-set` | `prefixes` (up to 50, each ending with `/`, no `*`) | The updated settings. Objects under these prefixes become publicly readable; an empty list removes public access. |
| `public-url` | `key` | `{url}`: the public (unsigned) URL of the object, which works only if the object is public. Uses `custom_domain` when one is set. |

An unknown `op` is rejected with 422. A bucket that does not exist, an object that does not exist, or a refusal by the storage service is reported as 502.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 bucket action` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `bucket` | string | yes | Name of a bucket that belongs to the S3 account. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `op` | string: `info`, `download`, `preview`, `upload`, `create-folder`, `delete-object`, `delete-objects`, `delete-folder`, `copy-object`, `move-object`, `restore-version`, `versions`, `delete-version`, `versioning-get`, `versioning-set`, `acl-get`, `acl-set`, `object-acl-get`, `object-acl-set`, `cors-get`, `cors-set`, `cors-delete`, `lifecycle-get`, `lifecycle-set`, `lifecycle-delete`, `policy-get`, `multipart-init`, `multipart-part`, `multipart-complete`, `multipart-abort`, `purge-bucket`, `metadata-get`, `metadata-set`, `public-prefixes-set`, `public-url` | yes | Operation to run. The table in the description lists the fields each operation uses. |
| `key` | string | no | Object key, or the folder prefix (ending with `/`) for folder operations. |
| `keys` | array of string | no | Keys to delete, 1 to 1000 (`delete-objects`). |
| `destination` | string | no | Target object key (`copy-object`, `move-object`). |
| `destination_bucket` | string | no | Bucket that receives the copy. It must belong to the same S3 account. Defaults to the source bucket. |
| `version_id` | string | no | Object version identifier, as returned by `versions` (`restore-version`, `delete-version`). |
| `key-marker` | string | no | Key marker returned as `next_key` by the previous `versions` call. |
| `version-id-marker` | string | no | Version marker returned as `next_version` by the previous `versions` call. |
| `confirm` | string | no | Repeat the bucket name exactly to confirm `purge-bucket`. |
| `permission` | string: `private`, `public-read` | no | Access level for `acl-set` and `object-acl-set`. |
| `enabled` | boolean | no | Turn versioning on (`true`) or suspend it (`false`) for `versioning-set`. |
| `xml` | string | no | Configuration document for `cors-set` or `lifecycle-set`. |
| `expires_seconds` | integer | no | Lifetime of a signed URL in seconds (`download`, `preview`, `upload`). Clamped to 60 to 900; default 900. |
| `content_type` | string | no | Content type of the uploaded object (`upload`, `multipart-init`). Default `application/octet-stream`. |
| `upload_id` | string | no | Multipart upload identifier returned by `multipart-init`. |
| `part_number` | integer | no | Part number, 1 to 10000 (`multipart-part`). |
| `parts` | array of object | no | Uploaded parts in ascending order (`multipart-complete`). |
| `parts[].part_number` | integer | yes | Part number. |
| `parts[].etag` | string | yes | ETag returned for that part. |
| `custom_domain` | string | no | Domain name that serves the bucket publicly (`metadata-set`). Host name only, without scheme, port or path. Empty clears it. |
| `referer_allow` | string | no | Comma-separated referrer allow-list, up to 500 characters (`metadata-set`). Empty clears it. |
| `prefixes` | array of string | no | Folder prefixes to make public (`public-prefixes-set`). |

Example:

```json
{
  "expires_seconds": 300,
  "key": "reports/2026-10.pdf",
  "op": "download"
}
```

**Response 200** - Success.

Example:

```json
{
  "expires_seconds": 300,
  "url": "https://s3.example.com/my-bucket/reports/2026-10.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20261019%2Fdefault%2Fs3%2Faws4_request&X-Amz-Date=20261019T090000Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&response-content-disposition=attachment&X-Amz-Signature=3b1f0c5a8e7d4926b1c3a5f7e9d0b2c4a6e8f0123456789abcdef0123456789a"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist, or a bucket (the source or `destination_bucket`) belongs to a different account. |
| 422 | `s3_error` | `op` is missing or unknown, a required field is missing or malformed, or `purge-bucket` was sent without the exact bucket name in `confirm`. |
| 423 | `s3_error` | The account is not `active` and the operation is not a read-only one. |
| 502 | `s3_error` | The storage service refused the request (for example the object or bucket does not exist) or could not be reached. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3/<id>/buckets/<bucket>/action" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expires_seconds":300,"key":"reports/2026-10.pdf","op":"download"}'
```

---

#### List access keys (no secrets)

`GET /v1/s3/{id}/keys`

Lists the access keys of the account. Secrets are never included; they are shown only when a key is created or rotated. The response is not cached. An account can hold up to 10 keys.

**Required scope:** `s3:keys`.

Scope: `s3:keys` | CLI: `s3 key list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of S3AccessKey | yes |  |
| `items[].access_key` | string | yes | Access key ID. |
| `items[].created_at` | integer or null | yes | When the key was created; null for keys created outside this API (Unix time, seconds, UTC) |
| `items[].last_used_at` | integer or null | yes | Reserved; always null because the last use of a key is not recorded (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "access_key": "AKIAIOSFODNN7EXAMPLE",
      "created_at": 1792402313,
      "last_used_at": null
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 502 | `s3_error` | The storage service could not be reached. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/keys" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create an access key (the secret is shown once)

`POST /v1/s3/{id}/keys`

Creates an additional access key and returns it with its secret. **The secret appears only in this response** (the response is marked `Cache-Control: no-store`); store it now, because it cannot be retrieved later. If it is lost, rotate the key. An account holds up to 10 keys, and the account must be `active`. This call takes no body and, because it returns a secret, does not use an `Idempotency-Key`: a retry creates another key.

**Required scope:** `s3:keys`.

Scope: `s3:keys` | CLI: `s3 key create`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | S3IssuedKey | yes |  |
| `key.access_key` | string | yes | Access key ID. |
| `key.secret_key` | string | yes | Secret access key. Shown only in this response; store it now. If it is lost, rotate the key. |

Example:

```json
{
  "key": {
    "access_key": "AKIAIOSFODNN7EXAMPLE",
    "secret_key": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |
| 422 | `s3_error` | The account already has 10 access keys; delete one first. |
| 423 | `s3_error` | The account is not `active`. |
| 502 | `s3_error` | The storage service could not create the key. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3/<id>/keys" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Delete an access key (at least one key must remain)

`DELETE /v1/s3/{id}/keys/{key}`

Deletes an access key. Clients that use it stop working immediately. The last remaining key cannot be deleted; create another one first. The account must be `active`.

**Required scope:** `s3:keys`.

Scope: `s3:keys` | CLI: `s3 key delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `key` | string | yes | Access key ID (the `access_key` value returned when the key was created or listed). It is not the secret. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account or the access key does not exist, or the account belongs to someone else. |
| 423 | `s3_error` | The account is not `active`. |
| 502 | `s3_error` | The key is the last one of the account, or the storage service could not be reached. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/s3/<id>/keys/<key>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rotate an access key (the new secret is shown once)

`POST /v1/s3/{id}/keys/{key}/rotate`

Replaces an access key: a new key is created, returned with its secret, and the old key is deleted. **The secret appears only in this response** (marked `Cache-Control: no-store`). Use it to obtain a secret for the first key of a new account, or after a secret is lost or leaked. Because the new key is created before the old one is removed, the account must have fewer than 10 keys. If removing the old key fails, `old_key_removed` is `false`; delete it yourself with [Delete an access key](#operation/s3_key_delete). This call takes no body and does not use an `Idempotency-Key`: a retry rotates again.

**Required scope:** `s3:keys`.

Scope: `s3:keys` | CLI: `s3 key rotate`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `key` | string | yes | Access key ID (the `access_key` value returned when the key was created or listed). It is not the secret. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `key` | S3IssuedKey | yes |  |
| `key.access_key` | string | yes | Access key ID. |
| `key.secret_key` | string | yes | Secret access key. Shown only in this response; store it now. If it is lost, rotate the key. |
| `old_key_removed` | boolean | yes | True when the previous key was deleted. If false, the old key still works until you delete it. |

Example:

```json
{
  "key": {
    "access_key": "AKIAI44QH8DHBEXAMPLE",
    "secret_key": "je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY"
  },
  "old_key_removed": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account or the access key does not exist, or the account belongs to someone else. |
| 422 | `s3_error` | The account already has 10 access keys, so a new key cannot be created; delete one first. |
| 423 | `s3_error` | The account is not `active`. |
| 502 | `s3_error` | The storage service could not create the new key. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3/<id>/keys/<key>/rotate" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List object share links (includes the link token)

`GET /v1/s3/{id}/share-links`

Lists the share links of the account, newest first, at most 500, including revoked ones (`revoked_at` is set). A share link lets anyone who has it open one object without credentials until the link expires, reaches its view limit or is revoked. Each entry includes the link path in `url`, which acts as a secret, so this call requires `s3:write` instead of `s3:read` and the response is not cached.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 share list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of S3ShareLink | yes |  |
| `items[].id` | string | yes | Link identifier. Use it as `{link}` to edit or revoke the link. |
| `items[].bucket` | string | yes | Bucket that holds the shared object. |
| `items[].key` | string | yes | Key of the shared object. |
| `items[].url` | string | yes | Path of the public link page, `/s/<token>`. Append it to the base URL of your site to get the full link. Anyone who has the link can open the object, so keep it private. |
| `items[].has_password` | boolean | yes | Whether visitors must enter a password. |
| `items[].expires_at` | integer | yes | Unix time (seconds) after which the link stops working. 0 means it never expires. |
| `items[].max_views` | integer | yes | Maximum number of times the link can be opened. 0 means unlimited. |
| `items[].view_count` | integer | yes | How many times the link has been opened. |
| `items[].referer_allow` | string | yes | Comma-separated list of referrer hosts that may use the link (for example `example.com, *.example.org`). Empty means any referrer. |
| `items[].allow_download` | boolean | yes | Whether visitors may download the file. When false, they can only preview browser-displayable media (images, audio, video). |
| `items[].revoked_at` | integer or null | yes | When the link was revoked, or null while it is active (Unix time, seconds, UTC) |
| `items[].created_at` | integer | yes | When the link was created (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "allow_download": true,
      "bucket": "my-bucket",
      "created_at": 1792410000,
      "expires_at": 1793000000,
      "has_password": true,
      "id": "Hc2LwT9sEoQ5zXn7BvKd1RgYpU4aJmFi8NtCe0ZyAhk",
      "key": "reports/2026-10.pdf",
      "max_views": 10,
      "referer_allow": "",
      "revoked_at": null,
      "url": "/s/ZxP4mQe1Rk8WvTn6Lc3YbHs9JdGf2UaOiV5TyNjXw0M",
      "view_count": 2
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist or belongs to someone else. |

**Example request**

```bash
curl "https://api.onie.net/v1/s3/<id>/share-links" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create an object share link

`POST /v1/s3/{id}/share-links`

Creates a share link for one existing object and returns its path. Append `url` to the base URL of your site to get the full link, for example `https://cloud.example.com/s/...`. You can protect the link with a password, an expiry time, a view limit, a referrer allow-list, and by disallowing downloads (visitors can then only preview images, audio and video). The password is stored hashed and is never returned. An account can have at most 500 active links; creation is limited to 20 per minute (429). The account must be `active`.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 share create` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `bucket` | string | yes | Bucket that holds the object. |
| `key` | string | yes | Key of the object to share. The object must exist. |
| `expires_at` | integer | no | Unix time in seconds when the link stops working. Must be in the future and at most 366 days ahead. 0 or omitted: never expires. |
| `max_views` | integer | no | Maximum number of times the link can be opened, 0 to 1,000,000. 0 or omitted: unlimited. |
| `password` | string | no | Password visitors must enter, 8 to 64 characters. Omit or send an empty string for no password. |
| `referer_allow` | string | no | Comma-separated referrer hosts allowed to use the link, up to 500 characters. `*.example.com` matches subdomains. Omit for any referrer. |
| `allow_download` | boolean | no | Whether visitors may download the file. Default `true`. |

Example:

```json
{
  "allow_download": true,
  "bucket": "my-bucket",
  "expires_at": 1793000000,
  "key": "reports/2026-10.pdf",
  "max_views": 10,
  "password": "correct-horse-battery"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Link identifier. Use it as `{link}` to edit or revoke the link. |
| `url` | string | yes | Path of the link page, `/s/<token>`. Append it to the base URL of your site. |

Example:

```json
{
  "id": "Hc2LwT9sEoQ5zXn7BvKd1RgYpU4aJmFi8NtCe0ZyAhk",
  "url": "/s/ZxP4mQe1Rk8WvTn6Lc3YbHs9JdGf2UaOiV5TyNjXw0M"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist, or the bucket belongs to a different account. |
| 422 | `s3_error` | `bucket` or `key` is missing or invalid, a protection setting is out of range (expiry, view limit, password length, referrer list), or the account already has 500 active links. |
| 423 | `s3_error` | The account is not `active`. |
| 429 | `s3_error` | More than 20 links were created within a minute. |
| 502 | `s3_error` | The object or the bucket does not exist, or the storage service could not be reached. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/s3/<id>/share-links" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"allow_download":true,"bucket":"my-bucket","expires_at":1793000000,"key":"reports/2026-10.pdf","max_views":10,"password":"correct-horse-battery"}'
```

---

#### Edit expiry / password / limits of a share link

`PATCH /v1/s3/{id}/share-links/{link}`

Changes the protection settings of an active link. Expiry, view limit, referrer list and download flag are replaced as a set: a field you omit goes back to its default (never expires, unlimited views, any referrer, download allowed), so send all of them. The password is the exception: omit it to keep the current one, send an empty string to remove it, or send a new value of 8 to 64 characters. The object, the token and the view counter do not change. A revoked link cannot be edited. The account must be `active`.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 share update`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `link` | string | yes | Share link identifier (the `id` returned when the link was created or listed, not the token inside its URL). |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `expires_at` | integer | no | Unix time in seconds when the link stops working; must be in the future, at most 366 days ahead. 0 or omitted: never expires. |
| `max_views` | integer | no | Maximum number of times the link can be opened, 0 to 1,000,000. 0 or omitted: unlimited. |
| `password` | string | no | New password, 8 to 64 characters. Empty string removes the password. Omit to keep the current one. |
| `referer_allow` | string | no | Comma-separated referrer hosts allowed to use the link, up to 500 characters. Omit or empty for any referrer. |
| `allow_download` | boolean | no | Whether visitors may download the file. Default `true`. |

Example:

```json
{
  "allow_download": true,
  "expires_at": 1793500000,
  "max_views": 25
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist, or the link does not exist or was already revoked. |
| 422 | `s3_error` | A setting is out of range or has the wrong type (expiry, view limit, password length, referrer list, download flag). |
| 423 | `s3_error` | The account is not `active`. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/s3/<id>/share-links/<link>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"allow_download":true,"expires_at":1793500000,"max_views":25}'
```

---

#### Revoke a share link

`DELETE /v1/s3/{id}/share-links/{link}`

Revokes a share link. It stops working immediately and visitors see a not-found page. The entry stays in the list with `revoked_at` set. Revoking a link that is already revoked succeeds. Works in every account state.

**Required scope:** `s3:write`.

Scope: `s3:write` | CLI: `s3 share revoke` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | S3 account identifier, as returned by List S3 accounts. |
| `link` | string | yes | Share link identifier (the `id` returned when the link was created or listed, not the token inside its URL). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `s3_error` | The account does not exist, or the link does not belong to it. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/s3/<id>/share-links/<link>" \
  -H "Authorization: Bearer $API_KEY"
```

---

### GPU Cloud

Rent NVIDIA GPU servers by the hour or for a fixed billing cycle, and manage them afterwards. The section is available on sites that sell GPUs; elsewhere ordering fails with `sales_disabled`.

**How an order works.** Choose a GPU model, a template (the operating system image) and a disk size from the GPU catalog. [Quote the rental](#operation/gpu_quote) to fix the price for 180 seconds without paying anything, then [create the instance](#operation/gpu_create) with the `quote_id`: the first period is charged to your wallet and the instance starts in state `queued`. Poll [Get a GPU instance](#operation/gpu_get) until `state` is `active`, then connect over SSH to `public_ip` on the host port listed under `ports["22/tcp"]`, or open the web terminal with [Get an SSH ticket](#operation/gpu_ssh_token).

**Billing.** An `hourly` instance is paid one hour ahead, every hour, from the wallet. While it is stopped only the disk is billed (`storage_hourly_uusd`). The other cycles (`monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y`) are paid up front with a discount and renew automatically until you delete the instance, running or not. When the wallet cannot pay, a running instance is stopped and becomes `locked`; a locked instance is deleted after 7 days unless you add funds and start it.

**Commands are asynchronous.** Start, stop, reboot, recycle and delete answer at once with `{"ok": true, "pending": true}`. The work continues in the background: follow `state` and `intent` on the instance. While a command is running, other commands answer `409 invalid_state`.

#### List GPU instances

`GET /v1/gpu`

Lists the GPU instances of your account, newest first. Deleted instances are not listed; an instance whose order failed stays in the list with state `failed` and an `error_msg`. The list is not paginated.

`sales_enabled` is false when the site is not taking new GPU orders; instances you already have keep working and can still be managed. `counts` gives quick totals: `running` counts `active` instances whose machine reports `running`, `stopped` counts `stopped` and `locked` instances, and `error` counts `failed` instances plus `active` ones whose machine is not running.

**Required scope:** `gpu:read`.

Scope: `gpu:read` | CLI: `gpu list`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of GpuInstance | yes |  |
| `items[].id` | string | yes | Instance identifier: `gpu-` followed by 16 hexadecimal characters. Use it in the path of every call about this instance. |
| `items[].hostname` | string | yes | Host name you chose when you ordered the instance. |
| `items[].display_name` | string | yes | Display name of the instance. It starts out equal to `hostname`. |
| `items[].gpu_name` | string | yes | GPU model, for example `RTX 4090`. |
| `items[].gpu_count` | integer | yes | Number of GPUs. |
| `items[].vram_gb` | integer | yes | Total GPU memory over all GPUs, in GiB. |
| `items[].cpu` | integer | yes | Number of vCPU cores. |
| `items[].ram_gb` | integer | yes | System memory in GiB. |
| `items[].disk_gb` | integer | yes | Disk size you ordered, in GiB. |
| `items[].template_id` | integer | yes | Template the instance was created from. See the GPU catalog. |
| `items[].template_name` | string | yes | Display name of the template. |
| `items[].runtype` | string | yes | How the template is reached, for example `ssh` or `jupyter`. |
| `items[].state` | string: `queued`, `renting`, `provisioning`, `active`, `starting`, `stopping`, `stopped`, `locked`, `rebooting`, `recycling`, `destroying`, `failed`, `deleted` | yes | Lifecycle state. `queued`: the order is paid and waiting to be placed. `renting`: the machine is being rented. `provisioning`: the machine is booting. `active`: ready to use. `starting`, `stopping`, `rebooting`, `recycling`, `destroying`: a command is being carried out. `stopped`: powered off, disk kept. `locked`: stopped because the wallet could not pay, deleted after 7 days unless you add funds and start it. `failed`: the order could not be completed and was refunded, see `error_msg`. `deleted`: removed (never returned by the list). |
| `items[].runtime_status` | string | yes | Status the machine itself reports, for example `loading`, `running` or `stopped`. Informational only: decide what you can do from `state`. An `active` instance is ready when this is `running`. |
| `items[].public_ip` | string or null | yes | Public address of the machine. Null until the instance has been placed. |
| `items[].ssh_host` | string or null | yes | Relay host name that reaches the instance over SSH together with `ssh_port`. Null until the instance has been placed. |
| `items[].ssh_port` | integer or null | yes | Port of the SSH relay on `ssh_host`. |
| `items[].jupyter_url` | string or null | yes | URL of the Jupyter interface, for templates that provide one; null otherwise. |
| `items[].ports` | object | yes | Port mappings of the instance. Keys look like `22/tcp`; each value is a list of `{"HostIp": "0.0.0.0", "HostPort": "40122"}` objects. For direct SSH connect to `public_ip` on the `HostPort` of `22/tcp`. Empty until the instance runs. |
| `items[].hourly_uusd` | integer | yes | Price per hour while the machine runs, in millionths of a US dollar. It includes the disk you ordered. |
| `items[].cycle` | string: `hourly`, `monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y` | yes | Billing cycle chosen at order time. |
| `items[].charged_cents` | integer | yes | Total charged to your wallet for this instance so far, in US cents, including renewals and restarts. |
| `items[].paid_until` | integer or null | yes | End of the prepaid billing cycle. Null for hourly instances and until the first start (Unix time, seconds, UTC) |
| `items[].geolocation` | string or null | yes | Where the machine is located, for example `Texas, US`. |
| `items[].cuda_max` | number or null | yes | Highest CUDA version the machine's driver supports. |
| `items[].reliability` | number or null | yes | Reliability score of the machine between 0 and 1. |
| `items[].error_msg` | string or null | yes | Last problem message, for example why an order failed or why a start was refused. Null when there is none. |
| `items[].created_at` | integer | yes | Time the order was placed (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Time the instance last changed (Unix time, seconds, UTC) |
| `items[].billed_until` | integer or null | yes | End of the period that is currently paid. For hourly instances this is the end of the paid hour. Null before the first start (Unix time, seconds, UTC) |
| `items[].storage_hourly_uusd` | integer | yes | Disk price per hour while the instance is stopped, in millionths of a US dollar. |
| `items[].cycle_cents` | integer | yes | Price of one billing cycle in US cents. 0 for hourly instances. |
| `items[].intent` | string or null: `start`, `stop`, `reboot`, `recycle`, `destroy`, `suspend` | yes | Command being carried out right now, or null when the instance is idle. `suspend` is a stop started by the platform because the wallet could not pay. |
| `items[].refunded_cents` | integer | yes | Total refunded to your wallet for this instance so far, in US cents. |
| `sales_enabled` | boolean | yes | Whether the site currently accepts new GPU orders. |
| `total` | integer | yes | Number of instances in `items`. |
| `counts` | object | yes |  |
| `counts.all` | integer | yes | Number of instances in `items`. |
| `counts.running` | integer | yes | Instances that are `active` and running. |
| `counts.stopped` | integer | yes | Instances that are `stopped` or `locked`. |
| `counts.error` | integer | yes | Instances that are `failed`, plus `active` instances whose machine is not running. |

Example:

```json
{
  "counts": {
    "all": 1,
    "error": 0,
    "running": 1,
    "stopped": 0
  },
  "items": [
    {
      "billed_until": 1792414110,
      "charged_cents": 120,
      "cpu": 16,
      "created_at": 1792400000,
      "cuda_max": 12.8,
      "cycle": "hourly",
      "cycle_cents": 0,
      "disk_gb": 100,
      "display_name": "train-01",
      "error_msg": null,
      "geolocation": "Texas, US",
      "gpu_count": 1,
      "gpu_name": "RTX 4090",
      "hostname": "train-01",
      "hourly_uusd": 400000,
      "id": "gpu-3f6c1d0e8a524b57",
      "intent": null,
      "jupyter_url": null,
      "paid_until": null,
      "ports": {
        "22/tcp": [
          {
            "HostIp": "0.0.0.0",
            "HostPort": "40122"
          }
        ]
      },
      "public_ip": "203.0.113.45",
      "ram_gb": 64,
      "refunded_cents": 0,
      "reliability": 0.9871,
      "runtime_status": "running",
      "runtype": "ssh",
      "ssh_host": "gw5.example.net",
      "ssh_port": 22846,
      "state": "active",
      "storage_hourly_uusd": 2400,
      "template_id": 3,
      "template_name": "Ubuntu 24.04 CUDA 12.9 Devel (Pure SSH)",
      "updated_at": 1792400310,
      "vram_gb": 24
    }
  ],
  "sales_enabled": true,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/gpu" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a GPU rental (no charge; use the quote_id to rent)

`POST /v1/gpu/quote`

Finds the cheapest available machine that matches a GPU model, GPU count, template and disk size, and prices it. Nothing is charged and nothing is reserved on the machine: the returned `quote_id` only fixes the price for 180 seconds, and you pass it to [Create a GPU instance](#operation/gpu_create) to rent that machine.

Take `gpu_name`, `template_id` and the disk limits from the GPU catalog. Pass `offer_id` to price one specific machine from the catalog instead of the cheapest match. `charge_cents` is what Create takes from the wallet at once: one hour of compute for `hourly`, or the whole discounted cycle price for the other cycles (5% off monthly, 7% quarterly, 8% semiannual, 10% yearly, 15% for 2 years, 20% for 3 years). The price is checked again when the machine is rented, and the order is cancelled and refunded if the machine became more than 5% more expensive in between.

The call looks up live availability, so each account may make 15 quotes per minute.

**Required scope:** `gpu:read`.

Scope: `gpu:read` | CLI: `gpu quote`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `gpu_name` | string | yes | GPU model exactly as listed in the catalog, for example `RTX 4090`. |
| `gpu_count` | integer | yes | Number of GPUs, from 1 to 64. Only counts the catalog lists for the model are available. |
| `template_id` | integer | yes | Template (operating system image) to start. Taken from the GPU catalog. |
| `disk_gb` | integer | yes | Disk size in GiB. At least the template's minimum disk and at most 2000. |
| `offer_id` | integer | no | Price one specific machine offer from the catalog instead of the cheapest match. |
| `cycle` | string: `hourly`, `monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y` | no | Billing cycle. Defaults to `hourly`. |

Example:

```json
{
  "cycle": "hourly",
  "disk_gb": 100,
  "gpu_count": 1,
  "gpu_name": "RTX 4090",
  "template_id": 3
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `quote_id` | string | yes | Quote identifier. Pass it to Create within 180 seconds. |
| `expires_at` | integer | yes | Time the quote stops being valid (Unix time, seconds, UTC) |
| `offer` | GpuOffer | yes |  |
| `offer.offer_id` | integer | yes | Identifier of the machine offer. Pass it as `offer_id` to price this exact machine again. |
| `offer.gpu_name` | string | yes | GPU model. |
| `offer.gpu_count` | integer | yes | Number of GPUs on the machine. |
| `offer.vram_gb` | integer | yes | Total GPU memory over all GPUs, in GiB. |
| `offer.cpu` | integer | yes | Number of vCPU cores you get. |
| `offer.ram_gb` | integer | yes | System memory you get, in GiB. |
| `offer.disk_gb` | integer | yes | Free disk space the machine can offer, in GiB. Your ordered size is the top-level `disk_gb`. |
| `offer.inet_down` | integer | yes | Download bandwidth of the machine, in Mbit/s. |
| `offer.inet_up` | integer | yes | Upload bandwidth of the machine, in Mbit/s. |
| `offer.cuda_max` | number | yes | Highest CUDA version the machine's driver supports. |
| `offer.reliability` | number | yes | Reliability score of the machine between 0 and 1. |
| `offer.geolocation` | string | yes | Where the machine is located, for example `Texas, US`. |
| `offer.country_code` | string | yes | Two-letter country code of the location. |
| `offer.verified` | boolean | yes | Whether the machine is verified by the platform. |
| `offer.vms_enabled` | boolean | yes | Whether the machine can run full virtual-machine templates (templates that are not plain containers). |
| `offer.sell_usd_h` | number | yes | Price per hour while the machine runs, in US dollars, including the disk. |
| `offer.hourly_uusd` | integer | yes | The same hourly price in millionths of a US dollar. This is what the instance is billed per hour. |
| `offer.storage_uusd_gb_h` | integer | yes | Disk price per GiB and hour while the instance is stopped, in millionths of a US dollar. |
| `offer.monthly_cents` | integer | yes | Price of one month (730 hours) with the monthly cycle discount, in US cents. For comparison only. |
| `charge_cents` | integer | yes | Amount Create charges to the wallet immediately, in US cents. |
| `storage_hourly_uusd` | integer | yes | Disk price per hour while the instance is stopped, in millionths of a US dollar. |
| `disk_gb` | integer | yes | Disk size the quote is for, in GiB. |
| `cycle` | string: `hourly`, `monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y` | yes | Billing cycle the quote is for. |

Example:

```json
{
  "charge_cents": 40,
  "cycle": "hourly",
  "disk_gb": 100,
  "expires_at": 1792400180,
  "offer": {
    "country_code": "US",
    "cpu": 16,
    "cuda_max": 12.8,
    "disk_gb": 450,
    "geolocation": "Texas, US",
    "gpu_count": 1,
    "gpu_name": "RTX 4090",
    "hourly_uusd": 400000,
    "inet_down": 940,
    "inet_up": 880,
    "monthly_cents": 27740,
    "offer_id": 31872645,
    "ram_gb": 64,
    "reliability": 0.9871,
    "sell_usd_h": 0.4,
    "storage_uusd_gb_h": 24,
    "verified": true,
    "vms_enabled": false,
    "vram_gb": 24
  },
  "quote_id": "gq-9a7c3e5b1d2f4a60b8c4d6e8f0a1b2c3",
  "storage_hourly_uusd": 2400
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 409 | `out_of_stock` | No available machine matches the GPU model, count, template and disk size. Choose another configuration or try again later. |
| 422 | `invalid_argument` | `gpu_name` is empty, `gpu_count` is outside 1 to 64, `disk_gb` is below the template's minimum or above 2000, `cycle` is not one of the listed values, or `template_id` is not an available template. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 423 | `sales_disabled` | The site is not taking new GPU orders. |
| 502 | `market_unavailable` | Live availability could not be read. Try again shortly. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/quote" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"hourly","disk_gb":100,"gpu_count":1,"gpu_name":"RTX 4090","template_id":3}'
```

---

#### Rent a GPU instance from a quote (charges the wallet)

`POST /v1/gpu`

Rents the machine from a quote. The first period is charged to your wallet immediately (one hour of compute for `hourly`, the whole cycle price for the other cycles) and the instance is created in state `queued`. The platform then rents the machine in the background: follow [Get a GPU instance](#operation/gpu_get) until `state` is `active`, which can take several minutes, then connect over SSH with the key you chose.

The wallet must hold at least the site's minimum balance and at least the quote's `charge_cents`, otherwise the call fails with `402 insufficient_funds` and nothing is charged. If the machine cannot be started within about 15 minutes, the provider refuses the order, or the machine became more than 5% more expensive since the quote, the instance ends in state `failed` with an `error_msg` and the full amount is refunded.

Use a new `request_id` for every order and keep it when you retry: repeating the call with a `request_id` you already used returns the order created the first time and charges nothing more. Like every call that spends money it also needs the `Idempotency-Key` header.

**Required scope:** `gpu:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `gpu:create` | CLI: `gpu create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `quote_id` | string | yes | Quote returned by Quote a GPU rental. It is valid for 180 seconds and can be used for one order only. |
| `request_id` | string | yes | Identifier you invent for this order: 8 to 100 characters, letters, digits and hyphens. Retrying with the same value returns the existing order instead of creating a second one. |
| `hostname` | string | yes | Host name of the instance: 2 to 63 characters, letters, digits and hyphens, not starting or ending with a hyphen. Letters are lowercased. |
| `ssh_key_id` | integer | yes | Identifier of one of your stored SSH keys (see List SSH keys). Its public key is installed on the instance for the `root` user. |

Example:

```json
{
  "hostname": "train-01",
  "quote_id": "gq-9a7c3e5b1d2f4a60b8c4d6e8f0a1b2c3",
  "request_id": "8d5f2a1c-7b3e-4c90-a1d6-5e2f9b0c4d73",
  "ssh_key_id": 12
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | string | yes | Identifier of the new instance. |
| `instance` | GpuInstance | yes |  |
| `instance.id` | string | yes | Instance identifier: `gpu-` followed by 16 hexadecimal characters. Use it in the path of every call about this instance. |
| `instance.hostname` | string | yes | Host name you chose when you ordered the instance. |
| `instance.display_name` | string | yes | Display name of the instance. It starts out equal to `hostname`. |
| `instance.gpu_name` | string | yes | GPU model, for example `RTX 4090`. |
| `instance.gpu_count` | integer | yes | Number of GPUs. |
| `instance.vram_gb` | integer | yes | Total GPU memory over all GPUs, in GiB. |
| `instance.cpu` | integer | yes | Number of vCPU cores. |
| `instance.ram_gb` | integer | yes | System memory in GiB. |
| `instance.disk_gb` | integer | yes | Disk size you ordered, in GiB. |
| `instance.template_id` | integer | yes | Template the instance was created from. See the GPU catalog. |
| `instance.template_name` | string | yes | Display name of the template. |
| `instance.runtype` | string | yes | How the template is reached, for example `ssh` or `jupyter`. |
| `instance.state` | string: `queued`, `renting`, `provisioning`, `active`, `starting`, `stopping`, `stopped`, `locked`, `rebooting`, `recycling`, `destroying`, `failed`, `deleted` | yes | Lifecycle state. `queued`: the order is paid and waiting to be placed. `renting`: the machine is being rented. `provisioning`: the machine is booting. `active`: ready to use. `starting`, `stopping`, `rebooting`, `recycling`, `destroying`: a command is being carried out. `stopped`: powered off, disk kept. `locked`: stopped because the wallet could not pay, deleted after 7 days unless you add funds and start it. `failed`: the order could not be completed and was refunded, see `error_msg`. `deleted`: removed (never returned by the list). |
| `instance.runtime_status` | string | yes | Status the machine itself reports, for example `loading`, `running` or `stopped`. Informational only: decide what you can do from `state`. An `active` instance is ready when this is `running`. |
| `instance.public_ip` | string or null | yes | Public address of the machine. Null until the instance has been placed. |
| `instance.ssh_host` | string or null | yes | Relay host name that reaches the instance over SSH together with `ssh_port`. Null until the instance has been placed. |
| `instance.ssh_port` | integer or null | yes | Port of the SSH relay on `ssh_host`. |
| `instance.jupyter_url` | string or null | yes | URL of the Jupyter interface, for templates that provide one; null otherwise. |
| `instance.ports` | object | yes | Port mappings of the instance. Keys look like `22/tcp`; each value is a list of `{"HostIp": "0.0.0.0", "HostPort": "40122"}` objects. For direct SSH connect to `public_ip` on the `HostPort` of `22/tcp`. Empty until the instance runs. |
| `instance.hourly_uusd` | integer | yes | Price per hour while the machine runs, in millionths of a US dollar. It includes the disk you ordered. |
| `instance.cycle` | string: `hourly`, `monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y` | yes | Billing cycle chosen at order time. |
| `instance.charged_cents` | integer | yes | Total charged to your wallet for this instance so far, in US cents, including renewals and restarts. |
| `instance.paid_until` | integer or null | yes | End of the prepaid billing cycle. Null for hourly instances and until the first start (Unix time, seconds, UTC) |
| `instance.geolocation` | string or null | yes | Where the machine is located, for example `Texas, US`. |
| `instance.cuda_max` | number or null | yes | Highest CUDA version the machine's driver supports. |
| `instance.reliability` | number or null | yes | Reliability score of the machine between 0 and 1. |
| `instance.error_msg` | string or null | yes | Last problem message, for example why an order failed or why a start was refused. Null when there is none. |
| `instance.created_at` | integer | yes | Time the order was placed (Unix time, seconds, UTC) |
| `instance.updated_at` | integer | yes | Time the instance last changed (Unix time, seconds, UTC) |
| `instance.billed_until` | integer or null | yes | End of the period that is currently paid. For hourly instances this is the end of the paid hour. Null before the first start (Unix time, seconds, UTC) |
| `instance.storage_hourly_uusd` | integer | yes | Disk price per hour while the instance is stopped, in millionths of a US dollar. |
| `instance.cycle_cents` | integer | yes | Price of one billing cycle in US cents. 0 for hourly instances. |
| `instance.intent` | string or null: `start`, `stop`, `reboot`, `recycle`, `destroy`, `suspend` | yes | Command being carried out right now, or null when the instance is idle. `suspend` is a stop started by the platform because the wallet could not pay. |
| `instance.refunded_cents` | integer | yes | Total refunded to your wallet for this instance so far, in US cents. |

Example:

```json
{
  "id": "gpu-3f6c1d0e8a524b57",
  "instance": {
    "billed_until": null,
    "charged_cents": 40,
    "cpu": 16,
    "created_at": 1792400000,
    "cuda_max": 12.8,
    "cycle": "hourly",
    "cycle_cents": 0,
    "disk_gb": 100,
    "display_name": "train-01",
    "error_msg": null,
    "geolocation": "Texas, US",
    "gpu_count": 1,
    "gpu_name": "RTX 4090",
    "hostname": "train-01",
    "hourly_uusd": 400000,
    "id": "gpu-3f6c1d0e8a524b57",
    "intent": null,
    "jupyter_url": null,
    "paid_until": null,
    "ports": {},
    "public_ip": null,
    "ram_gb": 64,
    "refunded_cents": 0,
    "reliability": 0.9871,
    "runtime_status": "loading",
    "runtype": "ssh",
    "ssh_host": null,
    "ssh_port": null,
    "state": "queued",
    "storage_hourly_uusd": 2400,
    "template_id": 3,
    "template_name": "Ubuntu 24.04 CUDA 12.9 Devel (Pure SSH)",
    "updated_at": 1792400000,
    "vram_gb": 24
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is too low. The error carries `need_cents` (the required balance) and `balance_cents` (what you have). |
| 409 | `quote_expired` | The quote is unknown, belongs to another account, is older than 180 seconds, or the site's GPU pricing changed since it was issued. Request a new quote. |
| 409 | `quote_used` | The quote was already used for an order. Request a new quote. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `hostname` or `request_id` is malformed. |
| 422 | `ssh_key_required` | `ssh_key_id` is missing or is not one of your stored SSH keys. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `sales_disabled` | The site is not taking new GPU orders. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"hostname":"train-01","quote_id":"gq-9a7c3e5b1d2f4a60b8c4d6e8f0a1b2c3","request_id":"8d5f2a1c-7b3e-4c90-a1d6-5e2f9b0c4d73","ssh_key_id":12}'
```

---

#### Get one GPU instance

`GET /v1/gpu/{id}`

Returns one GPU instance. This is the call to poll after Create and after every command: `state` is the lifecycle state, `intent` names the command still being carried out (null when the instance is idle), and `public_ip` with `ports` tells you where to connect once the instance is `active`. A deleted instance answers `404`.

**Required scope:** `gpu:read`.

Scope: `gpu:read` | CLI: `gpu get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `instance` | GpuInstance | yes |  |
| `instance.id` | string | yes | Instance identifier: `gpu-` followed by 16 hexadecimal characters. Use it in the path of every call about this instance. |
| `instance.hostname` | string | yes | Host name you chose when you ordered the instance. |
| `instance.display_name` | string | yes | Display name of the instance. It starts out equal to `hostname`. |
| `instance.gpu_name` | string | yes | GPU model, for example `RTX 4090`. |
| `instance.gpu_count` | integer | yes | Number of GPUs. |
| `instance.vram_gb` | integer | yes | Total GPU memory over all GPUs, in GiB. |
| `instance.cpu` | integer | yes | Number of vCPU cores. |
| `instance.ram_gb` | integer | yes | System memory in GiB. |
| `instance.disk_gb` | integer | yes | Disk size you ordered, in GiB. |
| `instance.template_id` | integer | yes | Template the instance was created from. See the GPU catalog. |
| `instance.template_name` | string | yes | Display name of the template. |
| `instance.runtype` | string | yes | How the template is reached, for example `ssh` or `jupyter`. |
| `instance.state` | string: `queued`, `renting`, `provisioning`, `active`, `starting`, `stopping`, `stopped`, `locked`, `rebooting`, `recycling`, `destroying`, `failed`, `deleted` | yes | Lifecycle state. `queued`: the order is paid and waiting to be placed. `renting`: the machine is being rented. `provisioning`: the machine is booting. `active`: ready to use. `starting`, `stopping`, `rebooting`, `recycling`, `destroying`: a command is being carried out. `stopped`: powered off, disk kept. `locked`: stopped because the wallet could not pay, deleted after 7 days unless you add funds and start it. `failed`: the order could not be completed and was refunded, see `error_msg`. `deleted`: removed (never returned by the list). |
| `instance.runtime_status` | string | yes | Status the machine itself reports, for example `loading`, `running` or `stopped`. Informational only: decide what you can do from `state`. An `active` instance is ready when this is `running`. |
| `instance.public_ip` | string or null | yes | Public address of the machine. Null until the instance has been placed. |
| `instance.ssh_host` | string or null | yes | Relay host name that reaches the instance over SSH together with `ssh_port`. Null until the instance has been placed. |
| `instance.ssh_port` | integer or null | yes | Port of the SSH relay on `ssh_host`. |
| `instance.jupyter_url` | string or null | yes | URL of the Jupyter interface, for templates that provide one; null otherwise. |
| `instance.ports` | object | yes | Port mappings of the instance. Keys look like `22/tcp`; each value is a list of `{"HostIp": "0.0.0.0", "HostPort": "40122"}` objects. For direct SSH connect to `public_ip` on the `HostPort` of `22/tcp`. Empty until the instance runs. |
| `instance.hourly_uusd` | integer | yes | Price per hour while the machine runs, in millionths of a US dollar. It includes the disk you ordered. |
| `instance.cycle` | string: `hourly`, `monthly`, `quarterly`, `semiannual`, `yearly`, `2y`, `3y` | yes | Billing cycle chosen at order time. |
| `instance.charged_cents` | integer | yes | Total charged to your wallet for this instance so far, in US cents, including renewals and restarts. |
| `instance.paid_until` | integer or null | yes | End of the prepaid billing cycle. Null for hourly instances and until the first start (Unix time, seconds, UTC) |
| `instance.geolocation` | string or null | yes | Where the machine is located, for example `Texas, US`. |
| `instance.cuda_max` | number or null | yes | Highest CUDA version the machine's driver supports. |
| `instance.reliability` | number or null | yes | Reliability score of the machine between 0 and 1. |
| `instance.error_msg` | string or null | yes | Last problem message, for example why an order failed or why a start was refused. Null when there is none. |
| `instance.created_at` | integer | yes | Time the order was placed (Unix time, seconds, UTC) |
| `instance.updated_at` | integer | yes | Time the instance last changed (Unix time, seconds, UTC) |
| `instance.billed_until` | integer or null | yes | End of the period that is currently paid. For hourly instances this is the end of the paid hour. Null before the first start (Unix time, seconds, UTC) |
| `instance.storage_hourly_uusd` | integer | yes | Disk price per hour while the instance is stopped, in millionths of a US dollar. |
| `instance.cycle_cents` | integer | yes | Price of one billing cycle in US cents. 0 for hourly instances. |
| `instance.intent` | string or null: `start`, `stop`, `reboot`, `recycle`, `destroy`, `suspend` | yes | Command being carried out right now, or null when the instance is idle. `suspend` is a stop started by the platform because the wallet could not pay. |
| `instance.refunded_cents` | integer | yes | Total refunded to your wallet for this instance so far, in US cents. |

Example:

```json
{
  "instance": {
    "billed_until": 1792414110,
    "charged_cents": 120,
    "cpu": 16,
    "created_at": 1792400000,
    "cuda_max": 12.8,
    "cycle": "hourly",
    "cycle_cents": 0,
    "disk_gb": 100,
    "display_name": "train-01",
    "error_msg": null,
    "geolocation": "Texas, US",
    "gpu_count": 1,
    "gpu_name": "RTX 4090",
    "hostname": "train-01",
    "hourly_uusd": 400000,
    "id": "gpu-3f6c1d0e8a524b57",
    "intent": null,
    "jupyter_url": null,
    "paid_until": null,
    "ports": {
      "22/tcp": [
        {
          "HostIp": "0.0.0.0",
          "HostPort": "40122"
        }
      ]
    },
    "public_ip": "203.0.113.45",
    "ram_gb": 64,
    "refunded_cents": 0,
    "reliability": 0.9871,
    "runtime_status": "running",
    "runtype": "ssh",
    "ssh_host": "gw5.example.net",
    "ssh_port": 22846,
    "state": "active",
    "storage_hourly_uusd": 2400,
    "template_id": 3,
    "template_name": "Ubuntu 24.04 CUDA 12.9 Devel (Pure SSH)",
    "updated_at": 1792400310,
    "vram_gb": 24
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/gpu/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Delete the GPU instance (data is lost)

`DELETE /v1/gpu/{id}`

Deletes the instance for good: the machine is released and everything on its disk is lost. The call answers at once and the deletion continues in the background; `state` becomes `destroying` and then the instance disappears from the list (Get answers `404`). Billing stops once the machine is released.

Money back: an instance that never became active is refunded in full, a fixed-cycle instance gets the unused part of the paid cycle back pro rata, and an hourly instance is not refunded for the hour it already started.

An instance that is still being rented (`renting`), is already being deleted, or has another command running cannot be deleted yet.

**Required scope:** `gpu:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `gpu:destroy` | CLI: `gpu delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `pending` | boolean | yes | Always `true`: the command was accepted and is being carried out in the background. Follow `state` and `intent` on the instance. |

Example:

```json
{
  "ok": true,
  "pending": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `invalid_state` | The instance is `renting` or `destroying`, or another command is still running. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/gpu/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Start the GPU instance (can charge a new billing period)

`POST /v1/gpu/{id}/start`

Powers a `stopped` or `locked` instance back on. The call answers at once; follow `state` (`starting`, then `active`).

Starting can charge the wallet first. An hourly instance pays for up to one new hour of compute, unless you stopped it inside an hour that was already paid at the compute rate. A fixed-cycle instance pays the cycle price only if the paid cycle has ended. If the wallet cannot cover it the call fails with `402 insufficient_funds` and the instance stays as it was. If the machine cannot be started (for example it cannot supply the GPUs right now) the instance falls back to `stopped` after a while with an `error_msg`, and the start charge is refunded.

Each instance accepts at most 6 start and stop commands per hour; further ones answer `429 rate_limited`. Repeating `start` while a start is already running just answers the same acknowledgement.

**Required scope:** `gpu:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `gpu:write` | CLI: `gpu start` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `pending` | boolean | yes | Always `true`: the command was accepted and is being carried out in the background. Follow `state` and `intent` on the instance. |

Example:

```json
{
  "ok": true,
  "pending": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet cannot pay the restart charge. The error carries `need_cents` and `balance_cents`. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `invalid_state` | The instance is not `stopped` or `locked`, has never been started, or another command is still running. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/start" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Stop the GPU instance

`POST /v1/gpu/{id}/stop`

Powers an `active` instance off and keeps its disk. The call answers at once; `state` becomes `stopping` and then `stopped`. GPU charges stop. An hourly instance keeps paying the disk rate (`storage_hourly_uusd`) every hour, and a fixed-cycle instance keeps its prepaid cycle and renews it until you delete the instance. Use [Delete a GPU instance](#operation/gpu_delete) to stop all charges.

Each instance accepts at most 6 start and stop commands per hour; further ones answer `429 rate_limited`. Repeating `stop` while a stop is already running just answers the same acknowledgement.

**Required scope:** `gpu:write`.

Scope: `gpu:write` | CLI: `gpu stop`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `pending` | boolean | yes | Always `true`: the command was accepted and is being carried out in the background. Follow `state` and `intent` on the instance. |

Example:

```json
{
  "ok": true,
  "pending": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `invalid_state` | The instance is not `active`, or another command is still running. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/stop" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Reboot the GPU instance

`POST /v1/gpu/{id}/reboot`

Restarts an `active` instance without losing its disk. The call answers at once; `state` is `rebooting` until the instance is back, which normally takes a minute or two. There is no extra charge. Repeating `reboot` while a reboot is already running just answers the same acknowledgement.

**Required scope:** `gpu:write`.

Scope: `gpu:write` | CLI: `gpu reboot`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `pending` | boolean | yes | Always `true`: the command was accepted and is being carried out in the background. Follow `state` and `intent` on the instance. |

Example:

```json
{
  "ok": true,
  "pending": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `invalid_state` | The instance is not `active`, or another command is still running. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/reboot" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Recycle the GPU instance from its template (data is lost)

`POST /v1/gpu/{id}/recycle`

Rebuilds an `active` instance from its template in place: the container or virtual machine is recreated from the original image on the same host and everything on the disk is erased, including every file you added. The instance keeps its id and billing and there is no extra charge. Use it to get back to a clean system.

The call answers at once; `state` is `recycling` until the instance is back. Read `public_ip` and `ports` again when it is `active` again, because they can change. Because data is lost the call needs an `Idempotency-Key`. Repeating `recycle` while one is already running just answers the same acknowledgement.

**Required scope:** `gpu:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `gpu:destroy` | CLI: `gpu recycle` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true`. |
| `pending` | boolean | yes | Always `true`: the command was accepted and is being carried out in the background. Follow `state` and `intent` on the instance. |

Example:

```json
{
  "ok": true,
  "pending": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `invalid_state` | The instance is not `active`, or another command is still running. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/recycle" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Get a one-time SSH WebSocket ticket for the GPU instance

`POST /v1/gpu/{id}/ssh-token`

Issues a one-time ticket for the web SSH terminal of a running instance. Open a WebSocket to `websocket_url` with the ticket as the `token` query parameter (`<websocket_url>?token=<token>`) within `expires_in` seconds. The ticket opens one connection only; reconnecting needs a new ticket. Send JSON text frames such as `{"type":"input","data":"nvidia-smi\n"}` and `{"type":"resize","cols":120,"rows":30}`; output arrives as `{"type":"output","data":"..."}` frames. The terminal logs in as `root` automatically with a key managed by the platform, so it never asks for a password.

The instance must be `active`, report a running machine, have no command in progress and already have its public SSH address. Each account may request 10 tickets per minute. To use your own SSH client instead, connect to `public_ip` on the host port of `ports["22/tcp"]` with the key you chose when you ordered.

**Required scope:** `gpu:console`.

Scope: `gpu:console` | CLI: `gpu ssh-token`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `token` | string | yes | One-time ticket. A secret: it opens a terminal on the instance. |
| `expires_in` | integer | yes | Seconds the ticket stays valid (90). |
| `websocket_url` | string | yes | WebSocket address of the terminal gateway. |
| `default_username` | string | yes | Login name the terminal uses (`root`). |
| `port` | integer | yes | SSH port the terminal connects to on the instance's public address. |
| `ip_address` | string | yes | Public address the terminal connects to. |
| `has_credentials` | boolean | yes | Always `true`: the gateway logs in with a key, no password is asked. |

Example:

```json
{
  "default_username": "root",
  "expires_in": 90,
  "has_credentials": true,
  "ip_address": "203.0.113.45",
  "port": 40122,
  "token": "ofw_ssh_gpu_9f3c1b7a5d2e4f60718293a4b5c6d7e89f3c1b7a5d2e4f60",
  "websocket_url": "wss://cloud.example.com/ssh-ws"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `vm_not_running` | The instance is not `active` and running, or a command is in progress. |
| 409 | `vm_not_ready` | The instance has no public SSH address yet. Try again in a few seconds. |
| 502 | `terminal_unavailable` | The terminal key could not be installed on the instance. Try again shortly. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/ssh-token" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Metrics and events of the GPU instance

`GET /v1/gpu/{id}/diagnostics`

Returns the latest usage readings reported by the machine and the recent activity of the instance. `metrics` only contains the readings the machine reported, so it can be empty or partial for a while after a start; `metrics_at` says when they were taken. `events` lists up to 100 events, newest first: the commands you sent (`actor` is `customer`) and everything the platform did on its own or through support (`actor` is `support`).

It is available as soon as a machine has been assigned to the instance; before that it answers `409 not_deployed`.

**Required scope:** `gpu:read`.

Scope: `gpu:read` | CLI: `gpu diagnostics`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `metrics` | object | yes |  |
| `metrics.cpu_util` | number | no | CPU utilisation, in percent. |
| `metrics.gpu_util` | number | no | GPU utilisation, in percent. |
| `metrics.gpu_temp` | number | no | GPU temperature, in degrees Celsius. |
| `metrics.mem_usage` | number | no | System memory in use. |
| `metrics.mem_limit` | number | no | System memory limit. |
| `metrics.vmem_usage` | number | no | GPU memory in use. |
| `metrics.disk_usage` | number | no | Disk space in use, in GB. |
| `metrics.disk_space` | number | no | Disk size, in GB. |
| `metrics.disk_util` | number | no | Disk utilisation, in percent. |
| `metrics.gpu_totalram` | number | no | Total GPU memory. |
| `metrics.gpu_ram` | number | no | GPU memory per GPU. |
| `metrics.uptime_mins` | number | no | Minutes the machine has been up. |
| `metrics_at` | integer or null | yes | Time the readings were taken. Null while the machine has not reported any (Unix time, seconds, UTC) |
| `events` | array of GpuEvent | yes |  |
| `events[].at` | integer | yes | Time of the event (Unix time, seconds, UTC) |
| `events[].kind` | string | yes | Kind of event, for example `gpu.create`, `gpu.action` or `gpu.state`. |
| `events[].actor` | string: `customer`, `support` | yes | Who caused the event: `customer` for commands you sent, `support` for the platform and its staff. |
| `events[].message` | string | yes | What happened, for example `GPU order accepted`, `stop` or `provisioning -> active`. |
| `events[].key` | string or null | yes | Stable message code, for example `gpu.order_accepted`; `null` for older entries. |
| `events[].args` | object | yes | Raw values to fill into the message named by `key` (string values). An empty object when `key` is `null`. |

Example:

```json
{
  "events": [
    {
      "actor": "support",
      "args": {
        "from": "provisioning",
        "to": "active"
      },
      "at": 1792400310,
      "key": "gpu.state_changed",
      "kind": "gpu.state",
      "message": "provisioning → active"
    },
    {
      "actor": "customer",
      "args": {},
      "at": 1792400000,
      "key": "gpu.order_accepted",
      "kind": "gpu.create",
      "message": "GPU order accepted"
    }
  ],
  "metrics": {
    "cpu_util": 12.5,
    "disk_space": 100,
    "disk_usage": 21.4,
    "gpu_temp": 64,
    "gpu_util": 87,
    "uptime_mins": 95
  },
  "metrics_at": 1792405900
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_deployed` | No machine has been assigned to the instance yet (it is still `queued` or `renting`, or it failed before getting one). |

**Example request**

```bash
curl "https://api.onie.net/v1/gpu/<id>/diagnostics" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Read the requested startup log

`GET /v1/gpu/{id}/logs`

Reads the start-up log you asked for with [Request GPU instance logs](#operation/gpu_logs_request). Nothing is fetched until you ask: without a request in the last 5 minutes the answer is `requested: false` with empty `logs`. While the machine is still preparing the log, `pending` is true, so call again after a few seconds. When it is ready, `logs` holds the last 500 lines up to 1 MiB with secrets masked, and `truncated` is true if it had to be cut.

**Required scope:** `gpu:read`.

Scope: `gpu:read` | CLI: `gpu logs get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `pending` | boolean | yes | True while the machine is still preparing the log you requested. Call [Read GPU instance logs](#operation/gpu_logs_get) again in a few seconds. |
| `requested` | boolean | yes | Whether a log was requested in the last 5 minutes. |
| `logs` | string | yes | The log text, empty until it is ready. Secrets such as tokens and passwords are masked. |
| `truncated` | boolean | no | Present once the log is ready: true when the log was longer than 1 MiB and was cut. |

Example:

```json
{
  "logs": "Starting container...\nsshd: listening on 0.0.0.0 port 22\nReady.\n",
  "pending": false,
  "requested": true,
  "truncated": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_deployed` | No machine has been assigned to the instance yet. |
| 502 | `logs_unavailable` | The log could not be read from the machine. Try again shortly. |

**Example request**

```bash
curl "https://api.onie.net/v1/gpu/<id>/logs" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Request a fresh startup log

`POST /v1/gpu/{id}/logs`

Asks the machine to publish the last 500 lines of its start-up log. The answer has the same shape as [Read GPU instance logs](#operation/gpu_logs_get) and is usually `pending: true` at first; poll that call every few seconds until `pending` is false. The log stays readable for 5 minutes after the request. Use it to find out why an instance is slow to start or does not accept SSH connections.

Each account may request logs 6 times per minute.

**Required scope:** `gpu:write`.

Scope: `gpu:write` | CLI: `gpu logs request`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | GPU instance identifier as returned by List GPU instances (for example `gpu-3f6c1d0e8a524b57`). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `pending` | boolean | yes | True while the machine is still preparing the log you requested. Call [Read GPU instance logs](#operation/gpu_logs_get) again in a few seconds. |
| `requested` | boolean | yes | Whether a log was requested in the last 5 minutes. |
| `logs` | string | yes | The log text, empty until it is ready. Secrets such as tokens and passwords are masked. |
| `truncated` | boolean | no | Present once the log is ready: true when the log was longer than 1 MiB and was cut. |

Example:

```json
{
  "logs": "",
  "pending": true,
  "requested": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_deployed` | No machine has been assigned to the instance yet. |
| 502 | `logs_unavailable` | The machine could not be asked for its log. Try again shortly. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/gpu/<id>/logs" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Support Tickets

Open and follow support tickets of your account. A ticket is a conversation between you and the support team: you create it with a subject and a first message, either side can reply, and you can close it when it is solved. Opening a ticket is limited to 5 per hour per account. On sites operated by a reseller the ticket goes to that reseller's support queue, and it is not available when the reseller has turned tickets off.

#### List support tickets (filter, paged)

`GET /v1/portal/tickets`

Returns the tickets of your account, newest activity first by default. Filter by `status` or search the subject with `q`. Only your own tickets are ever listed.

**Required scope:** `ticket:read`.

Scope: `ticket:read` | CLI: `ticket list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `q` | string | no | Case-insensitive text to look for in the subject. Only the first 120 characters are used. |
| `status` | string: `open`, `answered`, `closed` | no | Return only tickets in this status. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `last_msg_at`, `created_at`, `updated_at`, `status`, `subject`, `id` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Ticket | yes |  |
| `items[].id` | integer | yes | Ticket number. |
| `items[].subject` | string | yes | Subject line, 1 to 120 characters. |
| `items[].status` | string: `open`, `answered`, `closed` | yes | `open` while the support team has not answered the latest message, `answered` once they have, `closed` when the ticket is finished. Replying to an answered ticket makes it `open` again. |
| `items[].created_at` | integer | yes | When the ticket was opened. (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | When the status last changed. (Unix time, seconds, UTC) |
| `items[].last_msg_at` | integer | yes | When the latest message was posted. (Unix time, seconds, UTC) |
| `items[].last_author` | string | yes | Who wrote the latest message: `customer` or `admin` (the support team). |
| `items[].messages` | integer | yes | Number of messages in the ticket. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field actually applied. |
| `dir` | string: `asc`, `desc` | yes | Sort direction actually applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "created_at": 1760860800,
      "id": 1042,
      "last_author": "customer",
      "last_msg_at": 1760860800,
      "messages": 1,
      "status": "open",
      "subject": "Cannot reach my server on port 443",
      "updated_at": 1760860800
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "last_msg_at",
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/portal/tickets" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one ticket with its messages

`GET /v1/portal/tickets/{id}`

Returns one ticket with all of its messages in chronological order. Internal notes written by the support team are never included.

**Required scope:** `ticket:read`.

Scope: `ticket:read` | CLI: `ticket get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Ticket number as returned by List support tickets. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ticket` | Ticket | yes |  |
| `ticket.id` | integer | yes | Ticket number. |
| `ticket.subject` | string | yes | Subject line, 1 to 120 characters. |
| `ticket.status` | string: `open`, `answered`, `closed` | yes | `open` while the support team has not answered the latest message, `answered` once they have, `closed` when the ticket is finished. Replying to an answered ticket makes it `open` again. |
| `ticket.created_at` | integer | yes | When the ticket was opened. (Unix time, seconds, UTC) |
| `ticket.updated_at` | integer | yes | When the status last changed. (Unix time, seconds, UTC) |
| `ticket.last_msg_at` | integer | yes | When the latest message was posted. (Unix time, seconds, UTC) |
| `ticket.last_author` | string | yes | Who wrote the latest message: `customer` or `admin` (the support team). |
| `ticket.messages` | integer | yes | Number of messages in the ticket. |
| `messages` | array of TicketMessage | yes |  |
| `messages[].id` | integer | yes | Message number. |
| `messages[].author` | string: `customer`, `admin` | yes | `customer` for your own messages, `admin` for the support team. |
| `messages[].author_name` | string | yes | Display name of the author. Messages from the support team always show `Support`. |
| `messages[].body` | string | yes | Message text, plain text, up to 4000 characters. |
| `messages[].created_at` | integer | yes | When the message was posted. (Unix time, seconds, UTC) |
| `messages[].attachments` | array of object | yes |  |
| `messages[].attachments[].id` | integer | yes | Attachment number. |
| `messages[].attachments[].name` | string | yes | Sanitised file name. |
| `messages[].attachments[].mime` | string | yes | `image/png` or `image/jpeg` (images are re-encoded when uploaded). |
| `messages[].attachments[].bytes` | integer | yes | Size in bytes. |
| `messages[].attachments[].width` | integer | yes | Width in pixels. |
| `messages[].attachments[].height` | integer | yes | Height in pixels. |

Example:

```json
{
  "messages": [
    {
      "attachments": [],
      "author": "customer",
      "author_name": "Alex Nguyen",
      "body": "Port 443 times out since this morning. The server itself is running.",
      "created_at": 1760860800,
      "id": 5310
    },
    {
      "attachments": [],
      "author": "admin",
      "author_name": "Support",
      "body": "A firewall rule was blocking the port. It is fixed now, please try again.",
      "created_at": 1760864400,
      "id": 5311
    }
  ],
  "ticket": {
    "created_at": 1760860800,
    "id": 1042,
    "last_author": "admin",
    "last_msg_at": 1760864400,
    "messages": 2,
    "status": "answered",
    "subject": "Cannot reach my server on port 443",
    "updated_at": 1760864400
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/portal/tickets/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Open a support ticket

`POST /v1/portal/tickets`

Opens a ticket with its first message and returns both. The support team is notified. At most 5 tickets can be opened per hour per account; the sixth is rejected with `rate_limited`. Send the same `Idempotency-Key` again to receive the original ticket instead of opening a duplicate.

**Required scope:** `ticket:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `ticket:write` | CLI: `ticket create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `subject` | string | yes | Subject line, 1 to 120 characters, no control characters. |
| `body` | string | yes | First message, 1 to 4000 characters. |

Example:

```json
{
  "body": "Port 443 times out since this morning. The server itself is running.",
  "subject": "Cannot reach my server on port 443"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ticket` | Ticket | yes |  |
| `ticket.id` | integer | yes | Ticket number. |
| `ticket.subject` | string | yes | Subject line, 1 to 120 characters. |
| `ticket.status` | string: `open`, `answered`, `closed` | yes | `open` while the support team has not answered the latest message, `answered` once they have, `closed` when the ticket is finished. Replying to an answered ticket makes it `open` again. |
| `ticket.created_at` | integer | yes | When the ticket was opened. (Unix time, seconds, UTC) |
| `ticket.updated_at` | integer | yes | When the status last changed. (Unix time, seconds, UTC) |
| `ticket.last_msg_at` | integer | yes | When the latest message was posted. (Unix time, seconds, UTC) |
| `ticket.last_author` | string | yes | Who wrote the latest message: `customer` or `admin` (the support team). |
| `ticket.messages` | integer | yes | Number of messages in the ticket. |
| `message` | TicketMessage | yes |  |
| `message.id` | integer | yes | Message number. |
| `message.author` | string: `customer`, `admin` | yes | `customer` for your own messages, `admin` for the support team. |
| `message.author_name` | string | yes | Display name of the author. Messages from the support team always show `Support`. |
| `message.body` | string | yes | Message text, plain text, up to 4000 characters. |
| `message.created_at` | integer | yes | When the message was posted. (Unix time, seconds, UTC) |
| `message.attachments` | array of object | yes |  |
| `message.attachments[].id` | integer | yes | Attachment number. |
| `message.attachments[].name` | string | yes | Sanitised file name. |
| `message.attachments[].mime` | string | yes | `image/png` or `image/jpeg` (images are re-encoded when uploaded). |
| `message.attachments[].bytes` | integer | yes | Size in bytes. |
| `message.attachments[].width` | integer | yes | Width in pixels. |
| `message.attachments[].height` | integer | yes | Height in pixels. |

Example:

```json
{
  "message": {
    "attachments": [],
    "author": "customer",
    "author_name": "Alex Nguyen",
    "body": "Port 443 times out since this morning. The server itself is running.",
    "created_at": 1760860800,
    "id": 5310
  },
  "ticket": {
    "created_at": 1760860800,
    "id": 1042,
    "last_author": "customer",
    "last_msg_at": 1760860800,
    "messages": 1,
    "status": "open",
    "subject": "Cannot reach my server on port 443",
    "updated_at": 1760860800
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `feature_disabled` | The site operator has turned support tickets off. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | `subject` or `body` is empty or too long. The error carries `field` (`subject` or `body`) and `max`. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 429 | `rate_limited` | More than 5 tickets were opened in the last hour. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/portal/tickets" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"body":"Port 443 times out since this morning. The server itself is running.","subject":"Cannot reach my server on port 443"}'
```

---

#### Reply to a ticket

`POST /v1/portal/tickets/{id}/messages`

Adds a message to one of your tickets and sets its status back to `open`. A closed ticket cannot be replied to: open a new ticket instead. Replies sent with an API key are limited to 30 per hour per account.

**Required scope:** `ticket:write`.

Scope: `ticket:write` | CLI: `ticket reply`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Ticket number as returned by List support tickets. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `body` | string | yes | Message text, 1 to 4000 characters. |

Example:

```json
{
  "body": "Still failing after the change, here is the traceroute output."
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `message` | TicketMessage | yes |  |
| `message.id` | integer | yes | Message number. |
| `message.author` | string: `customer`, `admin` | yes | `customer` for your own messages, `admin` for the support team. |
| `message.author_name` | string | yes | Display name of the author. Messages from the support team always show `Support`. |
| `message.body` | string | yes | Message text, plain text, up to 4000 characters. |
| `message.created_at` | integer | yes | When the message was posted. (Unix time, seconds, UTC) |
| `message.attachments` | array of object | yes |  |
| `message.attachments[].id` | integer | yes | Attachment number. |
| `message.attachments[].name` | string | yes | Sanitised file name. |
| `message.attachments[].mime` | string | yes | `image/png` or `image/jpeg` (images are re-encoded when uploaded). |
| `message.attachments[].bytes` | integer | yes | Size in bytes. |
| `message.attachments[].width` | integer | yes | Width in pixels. |
| `message.attachments[].height` | integer | yes | Height in pixels. |

Example:

```json
{
  "message": {
    "attachments": [],
    "author": "customer",
    "author_name": "Alex Nguyen",
    "body": "Port 443 times out since this morning. The server itself is running.",
    "created_at": 1760860800,
    "id": 5310
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `ticket_closed` | The ticket is closed. |
| 422 | `invalid_argument` | `body` is empty or longer than 4000 characters. The error carries `field` and `max`. |
| 429 | `rate_limited` | More than 30 replies were sent in the last hour. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/portal/tickets/<id>/messages" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"body":"Still failing after the change, here is the traceroute output."}'
```

---

#### Close a ticket

`POST /v1/portal/tickets/{id}/close`

Closes one of your tickets. Closing a ticket that is already closed succeeds and changes nothing. Closed tickets stay readable.

**Required scope:** `ticket:write`.

Scope: `ticket:write` | CLI: `ticket close`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Ticket number as returned by List support tickets. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ticket` | Ticket | yes |  |
| `ticket.id` | integer | yes | Ticket number. |
| `ticket.subject` | string | yes | Subject line, 1 to 120 characters. |
| `ticket.status` | string: `open`, `answered`, `closed` | yes | `open` while the support team has not answered the latest message, `answered` once they have, `closed` when the ticket is finished. Replying to an answered ticket makes it `open` again. |
| `ticket.created_at` | integer | yes | When the ticket was opened. (Unix time, seconds, UTC) |
| `ticket.updated_at` | integer | yes | When the status last changed. (Unix time, seconds, UTC) |
| `ticket.last_msg_at` | integer | yes | When the latest message was posted. (Unix time, seconds, UTC) |
| `ticket.last_author` | string | yes | Who wrote the latest message: `customer` or `admin` (the support team). |
| `ticket.messages` | integer | yes | Number of messages in the ticket. |

Example:

```json
{
  "ticket": {
    "created_at": 1760860800,
    "id": 1042,
    "last_author": "admin",
    "last_msg_at": 1760864400,
    "messages": 2,
    "status": "closed",
    "subject": "Cannot reach my server on port 443",
    "updated_at": 1760868000
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/portal/tickets/<id>/close" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Affiliate

Read-only view of your affiliate programme: your referral code and link, the customers you referred, the commissions they generated and your payout history. Joining the programme, converting commission into wallet credit and withdrawing cash are only available in the web console. The programme is only offered on the main site; on reseller sites these calls return `feature_disabled`.

#### Affiliate status, referral code and stats

`GET /v1/aff`

Returns the programme rules, whether you have joined, and (once you have) your referral `code`, `link`, status, balances and a 30-day activity series. Use it to check eligibility before sending customers to your link. Cash payout details and verification status are not included; they are shown in the web console only.

**Required scope:** `aff:read`.

Scope: `aff:read` | CLI: `aff status`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the programme is currently open. |
| `joined` | boolean | yes | Whether your account has joined the programme. |
| `eligible` | object | yes |  |
| `eligible.email_verified` | boolean | yes | Your e-mail address is verified. |
| `eligible.age_ok` | boolean | yes | Your account is old enough to join. |
| `eligible.topup_ok` | boolean | yes | You topped up enough to join. |
| `eligible.missing` | array of string | yes |  |
| `eligible.min_account_age_days` | integer | yes | Minimum account age in days. |
| `eligible.min_topup_cents` | integer | yes | Minimum total top-up in US cents. |
| `pct` | number | yes | Your commission rate in percent. |
| `hold_days` | integer | yes | Days a commission is held before it can mature. |
| `min_spend_pct` | integer | yes | Share of the referred customer's top-up that must be spent before the commission matures, in percent. |
| `credit_after_days` | integer | yes | Days a matured commission must wait before it can be converted to wallet credit. |
| `window_months` | integer | yes | How many months after signup a referred customer keeps earning you commission (0 = unlimited). |
| `cookie_days` | integer | yes | Days the referral link is remembered in the visitor's browser. |
| `tos_version` | integer | yes | Current version of the programme terms. |
| `tos_accepted` | boolean | yes | Whether you accepted the current terms. |
| `tos_accepted_at` | integer or null | yes | When you accepted the terms, or null if you have not joined. (Unix time, seconds, UTC) |
| `min_credit_cents` | integer | yes | Smallest amount that can be converted to wallet credit, in US cents. |
| `min_account_age_days` | integer | yes | Same as `eligible.min_account_age_days`. |
| `min_topup_cents` | integer | yes | Same as `eligible.min_topup_cents`. |
| `cash_season_days` | integer | yes | Days a commission must age before it counts for cash payouts. |
| `cash` | object | yes |  |
| `cash.enabled` | boolean | yes | Whether cash payouts are offered. |
| `cash.methods` | array of string | yes |  |
| `cash.min_cents` | integer | yes | Smallest cash payout in US cents. |
| `cash.season_days` | integer | yes | Days a commission must age before it counts for cash payouts. |
| `cash.max_per_month_cents` | integer | yes | Largest total cash payout per month in US cents. |
| `cash.method` | string or null | no | Payout method you chose in the web console, once joined. |
| `cash.method_locked_until` | integer or null | no | Until when the method cannot be changed. (Unix time, seconds, UTC) |
| `cash.next_allowed_at` | integer or null | no | When you may request the next cash payout. (Unix time, seconds, UTC) |
| `cash.seasoned_cents` | integer | no | Commission that is old enough for a cash payout, in US cents. |
| `code` | string | no | Your referral code. Present once you have joined. |
| `link` | string | no | Your referral link. Present once you have joined. |
| `status` | string: `active`, `auto_review`, `suspended`, `disabled` | no | State of your participation. Present once you have joined. |
| `status_reason` | string or null | no | Why the status is not `active`, when it is not. |
| `stats` | object | no |  |
| `stats.clicks_30d` | integer | yes | Visits on your link in the last 30 days. |
| `stats.signups` | integer | yes | Customers who registered through your link. |
| `stats.active_referrals` | integer | yes | Referred customers still counting. |
| `stats.paying_referred` | integer | yes | Referred customers who topped up. |
| `stats.deposits_cents` | integer | yes | Total top-ups of referred customers, in US cents. |
| `stats.earned_30d_cents` | integer | yes | Commission recorded in the last 30 days, in US cents. |
| `stats.pending_cents` | integer | yes | Commission still being held. |
| `stats.review_cents` | integer | yes | Commission under manual review. |
| `stats.matured_cents` | integer | yes | Commission that has matured. |
| `stats.locked_cents` | integer | yes | Matured commission that is not yet available. |
| `stats.available_cents` | integer | yes | Commission you can take now. |
| `stats.reserved_cents` | integer | yes | Commission reserved by an open payout. |
| `stats.paid_cents` | integer | yes | Commission already paid out. |
| `stats.reversed_cents` | integer | yes | Commission cancelled because a top-up was refunded or disputed. |
| `stats.clawed_cents` | integer | yes | Commission taken back after it was paid. |
| `stats.balance_cents` | integer | yes | Net commission balance. |
| `stats.negative` | boolean | yes | True when clawbacks exceed your balance. |
| `stats.series_30d` | array of object | yes |  |
| `stats.series_30d[].day` | string | yes | Day in `YYYY-MM-DD` (UTC). |
| `stats.series_30d[].clicks` | integer | yes | Visits that day. |
| `stats.series_30d[].signups` | integer | yes | Registrations that day. |
| `stats.series_30d[].commission_cents` | integer | yes | Commission recorded that day, in US cents. |
| `open_payout` | object or null | no |  |
| `open_payout.id` | integer | yes | Payout number. |
| `open_payout.amount_cents` | integer | yes | Amount in US cents. |
| `open_payout.method` | string | yes | Payout method. |
| `open_payout.status` | string | yes | `requested` or `approved`. |
| `open_payout.created_at` | integer | yes | When it was requested. (Unix time, seconds, UTC) |
| `last_payout_at` | integer or null | no | When you were last paid, or null. (Unix time, seconds, UTC) |

Example:

```json
{
  "cash": {
    "enabled": false,
    "max_per_month_cents": 100000,
    "method": null,
    "method_locked_until": null,
    "methods": [],
    "min_cents": 5000,
    "next_allowed_at": null,
    "season_days": 120,
    "seasoned_cents": 0
  },
  "cash_season_days": 120,
  "code": "K7M2QX9P",
  "cookie_days": 30,
  "credit_after_days": 30,
  "eligible": {
    "age_ok": true,
    "email_verified": true,
    "min_account_age_days": 7,
    "min_topup_cents": 1000,
    "missing": [],
    "topup_ok": true
  },
  "enabled": true,
  "hold_days": 60,
  "joined": true,
  "last_payout_at": null,
  "link": "https://cloud.example.com/?ref=K7M2QX9P",
  "min_account_age_days": 7,
  "min_credit_cents": 500,
  "min_spend_pct": 50,
  "min_topup_cents": 1000,
  "open_payout": null,
  "pct": 10.0,
  "stats": {
    "active_referrals": 5,
    "available_cents": 500,
    "balance_cents": 1500,
    "clawed_cents": 0,
    "clicks_30d": 42,
    "deposits_cents": 15000,
    "earned_30d_cents": 1500,
    "locked_cents": 0,
    "matured_cents": 500,
    "negative": false,
    "paid_cents": 0,
    "paying_referred": 2,
    "pending_cents": 1000,
    "reserved_cents": 0,
    "reversed_cents": 0,
    "review_cents": 0,
    "series_30d": [
      {
        "clicks": 3,
        "commission_cents": 500,
        "day": "2026-10-19",
        "signups": 1
      }
    ],
    "signups": 5
  },
  "status": "active",
  "status_reason": null,
  "tos_accepted": true,
  "tos_accepted_at": 1758240000,
  "tos_version": 1,
  "window_months": 12
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | Affiliate is not offered on this site (reseller sites). |

**Example request**

```bash
curl "https://api.onie.net/v1/aff" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Referred users (anonymised, paged)

`GET /v1/aff/referrals`

Lists the customers who registered through your link. Customers are anonymous: you only see a stable label such as `#a3f1`, never a name or e-mail address. Requires that you joined the programme.

**Required scope:** `aff:read`.

Scope: `aff:read` | CLI: `aff referral list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `status` | string: `active`, `void` | no | Return only referrals in this state. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `at`, `deposits`, `commission` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].ref_label` | string | yes | Anonymous label of the referred customer. |
| `items[].at` | integer | yes | When the customer registered. (Unix time, seconds, UTC) |
| `items[].status` | string: `active`, `void` | yes | `void` when the referral was cancelled. |
| `items[].first_topup_at` | integer or null | yes | When the customer first topped up, or null. (Unix time, seconds, UTC) |
| `items[].deposits_cents` | integer | yes | Total top-ups of this customer that earn commission, in US cents. |
| `items[].commission_cents` | integer | yes | Commission earned from this customer, in US cents. |
| `items[].last_state` | string or null | yes | Status of the latest commission from this customer. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field as requested (the default when omitted). |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "at": 1759000000,
      "commission_cents": 500,
      "deposits_cents": 5000,
      "first_topup_at": 1759100000,
      "last_state": "pending",
      "ref_label": "#a3f1",
      "status": "active"
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | Affiliate is not offered on this site (reseller sites). |
| 404 | `aff_not_joined` | You have not joined the programme yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/aff/referrals" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Commissions (paged)

`GET /v1/aff/commissions`

Lists the commissions generated by your referrals, with the progress each one has made towards maturing. Reversed zero-amount records are not listed.

**Required scope:** `aff:read`.

Scope: `aff:read` | CLI: `aff commission list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `status` | string: `pending`, `review`, `matured`, `reserved`, `paid`, `reversed`, `clawed` | no | Return only commissions in this status. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `amount`, `mature_at` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AffCommission | yes |  |
| `items[].id` | integer | yes | Commission number. |
| `items[].created_at` | integer | yes | When the commission was recorded. (Unix time, seconds, UTC) |
| `items[].ref_label` | string | yes | Anonymous label of the referred customer, e.g. `#a3f1`. It is stable for one customer and reveals nothing else about them. |
| `items[].base_cents` | integer | yes | Top-up amount the commission is calculated on, in US cents. |
| `items[].pct_bp` | integer | yes | Commission rate in basis points (1000 = 10%). |
| `items[].amount_cents` | integer | yes | Commission amount in US cents. |
| `items[].status` | string: `pending`, `review`, `matured`, `reserved`, `paid`, `reversed`, `clawed` | yes | `pending` while held, `review` while under manual review, `matured` when it can be taken, `reserved` when part of an open payout, `paid` once paid out, `reversed` or `clawed` when the underlying top-up was refunded or disputed. |
| `items[].mature_at` | integer | yes | When the holding period ends. (Unix time, seconds, UTC) |
| `items[].matured_at` | integer or null | yes | When the commission matured, or null while it has not. (Unix time, seconds, UTC) |
| `items[].spend_progress_pct` | integer | yes | Progress (0 to 100) of the referred customer's spending towards the amount required before the commission matures. |
| `items[].reason_code` | string or null | yes | Machine-readable reason for the latest status change, when there is one. |
| `items[].paid_via` | string or null: `wallet`, `cash` | yes | How the commission was paid out, once it is paid. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Sort field as requested (the default when omitted). |
| `dir` | string: `asc`, `desc` | yes | Sort direction applied. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "amount_cents": 500,
      "base_cents": 5000,
      "created_at": 1760860800,
      "id": 311,
      "mature_at": 1766044800,
      "matured_at": null,
      "paid_via": null,
      "pct_bp": 1000,
      "reason_code": null,
      "ref_label": "#a3f1",
      "spend_progress_pct": 40,
      "status": "pending"
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "created_at",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | Affiliate is not offered on this site (reseller sites). |
| 404 | `aff_not_joined` | You have not joined the programme yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/aff/commissions" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Affiliate ledger events (paged)

`GET /v1/aff/events`

Lists the ledger of your affiliate account, newest first: every maturing, payment, clawback, expiry or manual adjustment of a commission. The ledger is append-only.

**Required scope:** `aff:read`.

Scope: `aff:read` | CLI: `aff event list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Event number. |
| `items[].kind` | string: `mature`, `claw`, `pay`, `expire`, `adjust`, `reverse`, `status` | yes | What happened. |
| `items[].amount_cents` | integer | yes | Signed change of your balance in US cents (0 for status changes). |
| `items[].reason_code` | string or null | yes | Machine-readable reason, when there is one. |
| `items[].commission_id` | integer or null | yes | Commission the event relates to. |
| `items[].payout_id` | integer or null | yes | Payout the event relates to. |
| `items[].at` | integer | yes | When it happened. (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Echo of the `sort` query parameter (`id` when omitted). This list is always ordered newest first. |
| `dir` | string: `asc`, `desc` | yes | Echo of the `dir` query parameter (`desc` when omitted). This list is always ordered newest first. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "amount_cents": 500,
      "at": 1766044800,
      "commission_id": 311,
      "id": 90,
      "kind": "mature",
      "payout_id": null,
      "reason_code": null
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "id",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | Affiliate is not offered on this site (reseller sites). |
| 404 | `aff_not_joined` | You have not joined the programme yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/aff/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Payout history (paged)

`GET /v1/aff/payouts`

Lists your payout history: conversions of commission into wallet credit and cash payout requests, newest first. Creating or cancelling a payout is only possible in the web console.

**Required scope:** `aff:read`.

Scope: `aff:read` | CLI: `aff payout list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of AffPayout | yes |  |
| `items[].id` | integer | yes | Payout number. |
| `items[].amount_cents` | integer | yes | Amount in US cents. |
| `items[].method` | string: `wallet`, `usdt_trc20`, `paypal`, `bank_vn` | yes | Where the money went: `wallet` for credit on your service wallet, otherwise a cash payout method. |
| `items[].status` | string: `requested`, `approved`, `paid`, `rejected`, `cancelled` | yes | Payout state. |
| `items[].paid_ref` | string or null | yes | Payment reference once paid out. |
| `items[].created_at` | integer | yes | When the payout was requested. (Unix time, seconds, UTC) |
| `items[].paid_at` | integer or null | yes | When it was paid, or null. (Unix time, seconds, UTC) |
| `items[].admin_note` | string or null | yes | Note from the support team, when there is one. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `sort` | string | yes | Echo of the `sort` query parameter (`id` when omitted). This list is always ordered newest first. |
| `dir` | string: `asc`, `desc` | yes | Echo of the `dir` query parameter (`desc` when omitted). This list is always ordered newest first. |

Example:

```json
{
  "dir": "desc",
  "items": [
    {
      "admin_note": null,
      "amount_cents": 500,
      "created_at": 1766130000,
      "id": 12,
      "method": "wallet",
      "paid_at": 1766130000,
      "paid_ref": null,
      "status": "paid"
    }
  ],
  "page": 1,
  "per_page": 20,
  "sort": "id",
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `feature_disabled` | Affiliate is not offered on this site (reseller sites). |
| 404 | `aff_not_joined` | You have not joined the programme yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/aff/payouts" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Service Transfers

Read-only view of requests to move a server or a VPN plan to another account. A transfer needs the owner to confirm by e-mail and the recipient to accept, so creating, accepting, declining or cancelling one is only possible in the web console by a signed-in person. These calls let you follow the progress of the requests you sent and the ones addressed to you, and check in advance whether a service can be transferred.

#### List service transfer requests (outgoing or incoming)

`GET /v1/transfers`

Lists transfer requests. By default it returns the requests you sent (`dir=out`); with `dir=in` it returns the requests addressed to your account, which only appear once the sender confirmed them and show fewer fields.

**Required scope:** `transfer:read`.

Scope: `transfer:read` | CLI: `transfer list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `dir` | string: `out`, `in` | no | `out` for requests you sent, `in` for requests addressed to you. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `id`, `status`, `resource_kind`, `created_at` | no | Field to sort by. |
| `order` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Transfer | yes |  |
| `items[].id` | integer | yes | Transfer request number. |
| `items[].resource_kind` | string: `vm`, `vpn` | yes | Kind of service being transferred. |
| `items[].resource_id` | string | yes | Identifier of the service: a server UUID for `vm`, the plan number for `vpn`. |
| `items[].status` | string: `pending_owner`, `pending_recipient`, `executing`, `done`, `cancelled`, `declined`, `expired`, `failed` | yes | `pending_owner` waits for the owner's e-mail confirmation, `pending_recipient` waits for the recipient to accept, `executing` is the move itself, `done` is final success; `cancelled`, `declined`, `expired` and `failed` are final without a move. |
| `items[].owner_confirmed_at` | integer or null | yes | When the owner confirmed by e-mail. (Unix time, seconds, UTC) |
| `items[].recipient_decided_at` | integer or null | yes | When the recipient accepted or declined. (Unix time, seconds, UTC) |
| `items[].executed_at` | integer or null | yes | When the service was moved. (Unix time, seconds, UTC) |
| `items[].fail_reason` | string or null | yes | Why the transfer failed, when it did. |
| `items[].created_at` | integer | yes | When the request was created. (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | When the request last changed. (Unix time, seconds, UTC) |
| `items[].to_email` | string | no | E-mail address of the recipient. Present on requests you sent, absent on requests addressed to you. |
| `items[].owner_token_expires_at` | integer or null | no | Deadline of the owner's e-mail confirmation. Present on requests you sent. (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "created_at": 1760860800,
      "executed_at": null,
      "fail_reason": null,
      "id": 7001,
      "owner_confirmed_at": null,
      "owner_token_expires_at": 1760947200,
      "recipient_decided_at": null,
      "resource_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
      "resource_kind": "vm",
      "status": "pending_owner",
      "to_email": "colleague@example.com",
      "updated_at": 1760860800
    }
  ],
  "page": 1,
  "per_page": 20,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/transfers" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Check whether a service can be transferred

`GET /v1/transfers/precheck`

Checks whether one of your services can be transferred right now, without starting anything. `ok` is true when `reasons` is empty; otherwise each reason names a blocker, for example an unpaid invoice, a server that is not active or busy, outstanding storage charges, or a plan that is expired.

**Required scope:** `transfer:read`.

Scope: `transfer:read` | CLI: `transfer precheck`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `type` | string: `vm`, `vpn` | yes | Kind of service. |
| `id` | string | yes | Server UUID for `vm`, plan number for `vpn`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | True when the service can be transferred. |
| `reasons` | array of string | yes |  |

Example:

```json
{
  "ok": false,
  "reasons": [
    "invoice_unpaid"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `invalid_argument` | `type` is not `vm` or `vpn`, or `id` is missing. |
| 404 | `not_found` | The service does not exist or does not belong to your account. |

**Example request**

```bash
curl "https://api.onie.net/v1/transfers/precheck?type=<type>&id=<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one transfer request

`GET /v1/transfers/{id}`

Returns one transfer request you sent or that is addressed to you. A request addressed to you is only visible after the sender confirmed it.

**Required scope:** `transfer:read`.

Scope: `transfer:read` | CLI: `transfer get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Transfer request number as returned by List service transfers. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `id` | integer | yes | Transfer request number. |
| `resource_kind` | string: `vm`, `vpn` | yes | Kind of service being transferred. |
| `resource_id` | string | yes | Identifier of the service: a server UUID for `vm`, the plan number for `vpn`. |
| `status` | string: `pending_owner`, `pending_recipient`, `executing`, `done`, `cancelled`, `declined`, `expired`, `failed` | yes | `pending_owner` waits for the owner's e-mail confirmation, `pending_recipient` waits for the recipient to accept, `executing` is the move itself, `done` is final success; `cancelled`, `declined`, `expired` and `failed` are final without a move. |
| `owner_confirmed_at` | integer or null | yes | When the owner confirmed by e-mail. (Unix time, seconds, UTC) |
| `recipient_decided_at` | integer or null | yes | When the recipient accepted or declined. (Unix time, seconds, UTC) |
| `executed_at` | integer or null | yes | When the service was moved. (Unix time, seconds, UTC) |
| `fail_reason` | string or null | yes | Why the transfer failed, when it did. |
| `created_at` | integer | yes | When the request was created. (Unix time, seconds, UTC) |
| `updated_at` | integer | yes | When the request last changed. (Unix time, seconds, UTC) |
| `to_email` | string | no | E-mail address of the recipient. Present on requests you sent, absent on requests addressed to you. |
| `owner_token_expires_at` | integer or null | no | Deadline of the owner's e-mail confirmation. Present on requests you sent. (Unix time, seconds, UTC) |

Example:

```json
{
  "created_at": 1760860800,
  "executed_at": null,
  "fail_reason": null,
  "id": 7001,
  "owner_confirmed_at": null,
  "owner_token_expires_at": 1760947200,
  "recipient_decided_at": null,
  "resource_id": "3f6c1d0e-8a52-4b57-9a41-0c2f6e9d7b10",
  "resource_kind": "vm",
  "status": "pending_owner",
  "to_email": "colleague@example.com",
  "updated_at": 1760860800
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/transfers/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

### Dedicated Servers

Dedicated Servers are physical machines assigned to your account. You can read their hardware, network settings, health, sensors, hardware log and bandwidth, rename them, change their power state and open a remote console. You never see the management controller of a machine, only the machine.

The list calls only return servers assigned to you; any other identifier answers `404 not_found`. Changing power state and opening a console are asynchronous and protected by two switches: a system-wide switch (`dedicated_ops_disabled` while it is off) and a lock on each server (`dedicated_server_locked`). The `actions` object of [Get a Dedicated Server](#operation/dedicated_get) tells you which buttons are available and why not. Power commands answer `202` with an `op`; poll [Get an operation](#operation/dedicated_op). Only one operation runs at a time on a server (`409 dedicated_busy`). A suspended subscription is read-only (`423 dedicated_suspended`).

Timestamps are Unix seconds. Byte counters are bytes. Hardware log times are corrected for the controller's clock (`clock_adjusted`). Hidden on sites that do not sell Dedicated Servers.

#### List my Dedicated Servers

`GET /v1/dedicated`

Lists the Dedicated Servers assigned to your account. `enabled` tells whether Dedicated Servers are shown to you at all. Each item carries the last known power state and health; `stale` is true when that status may be outdated.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `name`, `created_at`, `power_state`, `public_ip`, `memory_gb` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `q` | string | no | Search in the name and the public IP address. |
| `power` | string: `on`, `off` | no | Only servers with this power state. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of DedicatedServerBrief | yes |  |
| `items[].id` | string | yes | Dedicated Server identifier (`ds_` followed by 16 hex characters). |
| `items[].name` | string | yes | Name of the server; you can change it. |
| `items[].model` | string or null | yes | Hardware model, e.g. `PowerEdge C6420`. |
| `items[].cpu` | object | yes |  |
| `items[].cpu.model` | string or null | yes | Processor model. |
| `items[].cpu.sockets` | integer or null | yes | Number of processors. |
| `items[].cpu.cores` | integer or null | yes | Total physical cores. |
| `items[].cpu.threads` | integer or null | yes | Total hardware threads. |
| `items[].memory_gb` | integer or null | yes | Installed memory in GiB. |
| `items[].storage_bytes` | integer or null | yes | Total capacity of the disks in bytes. |
| `items[].public_ip` | string or null | yes | Public IPv4 address of the server. |
| `items[].zone` | object or null | yes |  |
| `items[].zone.id` | integer | yes | Zone identifier. |
| `items[].zone.slug` | string | yes | Short zone name, e.g. `hcm`. |
| `items[].zone.name` | string | yes | Display name of the zone. |
| `items[].zone.country` | string | yes | Two-letter country code. |
| `items[].power_state` | string or null | yes | `On` or `Off` as last read from the machine; null before the first reading. |
| `items[].health` | string or null | yes | Overall hardware health: `OK`, `Warning` or `Critical`; null before the first reading. |
| `items[].status` | string: `active`, `suspended` | yes | State of your subscription. A `suspended` server is read-only. |
| `items[].locked` | boolean | yes | True when control actions (power, console) are locked for this server. |
| `items[].op` | DedicatedOpBrief or null | yes |  |
| `items[].polled_at` | integer or null | yes | When the status was last refreshed (Unix time, seconds, UTC) |
| `items[].stale` | boolean | yes | True when the status shown is older than expected or cannot be refreshed right now; treat `power_state` and sensors as possibly outdated. |
| `items[].assigned_at` | integer | yes | When the server was assigned to your account (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `enabled` | boolean | yes | Whether Dedicated Servers are enabled for your account. |

Example:

```json
{
  "enabled": true,
  "items": [
    {
      "assigned_at": 1792425000,
      "cpu": {
        "cores": 40,
        "model": "Intel Xeon Gold 6138",
        "sockets": 2,
        "threads": 80
      },
      "health": "OK",
      "id": "ds_3f9a1c2b7d4e5a60",
      "locked": true,
      "memory_gb": 64,
      "model": "PowerEdge C6420",
      "name": "dell-105",
      "op": null,
      "polled_at": 1792426591,
      "power_state": "On",
      "public_ip": "23.132.252.247",
      "stale": false,
      "status": "active",
      "storage_bytes": 1024209543168,
      "zone": {
        "country": "VN",
        "id": 1,
        "name": "Ho Chi Minh City",
        "slug": "hcm"
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Dedicated Server order catalog: locations, plans, cycles with VND prices, stock and auto-install operating systems

`GET /v1/dedicated/catalog`

Returns everything needed to order a Dedicated Server: locations, plans with their billing cycles (prices in VND, already discounted and rounded down to 1,000), how many servers are left per location, the operating systems that can be installed automatically and your wallet balance. While Dedicated Servers are not on sale the answer is `{"enabled": false, "plans": []}` without any price. At most 30 calls per minute per account.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | True when Dedicated Servers are on sale. When false and you are not in the beta list, `plans` is empty and no price is shown. |
| `beta` | boolean | yes | True when your account may see the catalog before the sale opens (orders are still refused). |
| `currency` | string | yes | Always `VND`: plans are priced in VND. |
| `zones` | array of object | yes |  |
| `zones[].id` | integer | yes | Zone identifier. |
| `zones[].slug` | string | yes | Short zone name. |
| `zones[].name` | string | yes | Display name. |
| `zones[].country` | string | yes | Two-letter country code. |
| `plans` | array of object | yes |  |
| `plans[].code` | string | yes | Plan code, e.g. `DS-6138-128`. |
| `plans[].name` | string | yes | Plan display name. |
| `plans[].spec` | object | yes | Configuration: `cpu`, `cores`, `threads`, `ram_gb`, `storage`, `ipv4`, `console`. |
| `plans[].monthly_vnd` | integer | yes | Monthly price in VND before cycle discounts. |
| `plans[].setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `plans[].cycles` | array of object | yes |  |
| `plans[].cycles[].cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `plans[].cycles[].months` | integer | yes | Months in one cycle. |
| `plans[].cycles[].discount_pct` | number | yes | Discount of this cycle in percent. |
| `plans[].cycles[].price_vnd` | integer | yes | Price of one cycle in VND, rounded down to 1,000. |
| `plans[].cycles[].monthly_equiv_vnd` | integer | yes | `price_vnd` divided by `months`. |
| `plans[].stock` | array of object | yes |  |
| `plans[].stock[].zone_id` | integer | yes | Zone identifier. |
| `plans[].stock[].count` | integer | yes | Servers available. |
| `plans[].stock[].count_os` | integer | yes | Servers on which the operating system can be installed automatically. |
| `plans[].stock[].backorder` | boolean | yes | True when no server is left: an order is accepted and waits for a server (`awaiting_stock`). |
| `plans[].on_sale` | boolean | yes | False while sales are closed or the plan is switched off (visible only to beta accounts). |
| `templates` | array of object | yes |  |
| `templates[].slug` | string | yes | Template identifier, e.g. `ubuntu-24.04`. |
| `templates[].name` | string | yes | Display name. |
| `templates[].family` | string: `ubuntu`, `debian`, `windows` | yes | Operating system family. |
| `templates[].version` | string | yes | Version. |
| `templates[].username` | string | yes | Administrator account created on the installed system. |
| `templates[].install_minutes` | integer | yes | Typical installation time in minutes (25 for Linux, 60 for Windows). |
| `templates[].min_ram_gb` | integer or null | yes | Minimum memory in GiB; null when not stated. |
| `templates[].min_disk_gb` | integer or null | yes | Minimum disk in GiB; null when not stated. |
| `auto_install` | boolean | yes | False when automatic installation is not available right now; then you can only install the system yourself through ISO/Console. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |
| `fx` | object | no | Exchange rate used to convert VND to US cents: `usd_vnd` and metadata. Absent when sales are closed. |

Example:

```json
{
  "auto_install": true,
  "balance_cents": 10000,
  "beta": false,
  "currency": "VND",
  "enabled": true,
  "fx": {
    "usd_vnd": 26000
  },
  "plans": [
    {
      "code": "DS-6138-128",
      "cycles": [
        {
          "cycle": "monthly",
          "discount_pct": 0,
          "monthly_equiv_vnd": 2990000,
          "months": 1,
          "price_vnd": 2990000
        },
        {
          "cycle": "quarterly",
          "discount_pct": 5,
          "monthly_equiv_vnd": 2840333,
          "months": 3,
          "price_vnd": 8521000
        }
      ],
      "monthly_vnd": 2990000,
      "name": "DS-6138-128",
      "on_sale": true,
      "setup_fee_vnd": 500000,
      "spec": {
        "console": true,
        "cores": 40,
        "cpu": "2x Intel Xeon Gold 6138",
        "ipv4": 1,
        "ram_gb": 128,
        "storage": "SSD ~1 TB",
        "threads": 80
      },
      "stock": [
        {
          "backorder": false,
          "count": 2,
          "count_os": 2,
          "zone_id": 1
        }
      ]
    }
  ],
  "templates": [
    {
      "family": "ubuntu",
      "install_minutes": 25,
      "min_disk_gb": 20,
      "min_ram_gb": 2,
      "name": "Ubuntu Server 24.04 LTS",
      "slug": "ubuntu-24.04",
      "username": "root",
      "version": "24.04"
    }
  ],
  "zones": [
    {
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "slug": "hcm"
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter was given; this call takes none. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |
| 429 | `rate_limited` | More than 30 calls in the last minute. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quote a Dedicated Server order (server-side price, wallet check, stock)

`POST /v1/dedicated/quote`

Prices an order without placing it. The price is always computed by the server from the plan and cycle: the total in VND, the US cents that would be charged at today's exchange rate, whether your wallet is enough (`shortfall_cents`) and the stock. `can_order` is true only when `reasons` is empty. No `Idempotency-Key` is needed. At most 30 calls per minute per account.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated quote`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan_code` | string | yes | Plan code from the catalog. |
| `zone_id` | integer | yes | Location identifier from the catalog. |
| `cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle offered by the plan. |
| `template` | string or null | no | Template slug to install automatically; null or absent to install the system yourself through ISO/Console. |
| `auto_renew` | boolean | no | Renew automatically from the wallet. Defaults to true. |
| `hostname` | string | no | Optional for a quote: when sent, it is validated the same way as when ordering. |

Example:

```json
{
  "cycle": "quarterly",
  "hostname": "web-01",
  "plan_code": "DS-6138-128",
  "template": "ubuntu-24.04",
  "zone_id": 1
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plan_code` | string | yes | Plan code. |
| `zone_id` | integer | yes | Zone identifier. |
| `cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `months` | integer | yes | Months in one cycle. |
| `price_vnd` | integer | yes | Price of the first cycle in VND. |
| `setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `total_vnd` | integer | yes | Total in VND. |
| `amount_cents` | integer | yes | US cents that would be charged now. |
| `fx_usd_vnd` | integer | yes | Exchange rate (VND per USD) used for `amount_cents`. |
| `balance_cents` | integer | yes | Your wallet balance in US cents. |
| `shortfall_cents` | integer | yes | US cents missing in the wallet; 0 when the balance is enough. |
| `shortfall_vnd` | integer | yes | The same shortfall in VND, rounded up. |
| `can_order` | boolean | yes | True when an order placed now would be accepted. |
| `reasons` | array of string: `sales_disabled`, `os_install_unavailable`, `insufficient_funds`, `email_unverified` | yes |  |
| `stock` | integer | yes | Servers available for the plan in the zone. |
| `backorder` | boolean | yes | True when no server is left in the zone: the order is still accepted and it waits for a server (`awaiting_stock`), delivered in 1–3 business days; if it cannot be delivered you get a full refund. |
| `stock_os` | integer | yes | Of those, servers on which the operating system can be installed automatically. |
| `renew_at_estimate` | integer | yes | When the first renewal would be due (Unix time, seconds, UTC) |

Example:

```json
{
  "amount_cents": 34700,
  "backorder": false,
  "balance_cents": 10000,
  "can_order": false,
  "cycle": "quarterly",
  "fx_usd_vnd": 26000,
  "months": 3,
  "plan_code": "DS-6138-128",
  "price_vnd": 8522000,
  "reasons": [
    "insufficient_funds"
  ],
  "renew_at_estimate": 1800203000,
  "setup_fee_vnd": 500000,
  "shortfall_cents": 24700,
  "shortfall_vnd": 642200,
  "stock": 2,
  "stock_os": 2,
  "total_vnd": 9022000,
  "zone_id": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, or it has a key this call does not know. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |
| 422 | `invalid_argument` | A field is missing or not valid; `field` names it. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 423 | `sales_disabled` | Dedicated Servers are not on sale for your account. |
| 429 | `rate_limited` | More than 30 calls in the last minute. |
| 503 | `dedicated_fx_unavailable` | The exchange rate is not available right now; try again in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/quote" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"quarterly","hostname":"web-01","plan_code":"DS-6138-128","template":"ubuntu-24.04","zone_id":1}'
```

---

#### Order a Dedicated Server: charges the wallet, assigns a machine and IP, installs the chosen operating system (automatic refund if the install fails)

`POST /v1/dedicated/order`

Orders a Dedicated Server and pays it from the wallet in one step: a server is taken from stock, an IPv4 address is assigned if the server has none, the first cycle plus the setup fee is charged, a paid invoice is issued and the subscription starts. With a `template` the operating system is installed automatically (usually 15–60 minutes): the order is `installing` and `op_id` is the installation operation; if the installation fails the full amount is refunded to the wallet automatically and the order becomes `refunded`. Without a template the order is `delivered` at once and you install the system yourself through ISO/Console. The root password of an automatic install is shown once, on the server's page. `Idempotency-Key` is required: repeating the same call with the same key and body returns the first answer and never charges twice; the same key with a different body fails with `idempotency_conflict`. Nothing is charged or written when the call fails. At most 5 orders per minute per account.

**Required scope:** `dedicated:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:create` | CLI: `dedicated order` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan_code` | string | yes | Plan code from the catalog. |
| `zone_id` | integer | yes | Location identifier from the catalog. |
| `cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle offered by the plan. |
| `template` | string or null | no | Template slug to install automatically; null or absent to install the system yourself through ISO/Console. |
| `auto_renew` | boolean | no | Renew automatically from the wallet. Defaults to true. |
| `hostname` | string | yes | Host name: lowercase letters, digits and hyphens, not starting or ending with a hyphen (at most 15 characters for Windows). Upper case is converted to lower case. |

Example:

```json
{
  "auto_renew": true,
  "cycle": "quarterly",
  "hostname": "web-01",
  "plan_code": "DS-6138-128",
  "template": "ubuntu-24.04",
  "zone_id": 1
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `order` | DedicatedOrder | yes |  |
| `order.id` | integer | yes | Order identifier. |
| `order.status` | string: `awaiting_stock`, `installing`, `delivered`, `refunded`, `cancelled` | yes | `awaiting_stock`: paid, waiting for a server to be assigned (1–3 business days; a full refund if it cannot be delivered). `installing`: the operating system is being installed. `delivered`: the server is yours and ready. `refunded`: the installation failed and the full amount was returned to your wallet. `cancelled`: cancelled by an administrator. |
| `order.plan_code` | string | yes | Plan code you ordered. |
| `order.plan_name` | string | yes | Plan display name. |
| `order.zone_id` | integer | yes | Location identifier. |
| `order.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `order.months` | integer | yes | Months in one cycle. |
| `order.price_vnd` | integer | yes | Price of the first cycle in VND (locked: this is also the price of every renewal). |
| `order.setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `order.total_vnd` | integer | yes | `price_vnd` + `setup_fee_vnd`. |
| `order.amount_cents` | integer | yes | US cents charged from the wallet, at the exchange rate of the moment. |
| `order.template` | string or null | yes | Operating system template that is installed automatically; null when you install it yourself. |
| `order.hostname` | string | yes | Host name given at order time. |
| `order.server_id` | string or null | yes | Dedicated Server identifier (`ds_…`) assigned to the order. |
| `order.op_id` | integer or null | yes | Operation that installs the operating system; poll it with Get an operation. Null when there is no automatic install. |
| `order.invoice_id` | integer or null | yes | Identifier of the paid invoice. |
| `order.refund_reason` | string or null: `install_failed`, `admin_cancel`, `customer_cancel` | yes | Why the order was refunded; null otherwise. |
| `order.refunded_cents` | integer | yes | US cents returned to the wallet; 0 when nothing was refunded. |
| `order.public_error` | string or null | yes | Short reason code when the installation failed, e.g. `timeout`; null otherwise. |
| `order.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `order.delivered_at` | integer or null | yes | When the server was delivered (Unix time, seconds, UTC) |
| `server_id` | string or null | yes | Identifier of the assigned Dedicated Server; null while the order waits for a server (`awaiting_stock`). |
| `op_id` | integer or null | yes | Installation operation; null without a template. |

Example:

```json
{
  "op_id": 905,
  "order": {
    "amount_cents": 34700,
    "created_at": 1792427000,
    "cycle": "quarterly",
    "delivered_at": null,
    "hostname": "web-01",
    "id": 17,
    "invoice_id": 4412,
    "months": 3,
    "op_id": 905,
    "plan_code": "DS-6138-128",
    "plan_name": "DS-6138-128",
    "price_vnd": 8522000,
    "public_error": null,
    "refund_reason": null,
    "refunded_cents": 0,
    "server_id": "ds_3f9a1c2b7d4e5a60",
    "setup_fee_vnd": 500000,
    "status": "installing",
    "template": "ubuntu-24.04",
    "total_vnd": 9022000,
    "zone_id": 1
  },
  "server_id": "ds_3f9a1c2b7d4e5a60"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object, or it has a key this call does not know. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing. |
| 400 | `idempotency_key_invalid` | The `Idempotency-Key` is not 8–80 characters of letters, digits, `-`, `_` or `:`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is lower than the total (`need_cents`, `balance_cents`, `shortfall_cents`); top up and try again. |
| 403 | `email_unverified` | Verify your email address first. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |
| 409 | `out_of_stock` | Race only: the last server was taken in the same instant; nothing was charged. Retry. |
| 409 | `os_install_unavailable` | Automatic installation is not available right now; order without a template or try again later. |
| 409 | `ip_pool_exhausted` | No IPv4 address is available to assign right now. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | A field is missing or not valid (plan, zone, cycle, template, hostname); `field` names it. |
| 422 | `idempotency_conflict` | The `Idempotency-Key` was already used with a different body. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `sales_disabled` | Dedicated Servers are not on sale, or this plan is switched off. |
| 429 | `rate_limited` | More than 5 orders in the last minute. |
| 503 | `dedicated_fx_unavailable` | The exchange rate is not available right now; try again in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/order" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"auto_renew":true,"cycle":"quarterly","hostname":"web-01","plan_code":"DS-6138-128","template":"ubuntu-24.04","zone_id":1}'
```

---

#### List my Dedicated Server orders

`GET /v1/dedicated/orders`

Lists your Dedicated Server orders, newest first by default.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated orders`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `status` | string: `awaiting_stock`, `installing`, `delivered`, `refunded`, `cancelled` | no | Only orders in this state. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of DedicatedOrder | yes |  |
| `items[].id` | integer | yes | Order identifier. |
| `items[].status` | string: `awaiting_stock`, `installing`, `delivered`, `refunded`, `cancelled` | yes | `awaiting_stock`: paid, waiting for a server to be assigned (1–3 business days; a full refund if it cannot be delivered). `installing`: the operating system is being installed. `delivered`: the server is yours and ready. `refunded`: the installation failed and the full amount was returned to your wallet. `cancelled`: cancelled by an administrator. |
| `items[].plan_code` | string | yes | Plan code you ordered. |
| `items[].plan_name` | string | yes | Plan display name. |
| `items[].zone_id` | integer | yes | Location identifier. |
| `items[].cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `items[].months` | integer | yes | Months in one cycle. |
| `items[].price_vnd` | integer | yes | Price of the first cycle in VND (locked: this is also the price of every renewal). |
| `items[].setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `items[].total_vnd` | integer | yes | `price_vnd` + `setup_fee_vnd`. |
| `items[].amount_cents` | integer | yes | US cents charged from the wallet, at the exchange rate of the moment. |
| `items[].template` | string or null | yes | Operating system template that is installed automatically; null when you install it yourself. |
| `items[].hostname` | string | yes | Host name given at order time. |
| `items[].server_id` | string or null | yes | Dedicated Server identifier (`ds_…`) assigned to the order. |
| `items[].op_id` | integer or null | yes | Operation that installs the operating system; poll it with Get an operation. Null when there is no automatic install. |
| `items[].invoice_id` | integer or null | yes | Identifier of the paid invoice. |
| `items[].refund_reason` | string or null: `install_failed`, `admin_cancel`, `customer_cancel` | yes | Why the order was refunded; null otherwise. |
| `items[].refunded_cents` | integer | yes | US cents returned to the wallet; 0 when nothing was refunded. |
| `items[].public_error` | string or null | yes | Short reason code when the installation failed, e.g. `timeout`; null otherwise. |
| `items[].created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `items[].delivered_at` | integer or null | yes | When the server was delivered (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "amount_cents": 34700,
      "created_at": 1792427000,
      "cycle": "quarterly",
      "delivered_at": 1792428800,
      "hostname": "web-01",
      "id": 17,
      "invoice_id": 4412,
      "months": 3,
      "op_id": 905,
      "plan_code": "DS-6138-128",
      "plan_name": "DS-6138-128",
      "price_vnd": 8522000,
      "public_error": null,
      "refund_reason": null,
      "refunded_cents": 0,
      "server_id": "ds_3f9a1c2b7d4e5a60",
      "setup_fee_vnd": 500000,
      "status": "delivered",
      "template": "ubuntu-24.04",
      "total_vnd": 9022000,
      "zone_id": 1
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/orders" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one Dedicated Server order

`GET /v1/dedicated/orders/{oid}`

Returns one of your orders. Poll it while `status` is `installing`; the installation progress itself is the operation in `op_id`.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated order-get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `oid` | string | yes | Order identifier as returned by Order a Dedicated Server or List Dedicated Server orders (a positive integer). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `order` | DedicatedOrder | yes |  |
| `order.id` | integer | yes | Order identifier. |
| `order.status` | string: `awaiting_stock`, `installing`, `delivered`, `refunded`, `cancelled` | yes | `awaiting_stock`: paid, waiting for a server to be assigned (1–3 business days; a full refund if it cannot be delivered). `installing`: the operating system is being installed. `delivered`: the server is yours and ready. `refunded`: the installation failed and the full amount was returned to your wallet. `cancelled`: cancelled by an administrator. |
| `order.plan_code` | string | yes | Plan code you ordered. |
| `order.plan_name` | string | yes | Plan display name. |
| `order.zone_id` | integer | yes | Location identifier. |
| `order.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `order.months` | integer | yes | Months in one cycle. |
| `order.price_vnd` | integer | yes | Price of the first cycle in VND (locked: this is also the price of every renewal). |
| `order.setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `order.total_vnd` | integer | yes | `price_vnd` + `setup_fee_vnd`. |
| `order.amount_cents` | integer | yes | US cents charged from the wallet, at the exchange rate of the moment. |
| `order.template` | string or null | yes | Operating system template that is installed automatically; null when you install it yourself. |
| `order.hostname` | string | yes | Host name given at order time. |
| `order.server_id` | string or null | yes | Dedicated Server identifier (`ds_…`) assigned to the order. |
| `order.op_id` | integer or null | yes | Operation that installs the operating system; poll it with Get an operation. Null when there is no automatic install. |
| `order.invoice_id` | integer or null | yes | Identifier of the paid invoice. |
| `order.refund_reason` | string or null: `install_failed`, `admin_cancel`, `customer_cancel` | yes | Why the order was refunded; null otherwise. |
| `order.refunded_cents` | integer | yes | US cents returned to the wallet; 0 when nothing was refunded. |
| `order.public_error` | string or null | yes | Short reason code when the installation failed, e.g. `timeout`; null otherwise. |
| `order.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `order.delivered_at` | integer or null | yes | When the server was delivered (Unix time, seconds, UTC) |

Example:

```json
{
  "order": {
    "amount_cents": 34700,
    "created_at": 1792427000,
    "cycle": "quarterly",
    "delivered_at": null,
    "hostname": "web-01",
    "id": 17,
    "invoice_id": 4412,
    "months": 3,
    "op_id": 905,
    "plan_code": "DS-6138-128",
    "plan_name": "DS-6138-128",
    "price_vnd": 8522000,
    "public_error": null,
    "refund_reason": null,
    "refunded_cents": 0,
    "server_id": "ds_3f9a1c2b7d4e5a60",
    "setup_fee_vnd": 500000,
    "status": "installing",
    "template": "ubuntu-24.04",
    "total_vnd": 9022000,
    "zone_id": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The order does not exist or is not yours. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/orders/<oid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Cancel your own Dedicated Server order while it waits for a server (full refund to the wallet)

`POST /v1/dedicated/orders/{oid}/cancel`

Cancels your order while it is `awaiting_stock` (no server assigned yet) and refunds the full amount to your wallet, once. Orders that already have a server cannot be cancelled here.

**Required scope:** `dedicated:create`.

Scope: `dedicated:create` | CLI: `dedicated order-cancel` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `oid` | string | yes | Order identifier as returned by Order a Dedicated Server or List Dedicated Server orders (a positive integer). |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `order` | DedicatedOrder | yes |  |
| `order.id` | integer | yes | Order identifier. |
| `order.status` | string: `awaiting_stock`, `installing`, `delivered`, `refunded`, `cancelled` | yes | `awaiting_stock`: paid, waiting for a server to be assigned (1–3 business days; a full refund if it cannot be delivered). `installing`: the operating system is being installed. `delivered`: the server is yours and ready. `refunded`: the installation failed and the full amount was returned to your wallet. `cancelled`: cancelled by an administrator. |
| `order.plan_code` | string | yes | Plan code you ordered. |
| `order.plan_name` | string | yes | Plan display name. |
| `order.zone_id` | integer | yes | Location identifier. |
| `order.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `order.months` | integer | yes | Months in one cycle. |
| `order.price_vnd` | integer | yes | Price of the first cycle in VND (locked: this is also the price of every renewal). |
| `order.setup_fee_vnd` | integer | yes | One-time setup fee in VND. |
| `order.total_vnd` | integer | yes | `price_vnd` + `setup_fee_vnd`. |
| `order.amount_cents` | integer | yes | US cents charged from the wallet, at the exchange rate of the moment. |
| `order.template` | string or null | yes | Operating system template that is installed automatically; null when you install it yourself. |
| `order.hostname` | string | yes | Host name given at order time. |
| `order.server_id` | string or null | yes | Dedicated Server identifier (`ds_…`) assigned to the order. |
| `order.op_id` | integer or null | yes | Operation that installs the operating system; poll it with Get an operation. Null when there is no automatic install. |
| `order.invoice_id` | integer or null | yes | Identifier of the paid invoice. |
| `order.refund_reason` | string or null: `install_failed`, `admin_cancel`, `customer_cancel` | yes | Why the order was refunded; null otherwise. |
| `order.refunded_cents` | integer | yes | US cents returned to the wallet; 0 when nothing was refunded. |
| `order.public_error` | string or null | yes | Short reason code when the installation failed, e.g. `timeout`; null otherwise. |
| `order.created_at` | integer | yes | When the order was placed (Unix time, seconds, UTC) |
| `order.delivered_at` | integer or null | yes | When the server was delivered (Unix time, seconds, UTC) |

Example:

```json
{
  "order": {
    "amount_cents": 34700,
    "created_at": 1792427000,
    "cycle": "quarterly",
    "delivered_at": null,
    "hostname": "web-01",
    "id": 17,
    "invoice_id": 4412,
    "months": 3,
    "op_id": 905,
    "plan_code": "DS-6138-128",
    "plan_name": "DS-6138-128",
    "price_vnd": 8522000,
    "public_error": null,
    "refund_reason": null,
    "refunded_cents": 0,
    "server_id": "ds_3f9a1c2b7d4e5a60",
    "setup_fee_vnd": 500000,
    "status": "cancelled",
    "template": "ubuntu-24.04",
    "total_vnd": 9022000,
    "zone_id": 1
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The order does not exist or is not yours. |
| 404 | `not_found` | Dedicated Servers are not sold on this site. |
| 409 | `order_not_cancellable` | The order is not waiting for a server any more. |
| 429 | `rate_limited` | More than 10 calls in the last minute. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/orders/<oid>/cancel" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List the operating systems that can be installed on a Dedicated Server (enabled templates)

`GET /v1/dedicated/os-templates`

Lists the operating systems that can be installed on a Dedicated Server: only templates that are switched on and whose installation image is available. The list is the same for every server. It is empty for accounts that have no Dedicated Server.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated os`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of DedicatedOsTemplate | yes |  |
| `items[].slug` | string | yes | Template identifier, e.g. `ubuntu-24.04`. Use it as `template` when reinstalling. |
| `items[].name` | string | yes | Display name, e.g. `Ubuntu Server 24.04 LTS`. |
| `items[].family` | string: `ubuntu`, `debian`, `windows` | yes | Operating system family. |
| `items[].version` | string | yes | Version, e.g. `24.04`, `13`, `2022`. |
| `items[].username` | string | yes | Name of the administrator account created on the installed system. |
| `items[].min_ram_gb` | integer or null | yes | Minimum memory in GiB the system needs; null when not stated. |
| `items[].min_disk_gb` | integer or null | yes | Minimum disk space in GiB the system needs; null when not stated. |

Example:

```json
{
  "items": [
    {
      "family": "ubuntu",
      "min_disk_gb": 20,
      "min_ram_gb": 2,
      "name": "Ubuntu Server 24.04 LTS",
      "slug": "ubuntu-24.04",
      "username": "root",
      "version": "24.04"
    },
    {
      "family": "debian",
      "min_disk_gb": null,
      "min_ram_gb": null,
      "name": "Debian 13",
      "slug": "debian-13",
      "username": "root",
      "version": "13"
    }
  ]
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/os-templates" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one Dedicated Server: hardware, network, status and which actions are available

`GET /v1/dedicated/{id}`

Returns one Dedicated Server with its hardware, network settings, subscription and which actions you can start now. The `actions` object is the only thing a client needs to decide whether a button is enabled: `reason` says why an action is unavailable.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `server` | DedicatedServer | yes |  |
| `server.id` | string | yes | Dedicated Server identifier. |
| `server.name` | string | yes | Name of the server; you can change it. |
| `server.model` | string or null | yes | Hardware model. |
| `server.cpu` | object | yes |  |
| `server.cpu.model` | string or null | yes | Processor model. |
| `server.cpu.sockets` | integer or null | yes | Number of processors. |
| `server.cpu.cores` | integer or null | yes | Total physical cores. |
| `server.cpu.threads` | integer or null | yes | Total hardware threads. |
| `server.memory_gb` | integer or null | yes | Installed memory in GiB. |
| `server.storage_bytes` | integer or null | yes | Total capacity of the disks in bytes. |
| `server.public_ip` | string or null | yes | Public IPv4 address. |
| `server.zone` | object or null | yes |  |
| `server.zone.id` | integer | yes | Zone identifier. |
| `server.zone.slug` | string | yes | Short zone name, e.g. `hcm`. |
| `server.zone.name` | string | yes | Display name of the zone. |
| `server.zone.country` | string | yes | Two-letter country code. |
| `server.power_state` | string or null | yes | `On` or `Off`. |
| `server.health` | string or null | yes | Overall hardware health. |
| `server.status` | string: `active`, `suspended` | yes | State of your subscription. |
| `server.locked` | boolean | yes | True when control actions are locked. |
| `server.op` | DedicatedOpBrief or null | yes |  |
| `server.polled_at` | integer or null | yes | When the status was last refreshed (Unix time, seconds, UTC) |
| `server.stale` | boolean | yes | True when the status shown may be outdated. |
| `server.assigned_at` | integer | yes | When the server was assigned to your account (Unix time, seconds, UTC) |
| `server.agent` | DedicatedAgent | no |  |
| `server.agent.state` | string: `online`, `offline`, `waiting`, `none` | yes | `online` the agent reported in the last minute; `offline` it did not; `waiting` an install is in progress and the agent has not registered yet; `none` no agent. |
| `server.agent.version` | string or null | yes | Agent version. |
| `server.agent.os` | string or null | yes | `linux` or `windows`. |
| `server.agent.last_seen` | integer or null | yes | When the agent last reported (Unix time, seconds, UTC) |
| `server.agent.can_change_pw` | boolean | yes | True when the agent is online and supports password changes. |
| `server.agent.window_open` | boolean | yes | True while a one-time enrolment token is valid. |
| `server.agent.embed_families` | array of string | yes |  |
| `server.agent.os_user` | string or null | yes | The OS account whose password can be changed (`root` or `Administrator`). |
| `server.agent.change` | DedicatedPwChange or null | yes |  |
| `server.agent.collects` | array of string | yes |  |
| `server.hostname` | string or null | yes | Host name reported by the operating system, when known. |
| `server.service_tag` | string or null | yes | Hardware service tag printed on the machine. |
| `server.hardware` | object | yes |  |
| `server.hardware.cpus` | array of object | yes |  |
| `server.hardware.memory` | array of object | yes |  |
| `server.hardware.drives` | array of object | yes |  |
| `server.hardware.nics` | array of object | yes |  |
| `server.hardware.psus` | array of object | yes |  |
| `server.hardware.bios` | string or null | yes | BIOS version. |
| `server.hardware.boot_mode` | string or null | yes | Boot mode, e.g. `UEFI`. |
| `server.network` | object | yes |  |
| `server.network.public_ip` | string or null | yes | Public IPv4 address. |
| `server.network.gateway` | string or null | yes | Gateway address. |
| `server.network.prefix` | integer or null | yes | Prefix length of the public network. |
| `server.network.netmask` | string or null | yes | Netmask matching the prefix. |
| `server.network.dns` | array of string | yes |  |
| `server.os` | object | yes |  |
| `server.os.name` | string or null | yes | Installed operating system, when known. |
| `server.os.username` | string or null | yes | Administrator account name of the installed system. |
| `server.os.installed_at` | integer or null | yes | When the system was installed (Unix time, seconds, UTC) |
| `server.os.access` | string: `ready`, `installing`, `install_failed`, `not_installed` | yes | Whether the web panel can show the login of the current install: `ready`; `installing` (an install is running); `install_failed` (the latest install failed; no password is shown); `not_installed` (no install for this subscription yet). The password itself is never part of this response. |
| `server.os.access_error` | string or null | yes | Public failure code of the latest install when `access` is `install_failed`, otherwise null. |
| `server.subscription` | object | yes |  |
| `server.subscription.id` | integer | yes | Subscription identifier. |
| `server.subscription.plan` | string or null | yes | Plan code; null for machines assigned without a plan. |
| `server.subscription.cycle` | string | yes | Billing cycle. |
| `server.subscription.free` | boolean | yes | True when the subscription is free of charge. A free subscription is never renewed or billed. |
| `server.subscription.price_vnd` | integer | yes | Locked price per cycle in VND; 0 for free subscriptions. |
| `server.subscription.renew_at` | integer or null | yes | Next renewal; null when the subscription never renews (Unix time, seconds, UTC) |
| `server.subscription.status` | string: `active`, `suspended` | yes | Subscription state. |
| `server.subscription.started_at` | integer | yes | When the subscription started (Unix time, seconds, UTC) |
| `server.subscription.renewal` | DedicatedRenewal or null | yes |  |
| `server.capabilities` | object | yes |  |
| `server.capabilities.power` | boolean | yes | Power control is supported. |
| `server.capabilities.console` | boolean | yes | Remote console is supported. |
| `server.capabilities.reinstall` | boolean | yes | Operating system reinstall is available. |
| `server.capabilities.sensors` | boolean | yes | Sensors are available. |
| `server.capabilities.events` | boolean | yes | Hardware log is available. |
| `server.capabilities.bandwidth` | boolean | yes | Bandwidth statistics are available. |
| `server.actions` | object | yes |  |
| `server.actions.power` | DedicatedAction | yes |  |
| `server.actions.console` | DedicatedAction | yes |  |
| `server.lock` | object | yes |  |
| `server.lock.locked` | boolean | yes | True when control actions are locked. |
| `server.lock.code` | string or null | yes | Why it is locked, e.g. `imported`, `maintenance`, `locked`. |
| `server.lock.message` | string or null | yes | Standard explanation for the lock code, in your account language. |
| `server.lock.note` | string or null | yes | Free-text note written by the administrator when locking, if any; show it in addition to `message`. |
| `server.sensors_at` | integer or null | yes | When the sensors were last read (Unix time, seconds, UTC) |
| `server.order` | DedicatedOrder or null | no |  |
| `server.billing` | DedicatedBilling or null | no |  |
| `order` | DedicatedOrder or null | no |  |

Example:

```json
{
  "server": {
    "actions": {
      "console": {
        "allowed": false,
        "message": "Server control is temporarily disabled system-wide",
        "reason": "dedicated_ops_disabled"
      },
      "power": {
        "allowed": false,
        "message": "Server control is temporarily disabled system-wide",
        "reason": "dedicated_ops_disabled"
      }
    },
    "assigned_at": 1792425000,
    "billing": {
      "anchor_day": 31,
      "auto_renew": true,
      "balance_cents": 100000,
      "can_renew": true,
      "cycle": "monthly",
      "cycle_months": 1,
      "cycles": [
        {
          "cycle": "monthly",
          "discount_pct": 0,
          "months": 1,
          "price_vnd": 2590000
        },
        {
          "cycle": "quarterly",
          "discount_pct": 5,
          "months": 3,
          "price_vnd": 7380000
        }
      ],
      "debt": {
        "amount_cents": null,
        "grace_until": null,
        "invoice_id": null,
        "overdue": false,
        "suspended": false,
        "unpaid": false
      },
      "free": false,
      "last_invoice": {
        "created_at": 1799514000,
        "currency": "usd",
        "description": "Dedicated Server dell-105 — Monthly renewal",
        "due_at": null,
        "id": 4411,
        "kind": "renewal",
        "number": "INV-2026-004411",
        "paid_at": 1799514000,
        "period_from": 1799514000,
        "period_to": 1802192400,
        "status": "paid",
        "total_cents": 99615
      },
      "max_periods": 24,
      "next": {
        "amount_cents": 99615,
        "cycle": "monthly",
        "plan_code": "DS-6138-64",
        "price_vnd": 2590000,
        "scheduled_change": false
      },
      "pending_cycle": null,
      "pending_plan": null,
      "plan": {
        "code": "DS-6138-64",
        "name": "Dedicated 6138 · 64 GB",
        "spec": {}
      },
      "plan_change": null,
      "price_vnd": 2590000,
      "renew_at": 1802192400,
      "status": "active"
    },
    "capabilities": {
      "bandwidth": true,
      "console": true,
      "events": true,
      "power": true,
      "reinstall": false,
      "sensors": true
    },
    "cpu": {
      "cores": 40,
      "model": "Intel Xeon Gold 6138",
      "sockets": 2,
      "threads": 80
    },
    "hardware": {
      "bios": "2.24.0",
      "boot_mode": "UEFI",
      "cpus": [
        {
          "cores": 20,
          "health": "OK",
          "model": "Intel Xeon Gold 6138",
          "socket": 1,
          "threads": 40
        }
      ],
      "drives": [
        {
          "health": null,
          "media": "SSD",
          "model": "B SSD",
          "protocol": "SATA",
          "size_bytes": 1024209543168
        }
      ],
      "memory": [
        {
          "health": "OK",
          "manufacturer": "Samsung",
          "part": "M386A8K40BM1-CRC",
          "size_gb": 64,
          "slot": "A5",
          "speed_mhz": 2400,
          "type": "DDR4"
        }
      ],
      "nics": [
        {
          "id": "NIC.Mezzanine.3-1",
          "link": null,
          "mac": "70:20:84:E1:EA:82",
          "speed_mbps": null
        }
      ],
      "psus": [
        {
          "health": "OK",
          "input_v": 220,
          "name": "PS1"
        }
      ]
    },
    "health": "OK",
    "hostname": "WIN-AG6ESNVPQ0I",
    "id": "ds_3f9a1c2b7d4e5a60",
    "lock": {
      "code": "imported",
      "locked": true,
      "message": "This server is locked for control actions by the administrator.",
      "note": null
    },
    "locked": true,
    "memory_gb": 64,
    "model": "PowerEdge C6420",
    "name": "dell-105",
    "network": {
      "dns": [
        "1.1.1.1",
        "8.8.8.8"
      ],
      "gateway": "23.132.252.1",
      "netmask": "255.255.255.0",
      "prefix": 24,
      "public_ip": "23.132.252.247"
    },
    "op": null,
    "os": {
      "access": "not_installed",
      "access_error": null,
      "installed_at": null,
      "name": null,
      "username": null
    },
    "polled_at": 1792426591,
    "power_state": "On",
    "public_ip": "23.132.252.247",
    "sensors_at": 1792426591,
    "service_tag": "HNCS1S2",
    "stale": false,
    "status": "active",
    "storage_bytes": 1024209543168,
    "subscription": {
      "cycle": "monthly",
      "free": true,
      "id": 1,
      "plan": null,
      "price_vnd": 0,
      "renew_at": null,
      "renewal": null,
      "started_at": 1792425000,
      "status": "active"
    },
    "zone": {
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "slug": "hcm"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Rename a Dedicated Server

`PATCH /v1/dedicated/{id}`

Renames a Dedicated Server. Only the name changes; nothing is sent to the machine. A suspended subscription cannot rename.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated rename`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | New name, 1-64 printable characters. Leading and trailing spaces are removed. |

Example:

```json
{
  "name": "build-server"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `server` | DedicatedServer | yes |  |
| `server.id` | string | yes | Dedicated Server identifier. |
| `server.name` | string | yes | Name of the server; you can change it. |
| `server.model` | string or null | yes | Hardware model. |
| `server.cpu` | object | yes |  |
| `server.cpu.model` | string or null | yes | Processor model. |
| `server.cpu.sockets` | integer or null | yes | Number of processors. |
| `server.cpu.cores` | integer or null | yes | Total physical cores. |
| `server.cpu.threads` | integer or null | yes | Total hardware threads. |
| `server.memory_gb` | integer or null | yes | Installed memory in GiB. |
| `server.storage_bytes` | integer or null | yes | Total capacity of the disks in bytes. |
| `server.public_ip` | string or null | yes | Public IPv4 address. |
| `server.zone` | object or null | yes |  |
| `server.zone.id` | integer | yes | Zone identifier. |
| `server.zone.slug` | string | yes | Short zone name, e.g. `hcm`. |
| `server.zone.name` | string | yes | Display name of the zone. |
| `server.zone.country` | string | yes | Two-letter country code. |
| `server.power_state` | string or null | yes | `On` or `Off`. |
| `server.health` | string or null | yes | Overall hardware health. |
| `server.status` | string: `active`, `suspended` | yes | State of your subscription. |
| `server.locked` | boolean | yes | True when control actions are locked. |
| `server.op` | DedicatedOpBrief or null | yes |  |
| `server.polled_at` | integer or null | yes | When the status was last refreshed (Unix time, seconds, UTC) |
| `server.stale` | boolean | yes | True when the status shown may be outdated. |
| `server.assigned_at` | integer | yes | When the server was assigned to your account (Unix time, seconds, UTC) |
| `server.agent` | DedicatedAgent | no |  |
| `server.agent.state` | string: `online`, `offline`, `waiting`, `none` | yes | `online` the agent reported in the last minute; `offline` it did not; `waiting` an install is in progress and the agent has not registered yet; `none` no agent. |
| `server.agent.version` | string or null | yes | Agent version. |
| `server.agent.os` | string or null | yes | `linux` or `windows`. |
| `server.agent.last_seen` | integer or null | yes | When the agent last reported (Unix time, seconds, UTC) |
| `server.agent.can_change_pw` | boolean | yes | True when the agent is online and supports password changes. |
| `server.agent.window_open` | boolean | yes | True while a one-time enrolment token is valid. |
| `server.agent.embed_families` | array of string | yes |  |
| `server.agent.os_user` | string or null | yes | The OS account whose password can be changed (`root` or `Administrator`). |
| `server.agent.change` | DedicatedPwChange or null | yes |  |
| `server.agent.collects` | array of string | yes |  |
| `server.hostname` | string or null | yes | Host name reported by the operating system, when known. |
| `server.service_tag` | string or null | yes | Hardware service tag printed on the machine. |
| `server.hardware` | object | yes |  |
| `server.hardware.cpus` | array of object | yes |  |
| `server.hardware.memory` | array of object | yes |  |
| `server.hardware.drives` | array of object | yes |  |
| `server.hardware.nics` | array of object | yes |  |
| `server.hardware.psus` | array of object | yes |  |
| `server.hardware.bios` | string or null | yes | BIOS version. |
| `server.hardware.boot_mode` | string or null | yes | Boot mode, e.g. `UEFI`. |
| `server.network` | object | yes |  |
| `server.network.public_ip` | string or null | yes | Public IPv4 address. |
| `server.network.gateway` | string or null | yes | Gateway address. |
| `server.network.prefix` | integer or null | yes | Prefix length of the public network. |
| `server.network.netmask` | string or null | yes | Netmask matching the prefix. |
| `server.network.dns` | array of string | yes |  |
| `server.os` | object | yes |  |
| `server.os.name` | string or null | yes | Installed operating system, when known. |
| `server.os.username` | string or null | yes | Administrator account name of the installed system. |
| `server.os.installed_at` | integer or null | yes | When the system was installed (Unix time, seconds, UTC) |
| `server.os.access` | string: `ready`, `installing`, `install_failed`, `not_installed` | yes | Whether the web panel can show the login of the current install: `ready`; `installing` (an install is running); `install_failed` (the latest install failed; no password is shown); `not_installed` (no install for this subscription yet). The password itself is never part of this response. |
| `server.os.access_error` | string or null | yes | Public failure code of the latest install when `access` is `install_failed`, otherwise null. |
| `server.subscription` | object | yes |  |
| `server.subscription.id` | integer | yes | Subscription identifier. |
| `server.subscription.plan` | string or null | yes | Plan code; null for machines assigned without a plan. |
| `server.subscription.cycle` | string | yes | Billing cycle. |
| `server.subscription.free` | boolean | yes | True when the subscription is free of charge. A free subscription is never renewed or billed. |
| `server.subscription.price_vnd` | integer | yes | Locked price per cycle in VND; 0 for free subscriptions. |
| `server.subscription.renew_at` | integer or null | yes | Next renewal; null when the subscription never renews (Unix time, seconds, UTC) |
| `server.subscription.status` | string: `active`, `suspended` | yes | Subscription state. |
| `server.subscription.started_at` | integer | yes | When the subscription started (Unix time, seconds, UTC) |
| `server.subscription.renewal` | DedicatedRenewal or null | yes |  |
| `server.capabilities` | object | yes |  |
| `server.capabilities.power` | boolean | yes | Power control is supported. |
| `server.capabilities.console` | boolean | yes | Remote console is supported. |
| `server.capabilities.reinstall` | boolean | yes | Operating system reinstall is available. |
| `server.capabilities.sensors` | boolean | yes | Sensors are available. |
| `server.capabilities.events` | boolean | yes | Hardware log is available. |
| `server.capabilities.bandwidth` | boolean | yes | Bandwidth statistics are available. |
| `server.actions` | object | yes |  |
| `server.actions.power` | DedicatedAction | yes |  |
| `server.actions.console` | DedicatedAction | yes |  |
| `server.lock` | object | yes |  |
| `server.lock.locked` | boolean | yes | True when control actions are locked. |
| `server.lock.code` | string or null | yes | Why it is locked, e.g. `imported`, `maintenance`, `locked`. |
| `server.lock.message` | string or null | yes | Standard explanation for the lock code, in your account language. |
| `server.lock.note` | string or null | yes | Free-text note written by the administrator when locking, if any; show it in addition to `message`. |
| `server.sensors_at` | integer or null | yes | When the sensors were last read (Unix time, seconds, UTC) |
| `server.order` | DedicatedOrder or null | no |  |
| `server.billing` | DedicatedBilling or null | no |  |

Example:

```json
{
  "server": {
    "actions": {
      "console": {
        "allowed": false,
        "message": "Server control is temporarily disabled system-wide",
        "reason": "dedicated_ops_disabled"
      },
      "power": {
        "allowed": false,
        "message": "Server control is temporarily disabled system-wide",
        "reason": "dedicated_ops_disabled"
      }
    },
    "assigned_at": 1792425000,
    "billing": {
      "anchor_day": 31,
      "auto_renew": true,
      "balance_cents": 100000,
      "can_renew": true,
      "cycle": "monthly",
      "cycle_months": 1,
      "cycles": [
        {
          "cycle": "monthly",
          "discount_pct": 0,
          "months": 1,
          "price_vnd": 2590000
        },
        {
          "cycle": "quarterly",
          "discount_pct": 5,
          "months": 3,
          "price_vnd": 7380000
        }
      ],
      "debt": {
        "amount_cents": null,
        "grace_until": null,
        "invoice_id": null,
        "overdue": false,
        "suspended": false,
        "unpaid": false
      },
      "free": false,
      "last_invoice": {
        "created_at": 1799514000,
        "currency": "usd",
        "description": "Dedicated Server dell-105 — Monthly renewal",
        "due_at": null,
        "id": 4411,
        "kind": "renewal",
        "number": "INV-2026-004411",
        "paid_at": 1799514000,
        "period_from": 1799514000,
        "period_to": 1802192400,
        "status": "paid",
        "total_cents": 99615
      },
      "max_periods": 24,
      "next": {
        "amount_cents": 99615,
        "cycle": "monthly",
        "plan_code": "DS-6138-64",
        "price_vnd": 2590000,
        "scheduled_change": false
      },
      "pending_cycle": null,
      "pending_plan": null,
      "plan": {
        "code": "DS-6138-64",
        "name": "Dedicated 6138 · 64 GB",
        "spec": {}
      },
      "plan_change": null,
      "price_vnd": 2590000,
      "renew_at": 1802192400,
      "status": "active"
    },
    "capabilities": {
      "bandwidth": true,
      "console": true,
      "events": true,
      "power": true,
      "reinstall": false,
      "sensors": true
    },
    "cpu": {
      "cores": 40,
      "model": "Intel Xeon Gold 6138",
      "sockets": 2,
      "threads": 80
    },
    "hardware": {
      "bios": "2.24.0",
      "boot_mode": "UEFI",
      "cpus": [
        {
          "cores": 20,
          "health": "OK",
          "model": "Intel Xeon Gold 6138",
          "socket": 1,
          "threads": 40
        }
      ],
      "drives": [
        {
          "health": null,
          "media": "SSD",
          "model": "B SSD",
          "protocol": "SATA",
          "size_bytes": 1024209543168
        }
      ],
      "memory": [
        {
          "health": "OK",
          "manufacturer": "Samsung",
          "part": "M386A8K40BM1-CRC",
          "size_gb": 64,
          "slot": "A5",
          "speed_mhz": 2400,
          "type": "DDR4"
        }
      ],
      "nics": [
        {
          "id": "NIC.Mezzanine.3-1",
          "link": null,
          "mac": "70:20:84:E1:EA:82",
          "speed_mbps": null
        }
      ],
      "psus": [
        {
          "health": "OK",
          "input_v": 220,
          "name": "PS1"
        }
      ]
    },
    "health": "OK",
    "hostname": "WIN-AG6ESNVPQ0I",
    "id": "ds_3f9a1c2b7d4e5a60",
    "lock": {
      "code": "imported",
      "locked": true,
      "message": "This server is locked for control actions by the administrator.",
      "note": null
    },
    "locked": true,
    "memory_gb": 64,
    "model": "PowerEdge C6420",
    "name": "dell-105",
    "network": {
      "dns": [
        "1.1.1.1",
        "8.8.8.8"
      ],
      "gateway": "23.132.252.1",
      "netmask": "255.255.255.0",
      "prefix": 24,
      "public_ip": "23.132.252.247"
    },
    "op": null,
    "os": {
      "access": "not_installed",
      "access_error": null,
      "installed_at": null,
      "name": null,
      "username": null
    },
    "polled_at": 1792426591,
    "power_state": "On",
    "public_ip": "23.132.252.247",
    "sensors_at": 1792426591,
    "service_tag": "HNCS1S2",
    "stale": false,
    "status": "active",
    "storage_bytes": 1024209543168,
    "subscription": {
      "cycle": "monthly",
      "free": true,
      "id": 1,
      "plan": null,
      "price_vnd": 0,
      "renew_at": null,
      "renewal": null,
      "started_at": 1792425000,
      "status": "active"
    },
    "zone": {
      "country": "VN",
      "id": 1,
      "name": "Ho Chi Minh City",
      "slug": "hcm"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object with a valid `name`. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/dedicated/<id>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"build-server"}'
```

---

#### Turn auto-renew of a Dedicated Server subscription on or off

`PATCH /v1/dedicated/{id}/auto-renew`

Turns automatic renewal of the subscription on or off. With auto-renew on, the wallet is charged the locked price of one cycle when the renewal date arrives and the balance is enough; otherwise an invoice is issued and waits for payment. It works on a suspended subscription too, because it is about billing and does not touch the machine. Free subscriptions are never billed and cannot be changed. At most 20 calls per minute per account.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated auto-renew`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `auto_renew` | boolean | yes | `true` to renew automatically, `false` to renew by hand. |

Example:

```json
{
  "auto_renew": false
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `renewal` | DedicatedRenewal | yes |  |
| `renewal.renew_at` | integer | yes | Next renewal date: the invoice for the next cycle is issued at this time (Unix time, seconds, UTC) |
| `renewal.price_vnd` | integer | yes | Locked price of one cycle in VND. It is the price of your subscription, not the catalog price. |
| `renewal.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `renewal.cycle_months` | integer | yes | Months in one cycle (1, 3, 6, 12 or 24). |
| `renewal.auto_renew` | boolean | yes | When true the wallet is charged automatically on the renewal date if the balance is enough. |
| `renewal.status` | string: `ok`, `due_soon`, `unpaid`, `suspended` | yes | `ok`: nothing to do. `due_soon`: renews within 7 days. `unpaid`: an invoice is open and waiting for payment. `suspended`: the invoice was not paid before the end of the grace period and the subscription is read-only (the server keeps running). |
| `renewal.grace_until` | integer or null | yes | While `unpaid` or `suspended`: the end of the grace period after which an unpaid subscription is suspended; null otherwise (Unix time, seconds, UTC) |
| `renewal.invoice_id_open` | integer or null | yes | Identifier of the open renewal invoice (see Invoices); null when there is none |
| `renewal.amount_cents` | integer or null | yes | What paying now costs in US cents: the amount locked on the open invoice, otherwise the price of the next cycle at today's exchange rate. Null when the exchange rate is not available. |
| `renewal.balance_cents` | integer | yes | Your wallet balance in US cents. |
| `renewal.period_to` | integer | yes | The renewal date you will have after paying now (Unix time, seconds, UTC) |
| `renewal.can_pay` | boolean | yes | True when [Renew a Dedicated Server](#operation/dedicated_renew) can be called now: an invoice is open, or the renewal date is within the last 14 days. |
| `changed` | boolean | yes | False when the subscription already had that setting. |

Example:

```json
{
  "changed": true,
  "renewal": {
    "amount_cents": 28846,
    "auto_renew": true,
    "balance_cents": 100000,
    "can_pay": true,
    "cycle": "quarterly",
    "cycle_months": 3,
    "grace_until": null,
    "invoice_id_open": null,
    "period_to": 1810054800,
    "price_vnd": 7500000,
    "renew_at": 1802192400,
    "status": "due_soon"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body must be exactly `{"auto_renew": true\|false}`. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 422 | `dedicated_free_subscription` | The subscription is free of charge: there is no renewal to configure. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/dedicated/<id>/auto-renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_renew":false}'
```

---

#### Pay the open renewal invoice or renew several cycles early (periods; charged from the wallet at the subscription's locked price)

`POST /v1/dedicated/{id}/renew`

Pays the renewal of the subscription from your wallet. If an invoice is open it is paid; otherwise one cycle is renewed early, which is allowed in the last 14 days before `renew_at`. The price is always the locked price of your subscription converted to US cents at the exchange rate of the moment (rounded down); the free subscriptions are never charged. A suspended subscription becomes active again right after payment. Send `expect_renew_at` with the `renew_at` you saw: if it changed in between, nothing is charged (`409 dedicated_renew_stale`). Pressing twice does not charge twice. At most 10 calls per minute per account.

**Required scope:** `dedicated:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:write` | CLI: `dedicated renew` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `expect_renew_at` | integer | no | The `renew_at` you are paying for; the call fails with `dedicated_renew_stale` if the subscription's date is no longer this one. (Unix time, seconds, UTC) |
| `expect_total_cents` | integer | no | The total in US cents you saw (cycles x amount). If the amount computed when paying differs (cycle change waiting for the next renewal, price or exchange rate), the call fails with `dedicated_renew_total_changed` and nothing is charged. |
| `periods` | integer | no | Number of cycles to pay in advance, added one after the other from the current renewal date (31 Oct → 30 Nov → 31 Dec). When sent, early payment is allowed at any time; the open invoice, if any, is paid first as the first cycle and no second invoice is issued for it. At most `billing.max_periods`: the total is capped at 24 REAL months of the cycle that will apply (a cycle change waiting for the next renewal counts). Not sent: one cycle, only in the last 14 days. |

Example:

```json
{
  "expect_renew_at": 1802192400,
  "periods": 3
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `renewal` | DedicatedRenewal | yes |  |
| `renewal.renew_at` | integer | yes | Next renewal date: the invoice for the next cycle is issued at this time (Unix time, seconds, UTC) |
| `renewal.price_vnd` | integer | yes | Locked price of one cycle in VND. It is the price of your subscription, not the catalog price. |
| `renewal.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle. |
| `renewal.cycle_months` | integer | yes | Months in one cycle (1, 3, 6, 12 or 24). |
| `renewal.auto_renew` | boolean | yes | When true the wallet is charged automatically on the renewal date if the balance is enough. |
| `renewal.status` | string: `ok`, `due_soon`, `unpaid`, `suspended` | yes | `ok`: nothing to do. `due_soon`: renews within 7 days. `unpaid`: an invoice is open and waiting for payment. `suspended`: the invoice was not paid before the end of the grace period and the subscription is read-only (the server keeps running). |
| `renewal.grace_until` | integer or null | yes | While `unpaid` or `suspended`: the end of the grace period after which an unpaid subscription is suspended; null otherwise (Unix time, seconds, UTC) |
| `renewal.invoice_id_open` | integer or null | yes | Identifier of the open renewal invoice (see Invoices); null when there is none |
| `renewal.amount_cents` | integer or null | yes | What paying now costs in US cents: the amount locked on the open invoice, otherwise the price of the next cycle at today's exchange rate. Null when the exchange rate is not available. |
| `renewal.balance_cents` | integer | yes | Your wallet balance in US cents. |
| `renewal.period_to` | integer | yes | The renewal date you will have after paying now (Unix time, seconds, UTC) |
| `renewal.can_pay` | boolean | yes | True when [Renew a Dedicated Server](#operation/dedicated_renew) can be called now: an invoice is open, or the renewal date is within the last 14 days. |
| `charged_cents` | integer | yes | US cents charged from the wallet by this call. |
| `invoice_id` | integer | yes | Identifier of the paid renewal invoice. |
| `resumed` | boolean | yes | True when the subscription was suspended and is active again. |
| `periods` | integer | yes | Cycles paid by this call. |
| `invoice_ids` | array of integer | yes |  |
| `billing` | DedicatedBilling | yes |  |
| `billing.free` | boolean | yes | True for a free subscription: there is nothing to renew, change or pay. |
| `billing.plan` | object or null | yes |  |
| `billing.plan.code` | string | yes | Plan code. |
| `billing.plan.name` | string | yes | Plan display name. |
| `billing.plan.spec` | any | yes | Plan hardware summary, as published in the public plan list. |
| `billing.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle of the current period. |
| `billing.cycle_months` | integer | yes | Months in one cycle. |
| `billing.price_vnd` | integer | yes | Locked price of the current cycle in VND. |
| `billing.next` | object | yes |  |
| `billing.next.plan_code` | string or null | yes | Plan that will apply at the next renewal. |
| `billing.next.cycle` | string | yes | Cycle that will apply at the next renewal; differs from `cycle` after [Change the billing cycle](#operation/dedicated_cycle) or an approved downgrade. |
| `billing.next.price_vnd` | integer | yes | Price of the next renewal in VND. |
| `billing.next.amount_cents` | integer or null | yes | What the next renewal costs in US cents at today's exchange rate. |
| `billing.next.scheduled_change` | boolean | yes | True when a cycle change or a downgrade is waiting for the next renewal. |
| `billing.cycles` | array of object | yes |  |
| `billing.cycles[].cycle` | string | yes | Cycle offered by the plan that applies at the next renewal. |
| `billing.cycles[].months` | integer | yes | Months in the cycle. |
| `billing.cycles[].price_vnd` | integer | yes | Price of one such cycle in VND. |
| `billing.cycles[].discount_pct` | number | yes | Discount against the monthly price, in percent. |
| `billing.anchor_day` | integer or null | yes | Day of the month on which renewals fall (1-31); a short month uses its last day. |
| `billing.renew_at` | integer or null | yes | Renewal date: the service is paid up to this time. (Unix time, seconds, UTC) |
| `billing.auto_renew` | boolean | yes | Whether the wallet is charged automatically at the renewal date. |
| `billing.status` | string: `active`, `suspended` | yes | Subscription state. |
| `billing.can_renew` | boolean | yes | True when [Renew a Dedicated Server](#operation/dedicated_renew) can be called at any time. |
| `billing.max_periods` | integer | yes | Largest `periods` accepted by one renewal: the total stays within 24 real months of the cycle that will apply at the next renewal. |
| `billing.debt` | object | yes |  |
| `billing.debt.unpaid` | boolean | yes | True when a renewal invoice is open. |
| `billing.debt.overdue` | boolean | yes | True when the open invoice is past its due date. |
| `billing.debt.suspended` | boolean | yes | True when the subscription is suspended for non-payment. |
| `billing.debt.amount_cents` | integer or null | yes | Amount of the open invoice in US cents. |
| `billing.debt.invoice_id` | integer or null | yes | Identifier of the open invoice. |
| `billing.debt.grace_until` | integer or null | yes | End of the grace period. (Unix time, seconds, UTC) |
| `billing.last_invoice` | DedicatedInvoice or null | yes |  |
| `billing.pending_cycle` | string or null | yes | Cycle waiting for the next renewal, if you asked for a change. |
| `billing.pending_plan` | object or null | yes |  |
| `billing.pending_plan.code` | string | yes | Plan code. |
| `billing.pending_plan.name` | string | yes | Plan display name. |
| `billing.plan_change` | DedicatedPlanChange or null | yes |  |
| `billing.balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "billing": {
    "anchor_day": 31,
    "auto_renew": true,
    "balance_cents": 100000,
    "can_renew": true,
    "cycle": "monthly",
    "cycle_months": 1,
    "cycles": [
      {
        "cycle": "monthly",
        "discount_pct": 0,
        "months": 1,
        "price_vnd": 2590000
      },
      {
        "cycle": "quarterly",
        "discount_pct": 5,
        "months": 3,
        "price_vnd": 7380000
      }
    ],
    "debt": {
      "amount_cents": null,
      "grace_until": null,
      "invoice_id": null,
      "overdue": false,
      "suspended": false,
      "unpaid": false
    },
    "free": false,
    "last_invoice": {
      "created_at": 1799514000,
      "currency": "usd",
      "description": "Dedicated Server dell-105 — Monthly renewal",
      "due_at": null,
      "id": 4411,
      "kind": "renewal",
      "number": "INV-2026-004411",
      "paid_at": 1799514000,
      "period_from": 1799514000,
      "period_to": 1802192400,
      "status": "paid",
      "total_cents": 99615
    },
    "max_periods": 24,
    "next": {
      "amount_cents": 99615,
      "cycle": "monthly",
      "plan_code": "DS-6138-64",
      "price_vnd": 2590000,
      "scheduled_change": false
    },
    "pending_cycle": null,
    "pending_plan": null,
    "plan": {
      "code": "DS-6138-64",
      "name": "Dedicated 6138 · 64 GB",
      "spec": {}
    },
    "plan_change": null,
    "price_vnd": 2590000,
    "renew_at": 1802192400,
    "status": "active"
  },
  "charged_cents": 28846,
  "invoice_id": 4411,
  "invoice_ids": [
    4411
  ],
  "periods": 1,
  "renewal": {
    "amount_cents": 28846,
    "auto_renew": true,
    "balance_cents": 100000,
    "can_pay": true,
    "cycle": "quarterly",
    "cycle_months": 3,
    "grace_until": null,
    "invoice_id_open": null,
    "period_to": 1810054800,
    "price_vnd": 7500000,
    "renew_at": 1802192400,
    "status": "due_soon"
  },
  "resumed": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object with an optional integer `expect_renew_at`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | The wallet balance is lower than the amount to pay; top up and try again (`need_cents` is the total of all cycles, `balance_cents` your balance before the call; nothing is charged). |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_renew_too_early` | `periods` was not sent, no invoice is open and the renewal date is more than 14 days away. |
| 409 | `dedicated_renew_stale` | The renewal date changed; reload and try again. |
| 409 | `dedicated_renew_total_changed` | `expect_total_cents` does not match the amount computed now; nothing was charged (`total_cents` is the new amount). |
| 409 | `dedicated_renew_in_progress` | The subscription was renewed a moment ago. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `dedicated_bad_periods` | `periods` is below 1 or makes the total exceed 24 months of the cycle that will apply (see `billing.max_periods`). |
| 422 | `dedicated_free_subscription` | The subscription is free of charge: there is nothing to renew. |
| 422 | `dedicated_no_price` | The subscription has no renewal price; contact support. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped); paying by hand is not possible while the lock lasts. The server keeps running. |
| 429 | `rate_limited` | Too many renew calls in the last minute. |
| 503 | `dedicated_fx_unavailable` | The exchange rate is not available right now; try again in a few minutes. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/renew" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"expect_renew_at":1802192400,"periods":3}'
```

---

#### Other plans you can ask for: price at the current cycle, difference and the estimated charge of an upgrade

`GET /v1/dedicated/{id}/plans`

Lists the other plans offered in the location of this server, priced for your current billing cycle, with the difference from your locked price and, for an upgrade, an estimate of what would be charged if the change were approved now (computed from what you have already paid for the current period, in proportion to the time left). A physical machine cannot change its hardware by itself, so a plan change is a request: see [Request a plan change](#operation/dedicated_plan_change).

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated plans`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `current` | object | yes |  |
| `current.plan` | object or null | yes |  |
| `current.plan.code` | string | yes | Plan code. |
| `current.plan.name` | string | yes | Plan display name. |
| `current.cycle` | string | yes | Current billing cycle. |
| `current.price_vnd` | integer | yes | Locked price of one cycle in VND. |
| `current.renew_at` | integer or null | yes | Renewal date. (Unix time, seconds, UTC) |
| `plans` | array of DedicatedPlanOption | yes |  |
| `plans[].code` | string | yes | Plan code to send to [Request a plan change](#operation/dedicated_plan_change). |
| `plans[].name` | string | yes | Plan display name. |
| `plans[].spec` | any | yes | Plan hardware summary. |
| `plans[].monthly_vnd` | integer | yes | Listed price per month in VND. |
| `plans[].price_vnd` | integer | yes | Price of one cycle of your current billing cycle in VND. |
| `plans[].diff_vnd` | integer | yes | Price of one cycle minus your current locked price, in VND (negative for a cheaper plan). |
| `plans[].kind` | string: `upgrade`, `downgrade` | yes | Direction of the change. |
| `plans[].quote` | object or null | yes |  |
| `plans[].quote.basis_vnd` | integer | yes | What you have already paid for the current period, in VND. The difference is computed from this, never from today's list price. |
| `plans[].quote.basis_source` | string | yes | `renewal`, `order` or `subscription`. |
| `plans[].quote.new_price_vnd` | integer | yes | Price of one cycle of the new plan in VND. |
| `plans[].quote.period_from` | integer | yes | Start of the paid period. (Unix time, seconds, UTC) |
| `plans[].quote.period_to` | integer | yes | End of the paid period. (Unix time, seconds, UTC) |
| `plans[].quote.remaining_secs` | integer | yes | Seconds left in the paid period. |
| `plans[].quote.charge_vnd` | integer | yes | Estimated difference if it were approved now, in VND. |
| `plans[].quote.charge_cents` | integer | yes | Estimated difference in US cents. |
| `plan_change` | DedicatedPlanChange or null | yes |  |

Example:

```json
{
  "current": {
    "cycle": "monthly",
    "plan": {
      "code": "DS-6138-64",
      "name": "Dedicated 6138 · 64 GB"
    },
    "price_vnd": 2590000,
    "renew_at": 1802192400
  },
  "plan_change": null,
  "plans": [
    {
      "code": "DS-6138-128",
      "diff_vnd": 400000,
      "kind": "upgrade",
      "monthly_vnd": 2990000,
      "name": "Dedicated 6138 · 128 GB",
      "price_vnd": 2990000,
      "quote": {
        "basis_source": "renewal",
        "basis_vnd": 2590000,
        "charge_cents": 7961,
        "charge_vnd": 207000,
        "new_price_vnd": 2990000,
        "period_from": 1799514000,
        "period_to": 1802192400,
        "remaining_secs": 1339200
      },
      "spec": {}
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 429 | `rate_limited` | Too many calls in the last minute. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/plans" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Invoices of a Dedicated Server (order, renewals, plan upgrades)

`GET /v1/dedicated/{id}/invoices`

Lists the invoices of this server that belong to you: the order receipt, the renewal invoices and the plan upgrade receipts, newest first (at most 100).

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated invoices`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of DedicatedInvoice | yes |  |
| `items[].id` | integer | yes | Invoice identifier. |
| `items[].number` | string or null | yes | Invoice number. |
| `items[].kind` | string | yes | `renewal`, `receipt` (order or plan upgrade). |
| `items[].status` | string | yes | `paid`, `unpaid`, `overdue`, `cancelled` or `refunded`. |
| `items[].total_cents` | integer | yes | Total in US cents. |
| `items[].currency` | string | yes | Invoice currency. |
| `items[].created_at` | integer | yes | When the invoice was created. (Unix time, seconds, UTC) |
| `items[].paid_at` | integer or null | yes | When it was paid. (Unix time, seconds, UTC) |
| `items[].due_at` | integer or null | yes | Payment due date. (Unix time, seconds, UTC) |
| `items[].description` | string or null | yes | First line of the invoice. |
| `items[].period_from` | integer or null | yes | Start of the covered period. (Unix time, seconds, UTC) |
| `items[].period_to` | integer or null | yes | End of the covered period. (Unix time, seconds, UTC) |

Example:

```json
{
  "items": [
    {
      "created_at": 1799514000,
      "currency": "usd",
      "description": "Dedicated Server dell-105 — Monthly renewal",
      "due_at": null,
      "id": 4411,
      "kind": "renewal",
      "number": "INV-2026-004411",
      "paid_at": 1799514000,
      "period_from": 1799514000,
      "period_to": 1802192400,
      "status": "paid",
      "total_cents": 99615
    }
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 429 | `rate_limited` | Too many calls in the last minute. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/invoices" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Change the billing cycle from the next renewal (nothing charged or refunded now)

`PATCH /v1/dedicated/{id}/cycle`

Changes the billing cycle from the NEXT renewal, at the price of that cycle in the plan's price list. Nothing is charged or refunded now and the current period is not touched. Sending the current cycle again cancels a change that was waiting. A free subscription, a subscription without a priced plan or a cycle the plan does not offer is refused. A suspended subscription must pay first.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated cycle`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | The cycle wanted from the next renewal. |
| `expect_renew_at` | integer | no | The `renew_at` you saw; the call fails with `dedicated_renew_stale` when it changed. (Unix time, seconds, UTC) |

Example:

```json
{
  "cycle": "quarterly"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `billing` | DedicatedBilling | yes |  |
| `billing.free` | boolean | yes | True for a free subscription: there is nothing to renew, change or pay. |
| `billing.plan` | object or null | yes |  |
| `billing.plan.code` | string | yes | Plan code. |
| `billing.plan.name` | string | yes | Plan display name. |
| `billing.plan.spec` | any | yes | Plan hardware summary, as published in the public plan list. |
| `billing.cycle` | string: `monthly`, `quarterly`, `semiannual`, `yearly`, `biennial` | yes | Billing cycle of the current period. |
| `billing.cycle_months` | integer | yes | Months in one cycle. |
| `billing.price_vnd` | integer | yes | Locked price of the current cycle in VND. |
| `billing.next` | object | yes |  |
| `billing.next.plan_code` | string or null | yes | Plan that will apply at the next renewal. |
| `billing.next.cycle` | string | yes | Cycle that will apply at the next renewal; differs from `cycle` after [Change the billing cycle](#operation/dedicated_cycle) or an approved downgrade. |
| `billing.next.price_vnd` | integer | yes | Price of the next renewal in VND. |
| `billing.next.amount_cents` | integer or null | yes | What the next renewal costs in US cents at today's exchange rate. |
| `billing.next.scheduled_change` | boolean | yes | True when a cycle change or a downgrade is waiting for the next renewal. |
| `billing.cycles` | array of object | yes |  |
| `billing.cycles[].cycle` | string | yes | Cycle offered by the plan that applies at the next renewal. |
| `billing.cycles[].months` | integer | yes | Months in the cycle. |
| `billing.cycles[].price_vnd` | integer | yes | Price of one such cycle in VND. |
| `billing.cycles[].discount_pct` | number | yes | Discount against the monthly price, in percent. |
| `billing.anchor_day` | integer or null | yes | Day of the month on which renewals fall (1-31); a short month uses its last day. |
| `billing.renew_at` | integer or null | yes | Renewal date: the service is paid up to this time. (Unix time, seconds, UTC) |
| `billing.auto_renew` | boolean | yes | Whether the wallet is charged automatically at the renewal date. |
| `billing.status` | string: `active`, `suspended` | yes | Subscription state. |
| `billing.can_renew` | boolean | yes | True when [Renew a Dedicated Server](#operation/dedicated_renew) can be called at any time. |
| `billing.max_periods` | integer | yes | Largest `periods` accepted by one renewal: the total stays within 24 real months of the cycle that will apply at the next renewal. |
| `billing.debt` | object | yes |  |
| `billing.debt.unpaid` | boolean | yes | True when a renewal invoice is open. |
| `billing.debt.overdue` | boolean | yes | True when the open invoice is past its due date. |
| `billing.debt.suspended` | boolean | yes | True when the subscription is suspended for non-payment. |
| `billing.debt.amount_cents` | integer or null | yes | Amount of the open invoice in US cents. |
| `billing.debt.invoice_id` | integer or null | yes | Identifier of the open invoice. |
| `billing.debt.grace_until` | integer or null | yes | End of the grace period. (Unix time, seconds, UTC) |
| `billing.last_invoice` | DedicatedInvoice or null | yes |  |
| `billing.pending_cycle` | string or null | yes | Cycle waiting for the next renewal, if you asked for a change. |
| `billing.pending_plan` | object or null | yes |  |
| `billing.pending_plan.code` | string | yes | Plan code. |
| `billing.pending_plan.name` | string | yes | Plan display name. |
| `billing.plan_change` | DedicatedPlanChange or null | yes |  |
| `billing.balance_cents` | integer | yes | Your wallet balance in US cents. |

Example:

```json
{
  "billing": {
    "anchor_day": 31,
    "auto_renew": true,
    "balance_cents": 100000,
    "can_renew": true,
    "cycle": "monthly",
    "cycle_months": 1,
    "cycles": [
      {
        "cycle": "monthly",
        "discount_pct": 0,
        "months": 1,
        "price_vnd": 2590000
      },
      {
        "cycle": "quarterly",
        "discount_pct": 5,
        "months": 3,
        "price_vnd": 7380000
      }
    ],
    "debt": {
      "amount_cents": null,
      "grace_until": null,
      "invoice_id": null,
      "overdue": false,
      "suspended": false,
      "unpaid": false
    },
    "free": false,
    "last_invoice": {
      "created_at": 1799514000,
      "currency": "usd",
      "description": "Dedicated Server dell-105 — Monthly renewal",
      "due_at": null,
      "id": 4411,
      "kind": "renewal",
      "number": "INV-2026-004411",
      "paid_at": 1799514000,
      "period_from": 1799514000,
      "period_to": 1802192400,
      "status": "paid",
      "total_cents": 99615
    },
    "max_periods": 24,
    "next": {
      "amount_cents": 99615,
      "cycle": "monthly",
      "plan_code": "DS-6138-64",
      "price_vnd": 2590000,
      "scheduled_change": false
    },
    "pending_cycle": null,
    "pending_plan": null,
    "plan": {
      "code": "DS-6138-64",
      "name": "Dedicated 6138 · 64 GB",
      "spec": {}
    },
    "plan_change": null,
    "price_vnd": 2590000,
    "renew_at": 1802192400,
    "status": "active"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body must be `{"cycle": ...}` with an optional integer `expect_renew_at`. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_renew_stale` | The renewal date changed; reload and try again. |
| 422 | `dedicated_free_subscription` | The subscription is free of charge. |
| 422 | `dedicated_cycle_unavailable` | The plan's price list does not offer this cycle. |
| 422 | `cycle_unavailable` | The operator has switched this billing cycle off for this service, so a NEW order (or a change TO that cycle) is refused before anything is charged. The error carries `service`, `cycle` and `available` (the cycles still sold). Services already running on that cycle keep billing and renewing as before. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped). |
| 423 | `dedicated_suspended` | The subscription is suspended; pay the open invoice first. |
| 429 | `rate_limited` | Too many calls in the last minute. |

**Example request**

```bash
curl -X PATCH "https://api.onie.net/v1/dedicated/<id>/cycle" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cycle":"quarterly"}'
```

---

#### Request a Dedicated Server plan change (nothing charged; approved by the operator once the hardware is ready)

`POST /v1/dedicated/{id}/plan-change`

Asks for another plan. A physical machine cannot change its hardware by itself, so this only records a request and tells the operator; NOTHING is charged. When the hardware has been upgraded or the service moved, the operator approves it: an upgrade then charges the difference in proportion to the time left in the period you already paid for (never more than the list price difference, and based on what you actually paid) and switches the plan at once, with the new price from the next renewal; a downgrade charges and refunds nothing and applies from the next renewal. A declined or cancelled request costs nothing. One pending request per server. At most 10 calls per minute per account.

**Required scope:** `dedicated:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:write` | CLI: `dedicated plan change` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `plan_code` | string | yes | Plan code from [List the plans you can switch to](#operation/dedicated_plans). |
| `note` | string | no | Optional message for the operator, up to 500 characters. |

Example:

```json
{
  "plan_code": "DS-6138-128"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `plan_change` | DedicatedPlanChange | yes |  |
| `plan_change.id` | integer | yes | Request identifier. |
| `plan_change.from_plan` | object or null | yes |  |
| `plan_change.from_plan.code` | string | yes | Plan code. |
| `plan_change.from_plan.name` | string | yes | Plan display name. |
| `plan_change.to_plan` | object | yes |  |
| `plan_change.to_plan.code` | string | yes | Plan code. |
| `plan_change.to_plan.name` | string | yes | Plan display name. |
| `plan_change.kind` | string: `upgrade`, `downgrade` | yes | Upgrade or downgrade, by the listed monthly price of the plans. |
| `plan_change.status` | string: `pending`, `approved`, `rejected`, `cancelled` | yes | Request state. Nothing is charged until it is approved. |
| `plan_change.note` | string or null | yes | Your note, or the administrator's. |
| `plan_change.reason` | string or null | yes | Why the request was declined. |
| `plan_change.requested_at` | integer | yes | When you asked. (Unix time, seconds, UTC) |
| `plan_change.decided_at` | integer or null | yes | When it was approved, declined or cancelled. (Unix time, seconds, UTC) |
| `plan_change.effective` | string or null: `now`, `next_period` | yes | When an approved change applies: an upgrade at once, a downgrade at the next renewal. |
| `plan_change.charged_vnd` | integer or null | yes | Difference charged for an upgrade, in VND. |
| `plan_change.charged_cents` | integer or null | yes | Difference charged for an upgrade, in US cents. |
| `plan_change.invoice_id` | integer or null | yes | Invoice of the charged difference. |

Example:

```json
{
  "plan_change": {
    "charged_cents": null,
    "charged_vnd": null,
    "decided_at": null,
    "effective": null,
    "from_plan": {
      "code": "DS-6138-64",
      "name": "Dedicated 6138 · 64 GB"
    },
    "id": 7,
    "invoice_id": null,
    "kind": "upgrade",
    "note": null,
    "reason": null,
    "requested_at": 1799514000,
    "status": "pending",
    "to_plan": {
      "code": "DS-6138-128",
      "name": "Dedicated 6138 · 128 GB"
    }
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body must contain `plan_code` and an optional `note`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_plan_change_pending` | A request is already waiting; cancel it first. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `dedicated_plan_unavailable` | The plan is not on sale here, is your current plan or does not offer your current cycle. |
| 422 | `dedicated_free_subscription` | The subscription is free of charge. |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different body. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped). |
| 423 | `dedicated_suspended` | The subscription is suspended; pay the open invoice first. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/plan-change" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"plan_code":"DS-6138-128"}'
```

---

#### Cancel the pending plan change request

`DELETE /v1/dedicated/{id}/plan-change`

Cancels your pending plan change request. Nothing was charged, so nothing is refunded.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated plan change delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `cancelled` | boolean | yes | Always true. |

Example:

```json
{
  "cancelled": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server is not yours or there is no pending request. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped). |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/dedicated/<id>/plan-change" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Reinstall the OS of a Dedicated Server (erases the disks, asynchronous, returns an op)

`POST /v1/dedicated/{id}/reinstall`

Reinstalls the operating system from an automatic template ([List OS templates](#operation/dedicated_os_templates)). **Every disk partition is erased.** The call answers `202` with an `op` (Linux 15–25 minutes, Windows about 60 minutes); poll [Get an operation](#operation/dedicated_op). Set `confirm_hostname` to the same value as `hostname`. When the operation is done a new password for the OS account is shown once on the server page of the web panel. At most 3 reinstalls per hour for a server.

**Required scope:** `dedicated:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:destroy` | CLI: `dedicated reinstall` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `template` | string | yes | Template slug, e.g. `ubuntu-24.04`. |
| `hostname` | string | yes | New hostname: 1–63 characters a-z 0-9 and hyphen (Windows at most 15, not all digits). |
| `confirm_hostname` | string | yes | Type the hostname again to confirm that the disks will be erased. |

Example:

```json
{
  "confirm_hostname": "web-01",
  "hostname": "web-01",
  "template": "ubuntu-24.04"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | DedicatedOp | yes |  |
| `op.id` | integer | yes | Operation identifier. |
| `op.kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `op.action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `op.state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `op.step` | string | yes | Short name of the step being worked on. Informational. |
| `op.result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `op.public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `op.requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `op.created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `op.finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |

Example:

```json
{
  "op": {
    "action": "reboot",
    "created_at": 1792427000,
    "finished_at": null,
    "id": 881,
    "kind": "power",
    "public_error": null,
    "requested_by": "you",
    "result": null,
    "state": "queued",
    "step": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not valid JSON or has unknown fields. |
| 400 | `confirm_mismatch` | `confirm_hostname` does not match `hostname`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `not_supported` | Automatic reinstall is not available for this server. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | The template is unknown or disabled, the hostname is not valid, or the template is Debian and the server does not boot in UEFI mode. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | Too many reinstalls for this server in the last hour. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/reinstall" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm_hostname":"web-01","hostname":"web-01","template":"ubuntu-24.04"}'
```

---

#### Change the OS root/Administrator password through the platform agent inside the server (asynchronous: poll GET os-password/:cid; offline agent ⇒ 409)

`POST /v1/dedicated/{id}/os-password`

Changes the password of the operating-system account (`root` on Linux, `Administrator` on Windows) through the platform agent running inside the server. The call answers `202` with a `change`; poll [Get a password change](#operation/dedicated_os_password_get) until `state` is `applied`, `failed`, `unconfirmed` or `cancelled`. The password is sent encrypted to that one agent and is never returned or logged; after `applied` it is the password shown in Credentials. The agent must be `online` (see `agent` in [Get a server](#operation/dedicated_get)). A change that was not confirmed in 5 minutes becomes `unconfirmed`: submit it again. At most 5 requests per 10 minutes per account. Not available while an operation is running or when the subscription is suspended.

**Required scope:** `dedicated:console`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:console` | CLI: `dedicated os password` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `password` | string | yes | New password. Linux: 10-64 characters, at least 2 of upper/lower/digit/symbol. Windows: 12-64 characters, at least 3 of 4, not containing `Administrator`. Allowed: letters, digits and ! @ # % ^ * ( ) - _ = + [ ] { } . , : ; ? ~ |

Example:

```json
{
  "password": "Tr0ng-Matkhau#2026"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `change` | DedicatedPwChange | yes |  |
| `change.id` | string | yes | Identifier of the password change. |
| `change.state` | string: `pending`, `applied`, `failed`, `unconfirmed`, `cancelled` | yes | `pending` while the agent has not answered; `applied` when the agent confirmed (the new password is then the one shown in Credentials); `failed` when the agent refused (see `code`); `unconfirmed` when no answer came in time (the password may or may not have changed - submit it again); `cancelled` when the server was reinstalled, transferred or the request was replaced. |
| `change.code` | string or null | yes | Short reason when `failed`/`cancelled`, e.g. `policy`, `chpasswd_failed`, `stale`. |
| `change.created_at` | integer | yes | When the change was requested (Unix time, seconds, UTC) |
| `change.expires_at` | integer | yes | When the request stops being delivered (Unix time, seconds, UTC) |
| `change.done_at` | integer or null | yes | When the state became final (Unix time, seconds, UTC) |

Example:

```json
{
  "change": {
    "code": null,
    "created_at": 1792426591,
    "done_at": null,
    "expires_at": 1792426891,
    "id": "pw_k3j9x0a1b2c3d4e5",
    "state": "pending"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not valid JSON or has unknown fields. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_agent_missing` | No platform agent is registered for this server. |
| 409 | `dedicated_agent_offline` | The agent did not report in the last minute. |
| 409 | `dedicated_agent_outdated` | The agent is too old to change passwords. |
| 409 | `dedicated_agent_unsupported` | The operating system is not supported for this feature. |
| 409 | `dedicated_busy` | An operation is running on the server. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `dedicated_password_invalid` | The password does not meet the requirements (`reason`: `too_short`, `too_long`, `bad_char`, `weak`, `contains_user`). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_suspended` | The subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/os-password" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"password":"Tr0ng-Matkhau#2026"}'
```

---

#### State of one OS password change (pending/applied/failed/unconfirmed/cancelled)

`GET /v1/dedicated/{id}/os-password/{cid}`

Returns one password change of the server so you can poll it. It never contains the password.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated os password get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |
| `cid` | string | yes | Identifier of the resource. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `change` | DedicatedPwChange | yes |  |
| `change.id` | string | yes | Identifier of the password change. |
| `change.state` | string: `pending`, `applied`, `failed`, `unconfirmed`, `cancelled` | yes | `pending` while the agent has not answered; `applied` when the agent confirmed (the new password is then the one shown in Credentials); `failed` when the agent refused (see `code`); `unconfirmed` when no answer came in time (the password may or may not have changed - submit it again); `cancelled` when the server was reinstalled, transferred or the request was replaced. |
| `change.code` | string or null | yes | Short reason when `failed`/`cancelled`, e.g. `policy`, `chpasswd_failed`, `stale`. |
| `change.created_at` | integer | yes | When the change was requested (Unix time, seconds, UTC) |
| `change.expires_at` | integer | yes | When the request stops being delivered (Unix time, seconds, UTC) |
| `change.done_at` | integer or null | yes | When the state became final (Unix time, seconds, UTC) |

Example:

```json
{
  "change": {
    "code": null,
    "created_at": 1792426591,
    "done_at": 1792426600,
    "expires_at": 1792426891,
    "id": "pw_k3j9x0a1b2c3d4e5",
    "state": "applied"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server or the change does not exist, or it belongs to another server. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/os-password/<cid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get the one-line install/uninstall command of the platform agent for a server whose OS was installed earlier (opens a 60-minute enrolment window, one-time token)

`POST /v1/dedicated/{id}/agent/install`

For a server whose operating system was installed before the agent existed (or from your own ISO): opens a 60-minute enrolment window and returns a one-line command to install the platform agent, plus the uninstall command. The token inside `install` works once, only from this server's public IP and only inside the window. The agent reports processor, memory, system disk usage, total network traffic and its version - nothing about the connections of your applications. Keep the command private until you have used it.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated agent install`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `os` | string: `linux`, `windows` | yes | Operating system the command is for. |
| `install` | string | yes | Command to run as root/Administrator on the server. |
| `uninstall` | string | yes | Command that removes the agent from the server. |
| `expires_at` | integer | yes | When the token expires (Unix time, seconds, UTC) |

Example:

```json
{
  "expires_at": 1792430191,
  "install": "curl -4fsSL https://panel.example.com/install-bm.sh | sudo AGENT_TOKEN=<token> sh",
  "os": "linux",
  "uninstall": "curl -4fsSL https://panel.example.com/install-bm.sh | sudo sh -s -- --uninstall"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_agent_unsupported` | The operating system is not supported for the agent yet. |
| 409 | `dedicated_busy` | An operation is running on the server. |
| 423 | `dedicated_suspended` | The subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/agent/install" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Remove the platform agent from the platform (revokes its key, cancels a pending password change)

`DELETE /v1/dedicated/{id}/agent`

Removes the platform agent of the server from the platform: its key stops working and a pending password change is cancelled. Run the uninstall command on the server too if you want to delete the program.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated agent remove` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always true. |

Example:

```json
{
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/dedicated/<id>/agent" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Power on/off/reboot a Dedicated Server (asynchronous, returns an op)

`POST /v1/dedicated/{id}/power`

Changes the power state of the machine: `on`, `off` (immediate power cut), `shutdown` (ask the operating system to shut down), `reboot` (ask the operating system to restart) or `reset` (immediate hard restart). The call answers `202` with an `op` and the machine follows in the background; poll [Get an operation](#operation/dedicated_op). Every action except `on` needs `confirm` set to the exact name of the server. Asking for the state the machine is already in fails with `409 dedicated_power_noop`. At most 6 power commands per minute are accepted for an account (`429 rate_limited`).

**Required scope:** `dedicated:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:write` | CLI: `dedicated power` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `action` | string: `on`, `off`, `shutdown`, `reboot`, `reset` | yes | What to do. |
| `confirm` | string | no | The exact name of the server. Required for every action except `on`. |

Example:

```json
{
  "action": "reboot",
  "confirm": "dell-105"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | DedicatedOp | yes |  |
| `op.id` | integer | yes | Operation identifier. |
| `op.kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `op.action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `op.state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `op.step` | string | yes | Short name of the step being worked on. Informational. |
| `op.result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `op.public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `op.requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `op.created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `op.finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |

Example:

```json
{
  "op": {
    "action": "reboot",
    "created_at": 1792427000,
    "finished_at": null,
    "id": 881,
    "kind": "power",
    "public_error": null,
    "requested_by": "you",
    "result": null,
    "state": "queued",
    "step": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `action` is missing or not valid. |
| 400 | `confirm_mismatch` | `confirm` does not match the name of the server. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_power_noop` | The machine is already in the requested power state. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | Too many power commands in the last minute. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/power" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"action":"reboot","confirm":"dell-105"}'
```

---

#### Operation history of a Dedicated Server

`GET /v1/dedicated/{id}/ops`

Lists the operations (power commands and console requests) on a server since it was assigned to you, newest first by default.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated ops`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of DedicatedOp | yes |  |
| `items[].id` | integer | yes | Operation identifier. |
| `items[].kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `items[].action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `items[].state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `items[].step` | string | yes | Short name of the step being worked on. Informational. |
| `items[].result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `items[].public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `items[].requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `items[].created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `items[].finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "action": "reboot",
      "created_at": 1792427000,
      "finished_at": 1792427060,
      "id": 881,
      "kind": "power",
      "public_error": null,
      "requested_by": "you",
      "result": "ok",
      "state": "done",
      "step": "done"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/ops" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get one operation (poll its progress)

`GET /v1/dedicated/{id}/ops/{op}`

Returns one operation of the server. Poll it after a power command until `state` is `done`, `failed` or `cancelled`.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated op`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |
| `op` | string | yes | Operation identifier as returned by a power command or List operations. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | DedicatedOp | yes |  |
| `op.id` | integer | yes | Operation identifier. |
| `op.kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `op.action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `op.state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `op.step` | string | yes | Short name of the step being worked on. Informational. |
| `op.result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `op.public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `op.requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `op.created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `op.finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |

Example:

```json
{
  "op": {
    "action": "reboot",
    "created_at": 1792427000,
    "finished_at": 1792427060,
    "id": 881,
    "kind": "power",
    "public_error": null,
    "requested_by": "you",
    "result": "ok",
    "state": "done",
    "step": "done"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server or the operation does not exist, or the operation belongs to another server. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/ops/<op>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Power, temperatures, fans, PSUs, CPU/memory/I-O usage, current network rate (+ 24h/7d series)

`GET /v1/dedicated/{id}/sensors`

Returns the last sensor reading: power draw, temperatures, fan speeds and power supplies, plus the processor, memory and input/output usage (`usage`), the current network rate and monthly total (`network`) and the drive capacity (`storage`). A number that cannot be measured is `null` with a `reason`, never 0. With `range` it also returns a time series (`24h` every 2 minutes, `7d` every 30 minutes). `stale` is true when the reading may be outdated.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated sensors`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `24h`, `7d` | no | Include a time series covering this period. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `at` | integer or null | yes | When the sensors were last read (Unix time, seconds, UTC) |
| `stale` | boolean | yes | True when the reading may be outdated. |
| `health` | string or null | yes | Overall hardware health. |
| `power` | object or null | yes |  |
| `power.watts` | integer or null | yes | Current power draw in watts. |
| `power.avg` | integer or null | yes | Average over the last minute. |
| `power.min` | integer or null | yes | Minimum over the last minute. |
| `power.max` | integer or null | yes | Maximum over the last minute. |
| `power.capacity` | integer or null | yes | Power capacity in watts. |
| `temps` | array of object | yes |  |
| `temps[].name` | string | yes | Sensor name, e.g. `Inlet Temp`. |
| `temps[].c` | integer | yes | Temperature in degrees Celsius. |
| `temps[].health` | string or null | yes | Health. |
| `fans` | array of object | yes |  |
| `fans[].name` | string | yes | Fan name. |
| `fans[].rpm` | integer | yes | Speed in revolutions per minute. |
| `fans[].health` | string or null | yes | Health. |
| `psus` | array of object | yes |  |
| `psus[].name` | string | yes | Power supply name. |
| `psus[].health` | string or null | yes | Health. |
| `psus[].input_v` | integer or null | yes | Input voltage. |
| `usage` | object | yes |  |
| `usage.cpu` | integer or null | yes | Processor usage in percent (0–100). |
| `usage.mem` | integer or null | yes | Memory usage in percent (0–100), as reported by the machine's controller. |
| `usage.io` | integer or null | yes | Input/output usage in percent (0–100). |
| `usage.agent` | object | no |  |
| `usage.agent.mem` | integer or null | yes | Memory usage in percent measured inside the operating system by the platform agent. |
| `usage.agent.disk` | integer or null | yes | System disk usage in percent measured inside the operating system by the platform agent. |
| `usage.agent.at` | integer | yes | When the agent measured it (Unix time, seconds, UTC) |
| `usage.at` | integer or null | yes | When the usage was measured (Unix time, seconds, UTC) |
| `usage.reason` | string or null | yes | Why the numbers are `null`: `unreachable`, `powered_off`, `no_data` (not measured yet) or `unsupported`. |
| `network` | object | yes |  |
| `network.in_bps` | integer or null | yes | Current traffic received by the server, in bits per second (average of the last 5 minutes). |
| `network.out_bps` | integer or null | yes | Current traffic sent by the server, in bits per second (average of the last 5 minutes). |
| `network.at` | integer or null | yes | Start of the 5-minute interval the rate comes from (Unix time, seconds, UTC) |
| `network.month` | object | yes |  |
| `network.month.month` | string | yes | Month of the total, `YYYY-MM`. |
| `network.month.in_bytes` | integer | yes | Bytes received in the month. |
| `network.month.out_bytes` | integer | yes | Bytes sent in the month. |
| `network.reason` | string or null | yes | `no_data` when no recent measurement exists; the rates are then `null`. |
| `storage` | object | yes |  |
| `storage.total_bytes` | integer or null | yes | Total capacity of the drives in bytes. |
| `storage.drives` | integer or null | yes | Number of drives. |
| `series` | object | no |  |
| `series.step` | integer | yes | Seconds between points. |
| `series.points` | array of object | yes |  |
| `series.points[].t` | integer | yes | Start of the point (Unix time, seconds, UTC) |
| `series.points[].watts` | integer or null | yes | Average power draw in watts. |
| `series.points[].inlet_c` | integer or null | yes | Average inlet temperature in degrees Celsius. |
| `series.points[].cpu_max_c` | integer or null | yes | Average hottest processor temperature in degrees Celsius. |
| `series.points[].cpu_pct` | integer or null | yes | Average processor usage in percent. |
| `series.points[].mem_pct` | integer or null | yes | Average memory usage in percent. |
| `series.points[].io_pct` | integer or null | yes | Average input/output usage in percent. |

Example:

```json
{
  "at": 1792426591,
  "fans": [
    {
      "health": "OK",
      "name": "Fan1A",
      "rpm": 15394
    }
  ],
  "health": "OK",
  "network": {
    "at": 1792426500,
    "in_bps": 52000,
    "month": {
      "in_bytes": 23016451,
      "month": "2026-10",
      "out_bytes": 520
    },
    "out_bps": 1200000,
    "reason": null
  },
  "power": {
    "avg": 64,
    "capacity": 483,
    "max": 89,
    "min": 61,
    "watts": 64
  },
  "psus": [
    {
      "health": "OK",
      "input_v": 220,
      "name": "PS1"
    }
  ],
  "series": {
    "points": [
      {
        "cpu_max_c": 30,
        "cpu_pct": 9,
        "inlet_c": 25,
        "io_pct": 0,
        "mem_pct": 30,
        "t": 1792420000,
        "watts": 63
      }
    ],
    "step": 120
  },
  "stale": false,
  "storage": {
    "drives": 2,
    "total_bytes": 1024209543168
  },
  "temps": [
    {
      "c": 25,
      "health": "OK",
      "name": "Inlet Temp"
    }
  ],
  "usage": {
    "at": 1792426591,
    "cpu": 10,
    "io": 0,
    "mem": 30,
    "reason": null
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `range` is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/sensors" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Hardware log (SEL) of a Dedicated Server

`GET /v1/dedicated/{id}/events`

Returns the hardware log of the machine (the most recent 50 entries) from the moment it was assigned to you. Times are corrected for the clock of the machine's controller; `at_raw` keeps the original text.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `severity` | string: `all`, `warning`, `critical` | no | Only entries of this severity. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].at` | integer | yes | When the event happened, corrected (Unix time, seconds, UTC) |
| `items[].at_raw` | string | yes | Original time text as written by the machine. |
| `items[].severity` | string | yes | `OK`, `Warning` or `Critical`. |
| `items[].message` | string | yes | Description of the event. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `clock_adjusted` | boolean | yes | True when the times were corrected for a clock offset. |

Example:

```json
{
  "clock_adjusted": true,
  "items": [
    {
      "at": 1792368487,
      "at_raw": "2026-10-13T23:08:07-05:00",
      "message": "C: boot completed.",
      "severity": "OK"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Inbound/outbound bandwidth of a Dedicated Server (series + monthly total)

`GET /v1/dedicated/{id}/bandwidth`

Returns the traffic of the server's public IP address: a chart for `range` and the total of a month. `in_bytes` is traffic received by your server, `out_bytes` traffic it sent. `stale` is true when the counters have not been refreshed recently.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated bandwidth`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `range` | string: `24h`, `7d`, `30d` | no | Period of the chart. |
| `month` | string | no | Month for the total, `YYYY-MM`. Defaults to the current month. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ip` | string or null | yes | The public IP address measured. |
| `month` | object | yes |  |
| `month.month` | string | yes | Month of the total, `YYYY-MM`. |
| `month.in_bytes` | integer | yes | Bytes received in the month. |
| `month.out_bytes` | integer | yes | Bytes sent in the month. |
| `range` | string | yes | Period of the chart. |
| `step` | integer | yes | Seconds covered by each point. |
| `series` | array of object | yes |  |
| `series[].t` | integer | yes | Start of the interval (Unix time, seconds, UTC) |
| `series[].in_bytes` | integer | yes | Bytes received. |
| `series[].out_bytes` | integer | yes | Bytes sent. |
| `source_at` | integer or null | yes | When the counters were last refreshed (Unix time, seconds, UTC) |
| `stale` | boolean | yes | True when the counters may be outdated. |

Example:

```json
{
  "ip": "23.132.252.247",
  "month": {
    "in_bytes": 23016451,
    "month": "2026-10",
    "out_bytes": 520
  },
  "range": "24h",
  "series": [
    {
      "in_bytes": 1200,
      "out_bytes": 40,
      "t": 1792425000
    }
  ],
  "source_at": 1792426591,
  "stale": false,
  "step": 300
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/bandwidth" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Activity log of a Dedicated Server

`GET /v1/dedicated/{id}/activity`

Lists what happened on the server since it was assigned to you: power commands, console requests, renames and status changes, newest first by default.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated activity`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | integer | yes | Entry identifier. |
| `items[].at` | integer | yes | When it happened (Unix time, seconds, UTC) |
| `items[].kind` | string | yes | Event kind, e.g. `power.reboot.done`. |
| `items[].actor` | string: `you`, `admin`, `system` | yes | Who caused it. |
| `items[].message` | string | yes | Short description in English. |
| `items[].key` | string or null | yes | Stable message code (for example `ded.renamed`); `null` for entries written before message codes existed. With `args` it lets you show the message in your own language. |
| `items[].args` | object | yes | Raw values to fill into the message named by `key` (string values). An empty object when `key` is `null`. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "actor": "you",
      "args": {
        "result": "ok",
        "what": "power.reboot"
      },
      "at": 1792427060,
      "id": 12,
      "key": "ded.op_done",
      "kind": "power.reboot.done",
      "message": "Operation completed: power.reboot (ok)"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/activity" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### The server's custom ISO: state, progress, expiry and which actions are available

`GET /v1/dedicated/{id}/iso`

Returns your custom ISO for this server (null when there is none), the limits and which actions are available now. Poll this call while `state` is `queued`, `downloading`, `verifying`, `attaching` or `detaching`. The internal address the controller uses to read the image is never shown.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated iso get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `iso` | DedicatedIso or null | yes |  |
| `limits` | object | yes |  |
| `limits.max_bytes` | integer | yes | Largest ISO accepted, in bytes. |
| `limits.ttl_hours` | integer | yes | Hours an ISO is kept after it is ready, then it is removed automatically. |
| `limits.ports` | array of integer | yes |  |
| `limits.schemes` | array of string | yes |  |
| `actions` | object | yes |  |
| `actions.download` | object | yes |  |
| `actions.download.allowed` | boolean | yes | Whether the action can be started now. |
| `actions.download.reason` | string or null: `dedicated_ops_disabled`, `dedicated_server_locked`, `dedicated_suspended`, `dedicated_busy`, `dedicated_bmc_unavailable`, `not_supported`, `iso_exists`, `iso_none`, `iso_not_ready`, `iso_not_attached`, `iso_busy`, `iso_disabled` | yes | Why the action is unavailable, in priority order; null when it is allowed. |
| `actions.download.message` | string or null | yes | The reason as a sentence in your account language; null when downloading is allowed. |
| `actions.attach` | object | yes |  |
| `actions.attach.allowed` | boolean | yes | Whether the action can be started now. |
| `actions.attach.reason` | string or null: `dedicated_ops_disabled`, `dedicated_server_locked`, `dedicated_suspended`, `dedicated_busy`, `dedicated_bmc_unavailable`, `not_supported`, `iso_exists`, `iso_none`, `iso_not_ready`, `iso_not_attached`, `iso_busy`, `iso_disabled` | yes | Why the action is unavailable, in priority order; null when it is allowed. |
| `actions.attach.message` | string or null | yes | The reason as a sentence in your account language; null when attaching is allowed. |
| `actions.detach` | object | yes |  |
| `actions.detach.allowed` | boolean | yes | Whether the action can be started now. |
| `actions.detach.reason` | string or null: `dedicated_ops_disabled`, `dedicated_server_locked`, `dedicated_suspended`, `dedicated_busy`, `dedicated_bmc_unavailable`, `not_supported`, `iso_exists`, `iso_none`, `iso_not_ready`, `iso_not_attached`, `iso_busy`, `iso_disabled` | yes | Why the action is unavailable, in priority order; null when it is allowed. |
| `actions.detach.message` | string or null | yes | The reason as a sentence in your account language; null when detaching is allowed. |
| `actions.delete` | object | yes |  |
| `actions.delete.allowed` | boolean | yes | Whether the action can be started now. |
| `actions.delete.reason` | string or null: `dedicated_ops_disabled`, `dedicated_server_locked`, `dedicated_suspended`, `dedicated_busy`, `dedicated_bmc_unavailable`, `not_supported`, `iso_exists`, `iso_none`, `iso_not_ready`, `iso_not_attached`, `iso_busy`, `iso_disabled` | yes | Why the action is unavailable, in priority order; null when it is allowed. |
| `actions.delete.message` | string or null | yes | The reason as a sentence in your account language; null when deleting is allowed. |

Example:

```json
{
  "actions": {
    "attach": {
      "allowed": false,
      "message": "The ISO is not ready to attach",
      "reason": "iso_not_ready"
    },
    "delete": {
      "allowed": true,
      "message": null,
      "reason": null
    },
    "detach": {
      "allowed": false,
      "message": "The ISO is not attached to the server",
      "reason": "iso_not_attached"
    },
    "download": {
      "allowed": false,
      "message": "This server already has an ISO — delete it before downloading another",
      "reason": "iso_exists"
    }
  },
  "iso": {
    "attached_at": null,
    "bytes_done": 800000000,
    "bytes_total": 2000000000,
    "created_at": 1792427000,
    "error": null,
    "expires_at": null,
    "expires_in": null,
    "file_name": "ubuntu-24.04.1-live-server-amd64.iso",
    "id": "iso_5c0a9d3e7b1f4a28",
    "kind": null,
    "percent": 40,
    "ready_at": null,
    "sha256": null,
    "state": "downloading",
    "url": "https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"
  },
  "limits": {
    "max_bytes": 10737418240,
    "ports": [
      80,
      443,
      8080,
      8443
    ],
    "schemes": [
      "http",
      "https"
    ],
    "ttl_hours": 24
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter was given; this call takes none. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/iso" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Download an ISO from an http(s) URL into the server's temporary storage (asynchronous)

`POST /v1/dedicated/{id}/iso`

Downloads an ISO from a public `http` or `https` address into temporary storage for this server. The call answers `202` and the download runs in the background: poll [Get the ISO](#operation/dedicated_iso_get). Only ports 80, 443, 8080 and 8443 are accepted, the address must not contain a user name or password, and it must resolve to a public Internet address — private, loopback, link-local and other internal addresses are refused, also after each redirect (at most 3 redirects are followed). Size is limited (see `limits.max_bytes`) and the file must be a valid ISO 9660 or disk image. One ISO per server at a time (`409 iso_exists`); it is removed automatically `limits.ttl_hours` hours after it is ready. At most 5 downloads per hour are accepted for an account (`429 rate_limited`).

**Required scope:** `dedicated:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:write` | CLI: `dedicated iso download` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | Public `http://` or `https://` address of the ISO file. |

Example:

```json
{
  "url": "https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `iso` | DedicatedIso | yes |  |
| `iso.id` | string | yes | ISO identifier (`iso_` followed by 16 hex characters). |
| `iso.state` | string: `queued`, `downloading`, `verifying`, `ready`, `attaching`, `attached`, `detaching`, `expired`, `deleted`, `failed` | yes | `queued`, `downloading` and `verifying` while the file is fetched and checked; `ready` once it can be attached; `attaching`, `attached` and `detaching` while it is (being) mounted on the server; `expired`, `deleted` or `failed` when it is over. |
| `iso.url` | string | yes | The address you gave, with credentials removed and the values of sensitive query parameters (token, key, signature, password…) replaced by `***`. |
| `iso.file_name` | string or null | yes | File name reported by the source, sanitised. Informational. |
| `iso.bytes_total` | integer or null | yes | Size announced by the source; null while unknown. After the download: the real size. |
| `iso.bytes_done` | integer | yes | Bytes downloaded so far. |
| `iso.percent` | integer or null | yes | Download progress 0-100; null while the size is unknown. 100 once downloaded. |
| `iso.sha256` | string or null | yes | SHA-256 of the downloaded file (hex); present once the download has finished. |
| `iso.kind` | string or null: `iso9660`, `eltorito`, `img` | yes | What the signature check recognised: a plain ISO 9660 image, a bootable ISO (El Torito) or a raw disk image (MBR/GPT). |
| `iso.error` | object or null | yes |  |
| `iso.error.code` | string | yes | Reason code, e.g. `blocked_url`, `too_large`, `not_iso`, `timeout`, `stalled`, `http_error`, `storage_low`, `attach_failed`, `detach_failed`. |
| `iso.error.message` | string | yes | The reason as a sentence in your account language. |
| `iso.created_at` | integer | yes | When the download was requested (Unix time, seconds, UTC) |
| `iso.ready_at` | integer or null | yes | When the file was downloaded and verified (Unix time, seconds, UTC) |
| `iso.expires_at` | integer or null | yes | When the ISO is detached and deleted automatically (Unix time, seconds, UTC) |
| `iso.expires_in` | integer or null | yes | Seconds until `expires_at` (0 once passed). |
| `iso.attached_at` | integer or null | yes | When the ISO was attached to the server (Unix time, seconds, UTC) |

Example:

```json
{
  "iso": {
    "attached_at": null,
    "bytes_done": 0,
    "bytes_total": 2000000000,
    "created_at": 1792427000,
    "error": null,
    "expires_at": null,
    "expires_in": null,
    "file_name": "ubuntu-24.04.1-live-server-amd64.iso",
    "id": "iso_5c0a9d3e7b1f4a28",
    "kind": null,
    "percent": 0,
    "ready_at": null,
    "sha256": null,
    "state": "queued",
    "url": "https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not a JSON object with only `url`. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `iso_exists` | This server already has an ISO that is not over yet. |
| 409 | `not_supported` | This server cannot mount virtual media. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `iso_bad_url` | The address is not a valid public http(s) address on an allowed port, or contains credentials. |
| 422 | `iso_blocked_url` | The address is an internal or private network address. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | More than 5 downloads in the last hour. |
| 503 | `iso_storage_low` | ISO storage is full or almost full; try again later. |
| 503 | `iso_disabled` | ISO downloads are paused. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/iso" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"}'
```

---

#### Delete the ISO early (detached first when attached)

`DELETE /v1/dedicated/{id}/iso`

Deletes the ISO and frees its storage. An ISO that is still attached is detached first: the call then answers `202` with `state` `detaching` and the file is removed when the detach finishes; otherwise it answers `200` with `state` `deleted` right away (the file itself is removed from storage within a minute). An ISO that is being attached or detached cannot be deleted yet (`409 iso_busy`).

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated iso delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always true. |
| `state` | string: `deleted`, `detaching` | yes | `deleted` when it is gone, `detaching` when it will be removed after the detach. |

Example:

```json
{
  "ok": true,
  "state": "deleted"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter was given; this call takes none. |
| 404 | `iso_none` | This server has no ISO. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `iso_busy` | The ISO is being attached or detached; try again shortly. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/dedicated/<id>/iso" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach the ISO to the server as virtual media and set a one-time CD boot (asynchronous, returns an op)

`POST /v1/dedicated/{id}/iso/attach`

Attaches the ready ISO to the server as virtual media and sets the server to boot once from it. The call answers `202` with an `op`; poll [Get an operation](#operation/dedicated_op) or [Get the ISO](#operation/dedicated_iso_get) until `state` is `attached`. The server is **not** restarted: restart it (power `reboot`) and open the console to continue. `confirm` must be the exact name of the server because the next boot will start from the ISO. Only one operation runs at a time on a server (`409 dedicated_busy`).

**Required scope:** `dedicated:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:write` | CLI: `dedicated iso attach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | string | yes | The exact name of the server. |

Example:

```json
{
  "confirm": "dell-105"
}
```

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | DedicatedOp | yes |  |
| `op.id` | integer | yes | Operation identifier. |
| `op.kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `op.action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `op.state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `op.step` | string | yes | Short name of the step being worked on. Informational. |
| `op.result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `op.public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `op.requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `op.created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `op.finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |
| `iso` | DedicatedIso | yes |  |
| `iso.id` | string | yes | ISO identifier (`iso_` followed by 16 hex characters). |
| `iso.state` | string: `queued`, `downloading`, `verifying`, `ready`, `attaching`, `attached`, `detaching`, `expired`, `deleted`, `failed` | yes | `queued`, `downloading` and `verifying` while the file is fetched and checked; `ready` once it can be attached; `attaching`, `attached` and `detaching` while it is (being) mounted on the server; `expired`, `deleted` or `failed` when it is over. |
| `iso.url` | string | yes | The address you gave, with credentials removed and the values of sensitive query parameters (token, key, signature, password…) replaced by `***`. |
| `iso.file_name` | string or null | yes | File name reported by the source, sanitised. Informational. |
| `iso.bytes_total` | integer or null | yes | Size announced by the source; null while unknown. After the download: the real size. |
| `iso.bytes_done` | integer | yes | Bytes downloaded so far. |
| `iso.percent` | integer or null | yes | Download progress 0-100; null while the size is unknown. 100 once downloaded. |
| `iso.sha256` | string or null | yes | SHA-256 of the downloaded file (hex); present once the download has finished. |
| `iso.kind` | string or null: `iso9660`, `eltorito`, `img` | yes | What the signature check recognised: a plain ISO 9660 image, a bootable ISO (El Torito) or a raw disk image (MBR/GPT). |
| `iso.error` | object or null | yes |  |
| `iso.error.code` | string | yes | Reason code, e.g. `blocked_url`, `too_large`, `not_iso`, `timeout`, `stalled`, `http_error`, `storage_low`, `attach_failed`, `detach_failed`. |
| `iso.error.message` | string | yes | The reason as a sentence in your account language. |
| `iso.created_at` | integer | yes | When the download was requested (Unix time, seconds, UTC) |
| `iso.ready_at` | integer or null | yes | When the file was downloaded and verified (Unix time, seconds, UTC) |
| `iso.expires_at` | integer or null | yes | When the ISO is detached and deleted automatically (Unix time, seconds, UTC) |
| `iso.expires_in` | integer or null | yes | Seconds until `expires_at` (0 once passed). |
| `iso.attached_at` | integer or null | yes | When the ISO was attached to the server (Unix time, seconds, UTC) |

Example:

```json
{
  "iso": {
    "attached_at": null,
    "bytes_done": 2000000000,
    "bytes_total": 2000000000,
    "created_at": 1792427000,
    "error": null,
    "expires_at": null,
    "expires_in": null,
    "file_name": "ubuntu-24.04.1-live-server-amd64.iso",
    "id": "iso_5c0a9d3e7b1f4a28",
    "kind": null,
    "percent": 100,
    "ready_at": null,
    "sha256": null,
    "state": "attaching",
    "url": "https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"
  },
  "op": {
    "action": "attach",
    "created_at": 1792427100,
    "finished_at": null,
    "id": 882,
    "kind": "iso_attach",
    "public_error": null,
    "requested_by": "you",
    "result": null,
    "state": "queued",
    "step": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body has a field other than `confirm`. |
| 400 | `confirm_mismatch` | `confirm` does not match the name of the server. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `iso_none` | This server has no ISO. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `iso_not_ready` | The ISO is not ready (still downloading, already attached, expired or failed). |
| 409 | `not_supported` | This server cannot mount virtual media. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | Too many attach or detach requests in the last minute. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/iso/attach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"dell-105"}'
```

---

#### Detach the ISO from the server (asynchronous, returns an op)

`POST /v1/dedicated/{id}/iso/detach`

Detaches the ISO from the server and clears the one-time CD boot. The ISO stays available (`ready`) until it expires, so it can be attached again. The call answers `202` with an `op`.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated iso detach`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `op` | DedicatedOp | yes |  |
| `op.id` | integer | yes | Operation identifier. |
| `op.kind` | string: `power`, `console`, `os_install`, `iso_attach`, `iso_detach` | yes | What the operation does. |
| `op.action` | string or null | yes | For `power`: the requested action; null for other kinds. |
| `op.state` | string: `queued`, `running`, `waiting`, `done`, `failed`, `cancelled` | yes | Progress of the operation. |
| `op.step` | string | yes | Short name of the step being worked on. Informational. |
| `op.result` | string or null | yes | Outcome once finished: `ok`, `noop` (the server was already in the requested state) or `graceful_timeout` (the operating system did not shut down in time; the server was left running). Null while open or after a failure. |
| `op.public_error` | string or null | yes | Reason code when the operation failed, for example `ops_disabled`, `server_locked`, `timeout`, `bmc_unreachable`, `cancelled`; null otherwise. |
| `op.requested_by` | string: `you`, `admin`, `system` | yes | Who asked for it: you, a support administrator or the system. |
| `op.created_at` | integer | yes | When the operation was requested (Unix time, seconds, UTC) |
| `op.finished_at` | integer or null | yes | When the operation finished; null while it is open (Unix time, seconds, UTC) |
| `iso` | DedicatedIso | yes |  |
| `iso.id` | string | yes | ISO identifier (`iso_` followed by 16 hex characters). |
| `iso.state` | string: `queued`, `downloading`, `verifying`, `ready`, `attaching`, `attached`, `detaching`, `expired`, `deleted`, `failed` | yes | `queued`, `downloading` and `verifying` while the file is fetched and checked; `ready` once it can be attached; `attaching`, `attached` and `detaching` while it is (being) mounted on the server; `expired`, `deleted` or `failed` when it is over. |
| `iso.url` | string | yes | The address you gave, with credentials removed and the values of sensitive query parameters (token, key, signature, password…) replaced by `***`. |
| `iso.file_name` | string or null | yes | File name reported by the source, sanitised. Informational. |
| `iso.bytes_total` | integer or null | yes | Size announced by the source; null while unknown. After the download: the real size. |
| `iso.bytes_done` | integer | yes | Bytes downloaded so far. |
| `iso.percent` | integer or null | yes | Download progress 0-100; null while the size is unknown. 100 once downloaded. |
| `iso.sha256` | string or null | yes | SHA-256 of the downloaded file (hex); present once the download has finished. |
| `iso.kind` | string or null: `iso9660`, `eltorito`, `img` | yes | What the signature check recognised: a plain ISO 9660 image, a bootable ISO (El Torito) or a raw disk image (MBR/GPT). |
| `iso.error` | object or null | yes |  |
| `iso.error.code` | string | yes | Reason code, e.g. `blocked_url`, `too_large`, `not_iso`, `timeout`, `stalled`, `http_error`, `storage_low`, `attach_failed`, `detach_failed`. |
| `iso.error.message` | string | yes | The reason as a sentence in your account language. |
| `iso.created_at` | integer | yes | When the download was requested (Unix time, seconds, UTC) |
| `iso.ready_at` | integer or null | yes | When the file was downloaded and verified (Unix time, seconds, UTC) |
| `iso.expires_at` | integer or null | yes | When the ISO is detached and deleted automatically (Unix time, seconds, UTC) |
| `iso.expires_in` | integer or null | yes | Seconds until `expires_at` (0 once passed). |
| `iso.attached_at` | integer or null | yes | When the ISO was attached to the server (Unix time, seconds, UTC) |

Example:

```json
{
  "iso": {
    "attached_at": null,
    "bytes_done": 2000000000,
    "bytes_total": 2000000000,
    "created_at": 1792427000,
    "error": null,
    "expires_at": null,
    "expires_in": null,
    "file_name": "ubuntu-24.04.1-live-server-amd64.iso",
    "id": "iso_5c0a9d3e7b1f4a28",
    "kind": null,
    "percent": 100,
    "ready_at": null,
    "sha256": null,
    "state": "detaching",
    "url": "https://releases.example.com/ubuntu-24.04.1-live-server-amd64.iso"
  },
  "op": {
    "action": "detach",
    "created_at": 1792428100,
    "finished_at": null,
    "id": 883,
    "kind": "iso_detach",
    "public_error": null,
    "requested_by": "you",
    "result": null,
    "state": "queued",
    "step": "queued"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The body is not empty. |
| 404 | `iso_none` | This server has no ISO. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `iso_not_attached` | The ISO is not attached. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | Too many attach or detach requests in the last minute. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/iso/detach" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Open a console session (a one-time URL is returned when ready)

`POST /v1/dedicated/{id}/console`

Opens a remote console session for the machine. When the session is ready the answer carries a one-time `url`; open it in a browser within 60 seconds. If it is still `preparing` (`202`), poll [Get a console session](#operation/dedicated_console_status). Calling again while a session of yours is alive returns that session instead of creating another one. At most 5 requests per minute are accepted for an account.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated console open`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `session` | DedicatedConsoleSession | yes |  |
| `session.id` | string | yes | Console session identifier (`dcs_` followed by 16 hex characters). |
| `session.status` | string: `preparing`, `ready`, `active`, `closed`, `failed`, `expired` | yes | `preparing` while the console is being enabled, `ready` and `active` when it can be used, then `closed`, `expired` or `failed`. |
| `session.expires_at` | integer | yes | When the session ends (Unix time, seconds, UTC) |
| `session.poll_after` | integer | no | While `preparing`: seconds to wait before polling again. |
| `session.url` | string | no | Console address to open in a browser. It works once and only for 60 seconds, then you need to ask for a new one. Present only when the session is `ready` or `active`. |
| `session.url_expires_in` | integer | no | Seconds the `url` stays valid. |
| `session.error` | string | no | Reason code when `status` is `failed`: `dedicated_console_failed`. |

Example:

```json
{
  "session": {
    "expires_at": 1792428800,
    "id": "dcs_8e2f0a91c4d37b65",
    "poll_after": 2,
    "status": "preparing"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_busy` | Another operation is still running on this server. |
| 423 | `dedicated_ops_disabled` | Server control is switched off system-wide. |
| 423 | `dedicated_server_locked` | The server is locked for control actions. |
| 423 | `dedicated_suspended` | Your subscription is suspended; the server is read-only. |
| 429 | `rate_limited` | Too many console requests in the last minute. |
| 503 | `dedicated_bmc_unavailable` | The server's controller is not available right now. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/console" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Console session status; when ready, issues a fresh URL (valid 60 seconds)

`GET /v1/dedicated/{id}/console/{sid}`

Returns a console session. While it is `ready` or `active` every call issues a fresh one-time `url` (valid 60 seconds, replacing the previous one), which is also how you reopen the console after closing the browser tab. At most 30 requests per minute per session.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated console status`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |
| `sid` | string | yes | Console session identifier as returned by Open a console session, e.g. `dcs_8e2f0a91c4d37b65`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `session` | DedicatedConsoleSession | yes |  |
| `session.id` | string | yes | Console session identifier (`dcs_` followed by 16 hex characters). |
| `session.status` | string: `preparing`, `ready`, `active`, `closed`, `failed`, `expired` | yes | `preparing` while the console is being enabled, `ready` and `active` when it can be used, then `closed`, `expired` or `failed`. |
| `session.expires_at` | integer | yes | When the session ends (Unix time, seconds, UTC) |
| `session.poll_after` | integer | no | While `preparing`: seconds to wait before polling again. |
| `session.url` | string | no | Console address to open in a browser. It works once and only for 60 seconds, then you need to ask for a new one. Present only when the session is `ready` or `active`. |
| `session.url_expires_in` | integer | no | Seconds the `url` stays valid. |
| `session.error` | string | no | Reason code when `status` is `failed`: `dedicated_console_failed`. |

Example:

```json
{
  "session": {
    "expires_at": 1792428800,
    "id": "dcs_8e2f0a91c4d37b65",
    "status": "ready",
    "url": "https://example.com/console/bm/0123456789abcdef0123456789abcdef",
    "url_expires_in": 60
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server or the session does not exist or is not yours. |
| 429 | `rate_limited` | Too many requests for this session in the last minute. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/console/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Close a console session

`DELETE /v1/dedicated/{id}/console/{sid}`

Closes a console session. The one-time address stops working and an open console connection is cut shortly after.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated console delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |
| `sid` | string | yes | Console session identifier as returned by Open a console session, e.g. `dcs_8e2f0a91c4d37b65`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `session` | DedicatedConsoleSession | yes |  |
| `session.id` | string | yes | Console session identifier (`dcs_` followed by 16 hex characters). |
| `session.status` | string: `preparing`, `ready`, `active`, `closed`, `failed`, `expired` | yes | `preparing` while the console is being enabled, `ready` and `active` when it can be used, then `closed`, `expired` or `failed`. |
| `session.expires_at` | integer | yes | When the session ends (Unix time, seconds, UTC) |
| `session.poll_after` | integer | no | While `preparing`: seconds to wait before polling again. |
| `session.url` | string | no | Console address to open in a browser. It works once and only for 60 seconds, then you need to ask for a new one. Present only when the session is `ready` or `active`. |
| `session.url_expires_in` | integer | no | Seconds the `url` stays valid. |
| `session.error` | string | no | Reason code when `status` is `failed`: `dedicated_console_failed`. |

Example:

```json
{
  "session": {
    "expires_at": 1792428800,
    "id": "dcs_8e2f0a91c4d37b65",
    "status": "closed"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server or the session does not exist or is not yours. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/dedicated/<id>/console/<sid>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Get a one-time SSH WebSocket ticket for a Dedicated Server (logs in with the installation's login)

`POST /v1/dedicated/{id}/ssh-token`

Issues a one-time ticket for the SSH web terminal of a Dedicated Server. Open a WebSocket to `websocket_url` with the ticket as the `token` query parameter (`<websocket_url>?token=<token>`) within `expires_in` seconds (120). The ticket works for one connection; reconnecting needs a new ticket. The frames are the same as for virtual machines: send `{"type":"input","data":"ls\n"}`, `{"type":"resize","cols":120,"rows":30}` and, when the gateway asks for credentials (`auth_required`), `{"type":"auth","username":"...","password":"..."}`; output arrives as `{"type":"output","data":"..."}` frames.

The gateway always connects to the current public address of this server, on port 22; you cannot choose another target. It logs in by itself with the user name and password of the current operating system installation (`credentials_source` = `install`), or with a password you typed in the terminal earlier and chose to keep (`saved`). The password is never sent to you. When neither exists, `credentials_source` is `none` and the gateway asks for the password. Requests are limited to 20 per minute per client address and per account. Sessions that were started by an administrator on your behalf cannot use this operation.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated ssh-token`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `token` | string | yes | One-time ticket. A secret: it opens a terminal on the server. |
| `expires_in` | integer | yes | Seconds the ticket stays valid (120). |
| `websocket_url` | string | yes | WebSocket address of the terminal gateway. |
| `default_username` | string | yes | Login name the terminal uses or proposes. |
| `port` | integer | yes | SSH port the gateway connects to (always 22). |
| `vm_id` | string | yes | Identifier of the Dedicated Server. |
| `vm_name` | string or null | yes | Display name of the server. |
| `ip_address` | string | yes | Public address the terminal connects to. |
| `has_credentials` | boolean | yes | True when the gateway can log in without asking for a password. |
| `credentials_source` | string: `install`, `saved`, `none` | yes | Where the login comes from: the current operating system installation, a password you kept, or nowhere (the gateway asks). |
| `saved_credentials` | boolean | yes | True when a password you typed is kept; remove it with [Forget the saved SSH login](#operation/dedicated_ssh_credentials_delete). |

Example:

```json
{
  "credentials_source": "install",
  "default_username": "root",
  "expires_in": 120,
  "has_credentials": true,
  "ip_address": "203.0.113.10",
  "port": 22,
  "saved_credentials": false,
  "token": "ofw_ssh_ds_9f3c1b7a5d2e4f60718293a4b5c6d7e8",
  "vm_id": "ds_3f9a1c2b7d4e5a60",
  "vm_name": "dell-1",
  "websocket_url": "wss://cloud.example.com/ssh-ws"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | The call comes from a session a reseller opened on your behalf. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `dedicated_ssh_unsupported` | The server runs Windows, which has no SSH. Use the console or RDP. |
| 409 | `dedicated_powered_off` | The server is powered off. Power it on first. |
| 409 | `dedicated_no_ip` | The server has no public address to connect to. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/ssh-token" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Forget the SSH password you typed and kept for a Dedicated Server

`DELETE /v1/dedicated/{id}/ssh-credentials`

Forgets the SSH password you typed in the terminal and chose to keep. The next terminal then uses the user name and password of the current operating system installation, or asks again if there is none. It never touches the installation login or the server itself. Works even when the server is off or locked.

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated ssh-credentials delete` | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |
| `cleared` | boolean | yes | True when a saved login existed and was removed. |

Example:

```json
{
  "cleared": true,
  "ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/dedicated/<id>/ssh-credentials" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### AI SSH Agent status and history for a Dedicated Server

`GET /v1/dedicated/{id}/ai-agent/status`

Returns whether the AI agent is enabled, the model it uses, the most recent conversation you had with it about this server (up to the last 40 messages, oldest first) and `target`: whether the agent can work on the server right now. When `target.ready` is false, `target.reason` is one of `dedicated_server_locked`, `dedicated_suspended`, `dedicated_installing`, `dedicated_ssh_unsupported`, `dedicated_powered_off`, `dedicated_no_ip`. A conversation is removed when the server is reinstalled, transferred or unassigned.

**Required scope:** `dedicated:read`.

Scope: `dedicated:read` | CLI: `dedicated ai-agent status`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Whether the AI agent is switched on for this site. |
| `provider` | string | yes | Name of the AI service in use. |
| `model` | string | yes | Name of the model in use. |
| `session_id` | string or null | yes | Identifier of the latest conversation for this server; null when there is none. |
| `messages` | array of AiAgentMessage | yes |  |
| `messages[].id` | integer | yes | Message identifier. Increases with time. |
| `messages[].role` | string: `user`, `assistant` | yes | Who wrote the message. |
| `messages[].content` | string | yes | Message text. |
| `messages[].meta` | object or null | yes |  |
| `messages[].meta.model` | string | no | Model that produced the answer. |
| `messages[].meta.steps` | array of AiAgentStep | no |  |
| `messages[].meta.awaiting_confirm` | boolean | no | True when the answer ended with a command waiting for your confirmation. |
| `messages[].created_at` | integer | yes | Time the message was stored (Unix time, seconds, UTC) |
| `target` | object | yes |  |
| `target.ready` | boolean | yes | True when the agent can connect to the server now. |
| `target.reason` | string or null | yes | Why not, when `ready` is false. |
| `target.message` | string | no | Human-readable text of `reason`, in your language. |
| `saved_credentials` | boolean | yes | True when a password you typed in the terminal is kept for this server. |

Example:

```json
{
  "enabled": true,
  "messages": [],
  "model": "example-model-1",
  "provider": "AI Assistant",
  "saved_credentials": false,
  "session_id": null,
  "target": {
    "ready": true,
    "reason": null
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/ai-agent/status" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Start a new AI SSH Agent session for a Dedicated Server

`POST /v1/dedicated/{id}/ai-agent/clear`

Starts a new, empty AI agent conversation for this server. The earlier conversation is kept but is no longer the one [Get AI agent status](#operation/dedicated_ai_agent_status) returns. Pass the returned `session_id` to [Run the AI agent](#operation/dedicated_ai_agent_run). No body is needed.

**Required scope:** `dedicated:write`.

Scope: `dedicated:write` | CLI: `dedicated ai-agent clear`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | Always `true` on success. |
| `session_id` | string | yes | Identifier of the new conversation. |

Example:

```json
{
  "ok": true,
  "session_id": "ais_5d2e8a1c7b3f9046e1a2"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/ai-agent/clear" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Run the AI SSH Agent on a Dedicated Server (SSE stream)

`POST /v1/dedicated/{id}/ai-agent`

Sends a message to the AI agent, which can run shell commands on the server over SSH to answer. The stream and the request body are the same as for virtual machines ([Run the AI agent](#operation/vm_ai_agent_run)): server-sent events `hello`, `assistant_turn`, `tool_request`, `tool_start`, `tool_result`, `done`, `error`; send the command the user approved back as `confirmed_cmd`.

The agent logs in with the same login as the SSH terminal and never sees the password. Commands run automatically (`auto_execute: true`) only when they are on the read-only allowlist and not flagged as risky; every command that changes the server stops at `tool_request`. **A Dedicated Server is a physical machine without snapshots**: deleting data, formatting disks, shutting down or rebooting cannot be undone, so those commands always carry a `risk_reason`. Before every command the server checks again that the machine is still yours, unlocked, powered on and not being reinstalled; otherwise the step ends with an `error` and no command runs. Limits: 20 requests per minute per account, 2 conversations streaming at once, and the shared daily quota of AI calls (resets at 00:00 UTC; `429 rate_limited` with `limit`, `used`, `retry_after`).

**Required scope:** `dedicated:console`.

Scope: `dedicated:console` | CLI: `dedicated ai-agent run`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `messages` | array of object | no | The conversation so far; the last 20 messages are used and the last `user` message is the one to answer. Required unless `confirmed_cmd` is sent. |
| `messages[].role` | string: `user`, `assistant` | yes | Author of the message. Other roles are ignored. |
| `messages[].content` | string | yes | Message text; at most 12000 characters are used. |
| `session_id` | string | no | Conversation to continue. Omit it, or send an unknown value, to start a new conversation. |
| `auto_execute` | boolean | no | Run read-only commands automatically instead of asking first. Defaults to `false`. |
| `confirmed_cmd` | string | no | A command the user approved after a `tool_request`. It is executed first and its output is given to the agent. |

Example:

```json
{
  "auto_execute": false,
  "messages": [
    {
      "content": "How much disk space is left?",
      "role": "user"
    }
  ],
  "session_id": "ais_9b1d4c0a7e3f5a21c6d8"
}
```

**Response 200** - Success.

Content type: `text/event-stream`

| Field | Type | Always present | Description |
|---|---|---|---|
| `type` | string: `hello`, `assistant_turn`, `tool_request`, `tool_start`, `tool_result`, `step_skipped`, `error`, `done` | yes | Kind of event; it decides which other fields are present. `step_skipped` only comes from [Send to the AI agent](#operation/agent_session_send) when a pending command is declined. |
| `session_id` | string | no | Conversation identifier. In `hello` and `done`. |
| `content` | string | no | Text of the assistant's answer. In `assistant_turn`. |
| `model` | string | no | Model that produced the answer. In `assistant_turn` and `done`. |
| `id` | string | no | Identifier of the step. In `tool_request`, `tool_start`, `tool_result` and `step_skipped`. |
| `command` | string | no | The shell command. In `tool_request`, `tool_start` and `tool_result`. |
| `reason` | string or null | no | Why the command was chosen. In `tool_request` and `tool_start`. |
| `risk_reason` | string or null | no | Why the command needs confirmation; null when it is not risky. In `tool_request`. |
| `risk_code` | string or null | no | Stable code of the risk (`destructive`, `files`, `exfil`, `raw_net`, `auth`, `obfuscated`, `remote_script`, `power_fw`, `pivot`, `other`); null when not risky. In `tool_request`. |
| `auto_blocked` | boolean | no | True when the command is held back for confirmation because it is risky or not read-only, whatever `auto_execute` says. In `tool_request`. |
| `read_only` | boolean | no | True when the command is on the allowlist of read-only commands permitted for automatic execution (checking status, reading logs and configuration, network diagnostics). In `tool_request`. |
| `ok` | boolean | no | True when the command ran and the connection to the server worked. In `tool_result`. |
| `stdout` | string | no | Standard output of the command. In `tool_result`. |
| `stderr` | string | no | Standard error of the command. In `tool_result`. |
| `exit_code` | integer | no | Exit code of the command; -1 when it could not be run. In `tool_result`. |
| `timed_out` | boolean | no | True when the command was stopped because it ran too long. In `tool_result`. |
| `duration_ms` | integer | no | Run time in milliseconds. In `tool_result`. |
| `error` | string | no | Error text when the command could not be run; empty otherwise. In `tool_result`. |
| `message` | string | no | Human-readable description of the problem. In `error`. |
| `code` | string | no | Machine-readable code, for example `rate_limited` when the daily quota ran out mid-stream. In `error`, when available. |
| `awaiting_confirm` | boolean | no | True when the stream stopped at a command that needs your confirmation. In `done`. |

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 403 | `impersonate_forbidden` | The call comes from a session a reseller opened on your behalf. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `dedicated_ssh_unsupported` | The server runs Windows, which has no SSH. Use the console or RDP. |
| 409 | `dedicated_powered_off` | The server is powered off. Power it on first. |
| 409 | `dedicated_no_ip` | The server has no public address to connect to. |
| 409 | `session_busy` | This conversation is already streaming. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |
| 503 | `feature_disabled` | The AI agent is switched off for this site. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/ai-agent" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"auto_execute":false,"messages":[{"content":"How much disk space is left?","role":"user"}],"session_id":"ais_9b1d4c0a7e3f5a21c6d8"}'
```

---

#### Proxy App status: readiness, agent, subnets and proxy totals

`GET /v1/dedicated/{id}/proxy-app`

Returns whether Proxy App can run on this server and why not, the state of the platform agent inside the server, the subnets attached to the server with the number of proxies on each, and totals. Proxy App opens one SOCKS5 proxy per address of a subnet routed to this server; the proxies run inside your server through the platform agent. It is free of charge. No passwords are returned here.

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app status`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ready` | boolean | yes | True when proxies can be created now. |
| `reason` | string: `ready`, `windows`, `no_agent`, `agent_outdated`, `no_subnet`, `locked`, `suspended`, `installing` | yes | Why Proxy App cannot be used yet, or `ready`. |
| `agent` | object | yes |  |
| `agent.state` | string: `none`, `outdated`, `offline`, `online` | yes | State of the platform agent inside the server. |
| `agent.version` | string or null | yes | Agent version. |
| `agent.needs` | string or null: `install`, `upgrade` | yes | What to do about the agent, if anything. |
| `prefixes` | array of object | yes |  |
| `prefixes[].id` | integer | yes | Subnet identifier. |
| `prefixes[].cidr` | string | yes | The subnet. |
| `prefixes[].hosts` | integer | yes | Host addresses in the subnet (network and broadcast addresses excluded). |
| `prefixes[].proxies` | integer | yes | Proxies already created on this subnet. |
| `prefixes[].eligible` | boolean | yes | False when the subnet cannot be used; see `reason`. |
| `prefixes[].reason` | string or null: `not_active`, `ipv6`, `contains_main_ip`, `contains_gateway` | yes | Why the subnet cannot be used. |
| `prefixes[].refused` | string or null | yes | Code the agent reported when it refused the whole subnet, e.g. `connected_overlap`; null when not refused. |
| `prefixes[].truncated` | boolean | yes | True when the subnet has more hosts than one server can proxy (1022); create proxies in blocks with `from_host` and `to_host`. |
| `summary` | object | yes |  |
| `summary.total` | integer | yes | Proxies on the server. |
| `summary.running` | integer | yes | Running. |
| `summary.error` | integer | yes | Failed to start; see each proxy. |
| `summary.stopped` | integer | yes | Turned off or stopped by the platform. |
| `summary.pending` | integer | yes | Waiting for the agent to apply the change. |
| `summary.rx` | integer | yes | Bytes received from the Internet through all proxies. |
| `summary.tx` | integer | yes | Bytes sent to the Internet through all proxies. |
| `src_allow` | array of string | yes |  |
| `limits` | object | yes |  |
| `limits.max` | integer | yes | Maximum proxies per server (1022). |
| `limits.default_port` | integer | yes | Default port (65001). |
| `provisioned_by_admin` | boolean | yes | True when an administrator prepared the proxies for you. |

Example:

```json
{
  "agent": {
    "needs": null,
    "state": "online",
    "version": "1.4.0-bm"
  },
  "limits": {
    "default_port": 65001,
    "max": 1022
  },
  "prefixes": [
    {
      "cidr": "203.0.113.0/24",
      "eligible": true,
      "hosts": 254,
      "id": 12,
      "proxies": 254,
      "reason": null,
      "refused": null,
      "truncated": false
    }
  ],
  "provisioned_by_admin": false,
  "ready": true,
  "reason": "ready",
  "src_allow": [],
  "summary": {
    "error": 2,
    "pending": 1,
    "running": 250,
    "rx": 1234,
    "stopped": 1,
    "total": 254,
    "tx": 5678
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/proxy-app" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### List proxies (sorted, filtered, paged; no passwords)

`GET /v1/dedicated/{id}/proxy-app/proxies`

Lists the proxies of the server with their real state as reported by the agent. Passwords are never returned here; use [Export proxies](#operation/dedicated_proxy_app_export).

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `sort` | string: `ip`, `port`, `user`, `status`, `traffic`, `created` | no | Sort column. |
| `status` | string: `pending`, `running`, `error`, `stopped` | no | Only proxies in this state. |
| `q` | string | no | Only proxies whose IP or user name contains this text. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `items[].id` | string | yes | Proxy identifier, e.g. `px_3f9a1c2b7d4e`. |
| `items[].ip` | string | yes | Proxy address. |
| `items[].port` | integer | yes | SOCKS5 port. |
| `items[].user` | string | yes | User name. |
| `items[].has_password` | boolean | yes | Always true; read it with Export proxies. |
| `items[].enabled` | boolean | yes | False when you turned it off. |
| `items[].status` | string: `pending`, `running`, `error`, `stopped` | yes | Real state reported by the agent. |
| `items[].status_code` | string or null | yes | Why it is not running: `ip_in_use`, `port_in_use`, `bind_failed`, a subnet refusal code, `prefix_detached` or `server_locked`. |
| `items[].reason` | string or null | yes | Same as `status_code`. |
| `items[].rx` | integer | yes | Bytes received from the Internet. |
| `items[].tx` | integer | yes | Bytes sent to the Internet. |
| `items[].conns` | integer | yes | Connections open now. |
| `items[].cidr` | string | yes | Subnet the address belongs to. |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "cidr": "203.0.113.0/24",
      "conns": 1,
      "enabled": true,
      "has_password": true,
      "id": "px_3f9a1c2b7d4e",
      "ip": "203.0.113.1",
      "port": 65001,
      "reason": null,
      "rx": 10,
      "status": "running",
      "status_code": null,
      "tx": 20,
      "user": "k3j9x0a1bc"
    }
  ],
  "page": 1,
  "per_page": 50,
  "total": 254
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | A query parameter is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/proxy-app/proxies" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Create a SOCKS5 proxy for every host address of the subnet (free of charge)

`POST /v1/dedicated/{id}/proxy-app/proxies`

Creates one SOCKS5 proxy for every host address of the subnet (`.1` to `.254` of a /24) that has none yet, skipping the server's main address and its gateway. By default each proxy gets its own random user name and password and port 65001; `mode: shared` gives the whole range one user and password. Requires a current platform agent inside the server. Repeating the call creates only what is missing. Free of charge.

**Required scope:** `dedicated:proxy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app create` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix_id` | integer | yes | Subnet identifier from [Get Proxy App](#operation/dedicated_proxy_app_status). |
| `mode` | string: `random`, `shared` | no | `random` (default): own user and password per proxy. `shared`: one user and password for all. |
| `port` | integer | no | Port 1024-65535. Defaults to 65001. |
| `user` | string | no | `shared` only: user name, 3-32 characters of a-z 0-9 . _ -. Generated when omitted. |
| `password` | string | no | `shared` only: password, 12-64 characters of letters, digits and . _ ~ -. Generated when omitted. |
| `from_host` | integer | no | First host number to create (1 = first host address). For subnets larger than 1022 hosts. |
| `to_host` | integer | no | Last host number to create. |

Example:

```json
{
  "mode": "random",
  "port": 65001,
  "prefix_id": 12
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `created` | integer | yes | Proxies created. |
| `existing` | integer | yes | Addresses that already had a proxy. |
| `skipped` | object | yes |  |
| `skipped.main_ip` | integer | yes | 1 when the main address of the server was skipped. |
| `skipped.gateway` | integer | yes | 1 when the gateway was skipped. |

Example:

```json
{
  "created": 254,
  "existing": 0,
  "skipped": {
    "gateway": 0,
    "main_ip": 0
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `proxy_app_unsupported` | The server runs Windows, which Proxy App does not support. |
| 409 | `proxy_app_not_ready` | The agent is missing or too old (`reason`: `no_agent`, `agent_outdated`). |
| 409 | `prefix_not_eligible` | The subnet cannot be used (`reason`). |
| 409 | `proxy_limit` | A server holds at most 1022 proxies. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `bad_port` | The port is not between 1024 and 65535. |
| 422 | `weak_password` | The password does not meet the rules. |
| 422 | `bad_user` | The user name does not meet the rules. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/proxy-app/proxies" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"mode":"random","port":65001,"prefix_id":12}'
```

---

#### Turn on, off, delete, change password or port of many proxies

`POST /v1/dedicated/{id}/proxy-app/proxies/bulk`

Applies one action to chosen proxies (`ids`) or to all proxies matching a filter (`all` with `filter`; an unknown filter key, a bad `status` or a `q` over 64 characters is rejected with 400, it never widens to all proxies): turn on, turn off, delete, change password or change port. One proxy is `ids` with one entry. Changes reach the agent within about ten seconds; each proxy shows `pending` until then.

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app bulk`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `action` | string: `enable`, `disable`, `delete`, `set_password`, `set_port` | yes | What to do. |
| `ids` | array of string | no |  |
| `all` | boolean | no | True to act on every proxy matching `filter` (or all when no filter). |
| `filter` | object | no |  |
| `filter.q` | string | no | IP or user text, up to 64 characters. |
| `filter.status` | string: `pending`, `running`, `error`, `stopped` | no | State. |
| `mode` | string: `random`, `shared` | no | `set_password`: new random password for each proxy, or one shared password. |
| `password` | string | no | `set_password`: the password to use for all chosen proxies, 12-64 characters of letters, digits and . _ ~ -; it must differ from the user name. |
| `port` | integer | no | `set_port`: new port 1024-65535. |

Example:

```json
{
  "action": "set_port",
  "all": true,
  "port": 65002
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `affected` | integer | yes | Proxies changed. |

Example:

```json
{
  "affected": 254
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The request is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `proxy_app_unsupported` | The server runs Windows, which Proxy App does not support. |
| 422 | `bad_port` | The port is not between 1024 and 65535. |
| 422 | `weak_password` | The password does not meet the rules. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/proxy-app/proxies/bulk" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"set_port","all":true,"port":65002}'
```

---

#### Remove all proxies and the Proxy App settings of the server

`POST /v1/dedicated/{id}/proxy-app/clear`

Deletes every proxy and the Proxy App settings of the server. The agent removes the listeners and the local route of the subnet within about ten seconds. Does not touch addresses you configured yourself.

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app clear`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `confirm` | boolean | yes | Must be `true`. |

Example:

```json
{
  "confirm": true
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `deleted` | integer | yes | Proxies deleted. |

Example:

```json
{
  "deleted": 254
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | `confirm` is not `true`. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `proxy_app_unsupported` | The server runs Windows, which Proxy App does not support. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/proxy-app/clear" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"confirm":true}'
```

---

#### Set the source addresses allowed to use the proxies

`PUT /v1/dedicated/{id}/proxy-app/settings`

Sets the source addresses allowed to connect to the proxies. An empty list allows any source; the user name and password are always required.

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app settings`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `src_allow` | array of string | yes |  |

Example:

```json
{
  "src_allow": [
    "198.51.100.7",
    "198.51.101.0/24"
  ]
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `src_allow` | array of string | yes |  |

Example:

```json
{
  "src_allow": [
    "198.51.100.7",
    "198.51.101.0/24"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `proxy_app_unsupported` | The server runs Windows, which Proxy App does not support. |
| 422 | `bad_src_allow` | An entry is not a valid IPv4 address or CIDR. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X PUT "https://api.onie.net/v1/dedicated/<id>/proxy-app/settings" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"src_allow":["198.51.100.7","198.51.101.0/24"]}'
```

---

#### Export proxies with passwords (ip:port:user:pass, socks5://, CSV)

`POST /v1/dedicated/{id}/proxy-app/export`

Returns the chosen proxies as text including their passwords: `ip_port_user_pass` (`ip:port:user:pass`), `url` (`socks5://user:pass@ip:port`) or `csv`. The response is not cached and the export is recorded in the activity log (without passwords).

**Required scope:** `dedicated:proxy`.

Scope: `dedicated:proxy` | CLI: `dedicated proxy-app export`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dedicated Server identifier as returned by List Dedicated Servers, e.g. `ds_3f9a1c2b7d4e5a60`. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `format` | string: `ip_port_user_pass`, `url`, `csv` | yes | Output format. |
| `ids` | array of string | no |  |
| `all` | boolean | no | True to export every proxy matching `filter`. |
| `filter` | object | no |  |
| `filter.q` | string | no | IP or user text, up to 64 characters. |
| `filter.status` | string: `pending`, `running`, `error`, `stopped` | no | State. |

Example:

```json
{
  "all": true,
  "format": "url"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `format` | string | yes | The format. |
| `count` | integer | yes | Proxies in the text. |
| `text` | string | yes | The list, one proxy per line. A secret: it contains passwords. |

Example:

```json
{
  "count": 1,
  "format": "url",
  "text": "socks5://k3j9x0a1bc:Zx81mQp0aa9L2cT7uVwE@203.0.113.1:65001\n"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `bad_input` | The request is not valid. |
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 409 | `dedicated_installing` | An operating system installation is running. Wait until it finishes. |
| 409 | `proxy_app_unsupported` | The server runs Windows, which Proxy App does not support. |
| 423 | `dedicated_server_locked` | The server is locked by an administrator or your account's services are stopped. |
| 423 | `dedicated_suspended` | Your subscription is suspended. |
| 429 | `rate_limited` | Too many requests. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/proxy-app/export" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"all":true,"format":"url"}'
```

---

### Bring Your Own IP

Announce your own IPv4 or IPv6 prefix over BGP and use it on your VMs. Two types: `leased` (a prefix you lease from an IP provider) and `own` (a prefix your organisation holds at a RIR/LIR). Flow: register the prefix and origin ASN → publish an RPKI ROA, an IRR route/route6 object and the verification token (`byoip-verify=<token>`) in the prefix whois (or in the aut-num of your ASN) at the RIR — RIPE, APNIC, ARIN, AFRINIC or LACNIC database; objects in RADB/ALTDB and other open IRRs do not count as proof → the platform verifies automatically every 10 minutes for up to 7 days (you are not charged before verification passes; a prefix that is already announced on the Internet goes to a manual review) → the prefix is announced and a private L2 network with gateway `.1`/`::1` is created → attach it to a VM (a second NIC) and configure the addresses shown in `setup`. Accepted sizes: IPv4 /24–/22, IPv6 /48–/32 (configurable per site, see `GET /v1/byoip/catalog`).

#### BYOIP catalog: types, prefix sizes, prices and limits

`GET /v1/byoip/catalog`

Types, accepted prefix sizes, prices (VND list price and wallet cents), verification rules and limits of the site.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip catalog`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `kinds` | array of string | yes |  |
| `usages` | array of string | yes |  |
| `platform_asn` | integer | yes | Platform ASN you may use as origin instead of your own ASN. |
| `sizes` | object | yes | Accepted prefix lengths per family. |
| `prices` | object | yes | Per type: monthly BGP fee when the origin is the platform ASN (`month_*`) or your own ASN (`own_asn_month_*`), and setup fee. |
| `bandwidth` | object | yes | Included traffic per prefix (GB/month) and add-on price. |
| `verify` | object | yes | Verification interval, max days, proof mode, IRR requirement. |
| `limits` | object | yes | Prefixes per account and how many you use. |
| `mtu` | integer | yes | MTU of the own-IP network (set it on the VM NIC). |

Example:

```json
{
  "bandwidth": {
    "addon_tb_vnd": 100000,
    "quota_gb": 2048
  },
  "enabled": true,
  "kinds": [
    "leased",
    "own"
  ],
  "limits": {
    "per_account": 5,
    "used": 0
  },
  "mtu": 1450,
  "platform_asn": 64496,
  "prices": {
    "leased": {
      "month_cents": 0,
      "month_vnd": 0,
      "own_asn_month_cents": 1147,
      "own_asn_month_vnd": 299000
    },
    "own": {
      "month_cents": 0,
      "month_vnd": 0,
      "own_asn_month_cents": 0,
      "own_asn_month_vnd": 0
    }
  },
  "sizes": {
    "v4": {
      "max": 24,
      "min": 22
    },
    "v6": {
      "max": 48,
      "min": 32
    }
  },
  "usages": [
    "vm"
  ],
  "verify": {
    "interval_s": 600,
    "max_days": 7
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/catalog" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### BYOIP quote by type and ASN

`GET /v1/byoip/quote`

Price of registering a prefix of the given type and origin ASN. The monthly BGP fee is charged once per origin ASN and type: a second prefix with the same ASN costs nothing extra.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip quote`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `kind` | string: `leased`, `own` | no | Prefix type. |
| `usage` | string: `vm`, `external` | no | Where the prefix is used. |
| `asn` | string | no | Origin ASN (`AS64500` or `64500`). Default: the platform ASN. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `kind` | string | yes | Type. |
| `usage` | string | yes | Usage. |
| `asn` | integer | yes | Origin ASN. |
| `quote` | object | yes | `month_cents`, `setup_cents`, `due_cents`, `asn_covered`, `free`. |
| `balance_cents` | integer | yes | Wallet balance. |

Example:

```json
{
  "asn": 213035,
  "balance_cents": 1500,
  "kind": "own",
  "quote": {
    "asn_covered": false,
    "due_cents": 0,
    "free": true,
    "month_cents": 0,
    "month_vnd": 0,
    "setup_cents": 0,
    "setup_vnd": 0
  },
  "usage": "vm"
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `asn_invalid` | The ASN is not a public ASN. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/quote" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Quick check of a prefix before registering (no external lookups)

`POST /v1/byoip/check`

Checks a prefix and ASN before registering: syntax, accepted size, special-use ranges, overlap with the provider's or other customers' prefixes. No external lookup; RPKI/IRR are checked after you register. Limited to 30 checks per hour.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip check`

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | yes | Prefix, e.g. `45.12.34.0/24`. |
| `asn` | string | no | Origin ASN; default the platform ASN. |

Example:

```json
{
  "asn": "AS213035",
  "prefix": "45.12.34.0/24"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `ok` | boolean | yes | The prefix can be registered. |
| `prefix` | string | no | Normalised prefix. |
| `error` | string | no | Error code when `ok` is false. |
| `message` | string | no | Error message. |

Example:

```json
{
  "asn": 213035,
  "family": 4,
  "gateway": "45.12.34.1",
  "ok": true,
  "prefix": "45.12.34.0/24",
  "size": 256
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/check" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"asn":"AS213035","prefix":"45.12.34.0/24"}'
```

---

#### List your own IP prefixes

`GET /v1/byoip`

Lists your prefixes (ended ones stay visible for 30 days).

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `prefix`, `state`, `asn`, `kind` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `state` | string: `all`, `pending`, `active`, `suspended`, `ended` | no | Filter by state group. |
| `kind` | string: `leased`, `own` | no | Filter by type. |
| `q` | string | no | Search in prefix or ASN. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of Byoip | yes |  |
| `items[].id` | integer | yes | Prefix identifier. |
| `items[].prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `items[].family` | integer | yes | Address family: 4 or 6. |
| `items[].kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `items[].kind_label` | string | yes | Display label of the type. |
| `items[].usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `items[].asn` | integer | yes | Origin ASN announced for the prefix. |
| `items[].state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `items[].gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `items[].routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `items[].public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `items[].review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `items[].suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `items[].bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `items[].verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `items[].can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `items[].needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `items[].target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `items[].checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `items[].token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `items[].instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `items[].setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `items[].attachments` | array of object | no |  |
| `items[].vms` | array of object | no |  |
| `items[].vpc_requests` | array of object | no |  |
| `items[].billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `items[].created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `items[].activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `items[].ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `items[].updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `can_create` | boolean | yes | You may register another prefix. |

Example:

```json
{
  "can_create": true,
  "enabled": true,
  "items": [
    {
      "activated_at": null,
      "asn": 213035,
      "bgp": {
        "announce": false,
        "propagated_at": null,
        "ris_peers_seeing": null,
        "roa": null,
        "withdraw_reason": null
      },
      "can": {
        "attach": false,
        "bind": true,
        "cancel": true,
        "review_request": false,
        "verify": true
      },
      "created_at": 1761100000,
      "ended_at": null,
      "family": 4,
      "gateway": null,
      "id": 12,
      "kind": "own",
      "kind_label": "Own IP",
      "needs_vm": false,
      "prefix": "45.12.34.0/24",
      "public_error": null,
      "state": "pending_verify",
      "target_kind": "vm",
      "updated_at": 1761100000,
      "usage": "vm",
      "verify": {
        "attempts": 1,
        "checked_at": 1761100000,
        "expires_at": 1761704800,
        "next_check_at": 1761100600,
        "verified_at": null
      }
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/byoip" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Merged IP range list: your own prefixes and rented subnets (one row per range)

`GET /v1/byoip/ranges`

One merged list of all your IP ranges: prefixes you bring (`type: own`, as in `GET /v1/byoip`) and subnets you rent from the platform (`type: leased`, as in `GET /v1/byoip/subnets`). A subnet routed at this platform and its BGP prefix are ONE row (the `leased` row carries `byoip_id`, `gateway` and `bgp` of its prefix). Ended ranges stay in `state=all` for 30 days; `state=ended` shows all of them.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip ranges`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `sort` | string: `created_at`, `prefix`, `state`, `asn`, `source`, `expires` | no | Field to sort by. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |
| `state` | string: `all`, `pending`, `active`, `suspended`, `ended` | no | Filter by state group (`suspended` includes a subnet in grace or ending at period end). |
| `source` | string: `all`, `own`, `leased` | no | Filter by source: `own` = prefix you bring, `leased` = subnet rented from the platform. |
| `q` | string | no | Search in prefix or ASN. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `can_create` | boolean | yes | You may register another prefix. |

Example:

```json
{
  "can_create": true,
  "enabled": true,
  "items": [
    {
      "asn": 213035,
      "byoip_id": null,
      "expires_at": null,
      "id": 70,
      "mode": null,
      "prefix": "45.12.34.0/24",
      "rpki": null,
      "state": "active",
      "state_group": "active",
      "type": "own"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/ranges" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Register an own IP prefix (waits for verification, not charged yet)

`POST /v1/byoip`

Registers a prefix for verification. Requires `Idempotency-Key` and `agree_terms: true`. Nothing is charged now: once RPKI (ROA for the origin ASN), the IRR route object and the token pass, the monthly BGP fee of the origin ASN (if any) is taken from the wallet and the prefix is set up. Without a successful verification in 7 days the request expires.

**Required scope:** `byoip:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:create` | CLI: `byoip create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | yes | IPv4 /24–/22 or IPv6 /48–/32 network address. |
| `asn` | string | yes | Origin ASN (`AS64500` or number); use the platform ASN from the catalog if you have none. |
| `kind` | string: `leased`, `own` | yes | Prefix type. |
| `usage` | string: `vm`, `external` | no | Default `vm`. |
| `vm_id` | string | no | Required when `usage=vm` (unless `target_kind=dedicated`): VM (Ho Chi Minh City zone, running) to attach to the prefix once active. See `GET /v1/byoip/vms/eligible`. Same as `target_id` for a VM. |
| `target_kind` | string: `vm`, `dedicated` | no | What the prefix attaches to when `usage=vm`: a VM (default) or a Bare Metal server (IPv4 prefixes only). |
| `target_id` | string | no | Identifier of the VM or of the Bare Metal server (`ds_…`) to attach; Bare Metal must be yours, in the Ho Chi Minh City zone with an active subscription. |
| `agree_terms` | boolean | yes | You accept the IP usage terms (no spam, scans or abuse). |
| `note` | string | no | Note (≤ 500 characters). |

Example:

```json
{
  "agree_terms": true,
  "asn": "AS213035",
  "kind": "own",
  "prefix": "45.12.34.0/24",
  "vm_id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `terms_required` | `agree_terms` must be true. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 403 | `byoip_limit` | Maximum number of prefixes reached. |
| 404 | `not_found` | VM not found in your account. |
| 409 | `prefix_taken` | The prefix overlaps a prefix already verified by another account. Unverified requests of other accounts do not block you: the first request to pass verification keeps the prefix and the others are canceled. |
| 409 | `prefix_ours` | The prefix overlaps a range of the provider. |
| 409 | `prefix_duplicate` | You already registered this prefix or an overlapping one. |
| 409 | `vm_not_eligible` | VM must be running. |
| 409 | `l2_not_ready` | Own IP prefix: VM targets are not open yet; choose a Bare Metal server. Checked before anything is created. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `prefix_size` | Prefix length not accepted. |
| 422 | `prefix_bogon` | Special-use range. |
| 422 | `asn_invalid` | Not a public ASN. |
| 422 | `vm_required` | No VM selected (required when used on the platform). |
| 422 | `vm_zone_not_supported` | VM is not in the Ho Chi Minh City zone. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"agree_terms":true,"asn":"AS213035","kind":"own","prefix":"45.12.34.0/24","vm_id":"4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90"}'
```

---

#### Prefix details: verification results, instructions, VM setup

`GET /v1/byoip/{id}`

Prefix details: verification checks, the token to publish, ROA/IRR/LOA instructions, attachments and, once active, the VM configuration (policy routing, MTU).

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Verify again now (RPKI, IRR, token)

`POST /v1/byoip/{id}/verify`

Runs the verification now instead of waiting for the next automatic check (every 10 minutes). Limited to once per minute per prefix and 20 per hour per account. When it passes the prefix moves on (charge + setup) immediately.

**Required scope:** `byoip:write`.

Scope: `byoip:write` | CLI: `byoip verify`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `byoip_state` | Only prefixes in `pending_verify` can be verified. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/verify" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Request a manual review (when the token cannot be published)

`POST /v1/byoip/{id}/review-request`

Asks for a manual review when RPKI and IRR already pass but you cannot publish the token (for example a leased prefix whose whois you cannot edit). Attach the LOA reference in `note`.

**Required scope:** `byoip:write`.

Scope: `byoip:write` | CLI: `byoip review-request`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `note` | string | no | Message for the reviewer (≤ 1000 characters), e.g. the LOA reference. |

Example:

```json
{
  "note": "LOA 2026-10-22 issued to Example Ltd"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `verify_not_ready` | RPKI and IRR must pass first. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/review-request" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"note":"LOA 2026-10-22 issued to Example Ltd"}'
```

---

#### Cancel a prefix (remove the setup, withdraw BGP)

`POST /v1/byoip/{id}/cancel`

Cancels a prefix. Before it is charged the request simply ends; after that the setup is removed, the BGP announcement is withdrawn and VMs lose the addresses. The current month is not refunded; a setup that never became active is refunded. Requires `Idempotency-Key`.

**Required scope:** `byoip:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:destroy` | CLI: `byoip cancel` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `byoip_state` | The prefix already ended. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/cancel" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Prefix activity log

`GET /v1/byoip/{id}/events`

Activity log of a prefix (verification, charge, setup, BGP, attachments).

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip events`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |
| `dir` | string: `asc`, `desc` | no | Sort direction. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "args": {
        "asn": "213035",
        "kind": "own",
        "prefix": "45.12.34.0/24"
      },
      "at": 1761100000,
      "id": 1,
      "key": "byoip.requested",
      "kind": "requested",
      "msg": "Requested 45.12.34.0/24 with origin AS213035 (own)",
      "msg_key": "byoip.requested"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/<id>/events" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Own-IP attachment of a VM and sample configuration

`GET /v1/vm/{id}/byoip`

Own-IP state of a VM: whether it can be attached, the attachment, and the commands/netplan to configure each active prefix inside the VM (policy routing keeps the main default route of the VM).

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `vm byoip get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `eligible` | boolean | yes | This VM can receive the own-IP NIC (running VM). |
| `zone_ok` | boolean | yes | VM in the platform BGP zone (Ho Chi Minh City). |
| `network_ready` | boolean | yes | Your private own-IP network exists. |
| `attachment` | object or null | yes | Attachment state of this VM: `attaching`, `attached`, `detaching`, `failed`, plus `mac`. |
| `prefixes` | array of object | yes |  |
| `can_attach` | boolean | yes | Attach is possible now (false while VM targets are not open). |
| `l2_ready` | boolean | yes | `false` = VM targets are not open for own IP prefixes yet. |
| `can_detach` | boolean | yes | Detach is possible now. |

Example:

```json
{
  "attachment": null,
  "can_attach": true,
  "can_detach": false,
  "eligible": true,
  "enabled": true,
  "l2_ready": true,
  "network_ready": true,
  "prefixes": [
    {
      "family": 4,
      "gateway": "45.12.34.1",
      "id": 12,
      "kind": "own",
      "prefix": "45.12.34.0/24",
      "setup": {
        "commands": [
          "IF=$(ip -br link | awk '$3==\"02:00:aa:bb:cc:01\" {sub(/@.*/,\"\",$1); print $1}')",
          "ip link set dev \"$IF\" mtu 1450 up",
          "ip addr add 45.12.34.2/24 dev \"$IF\"",
          "ip route replace default via 45.12.34.1 dev \"$IF\" table 100",
          "ip rule add from 45.12.34.0/24 table 100"
        ],
        "example_ip": "45.12.34.2",
        "gateway": "45.12.34.1",
        "mac": "02:00:aa:bb:cc:01",
        "mtu": 1450
      }
    }
  ],
  "zone_ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/vm/<id>/byoip" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach your own-IP network to a VM (adds a NIC)

`POST /v1/vm/{id}/byoip/attach`

Adds a second NIC on your private own-IP network to the running VM (hot-plug). Then configure the addresses shown in `prefixes[].setup`. Requires `Idempotency-Key`; 10 attach/detach per minute.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `vm byoip attach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `eligible` | boolean | yes | This VM can receive the own-IP NIC (running VM). |
| `zone_ok` | boolean | yes | VM in the platform BGP zone (Ho Chi Minh City). |
| `network_ready` | boolean | yes | Your private own-IP network exists. |
| `attachment` | object or null | yes | Attachment state of this VM: `attaching`, `attached`, `detaching`, `failed`, plus `mac`. |
| `prefixes` | array of object | yes |  |
| `can_attach` | boolean | yes | Attach is possible now (false while VM targets are not open). |
| `l2_ready` | boolean | yes | `false` = VM targets are not open for own IP prefixes yet. |
| `can_detach` | boolean | yes | Detach is possible now. |

Example:

```json
{
  "attachment": null,
  "can_attach": true,
  "can_detach": false,
  "eligible": true,
  "enabled": true,
  "l2_ready": true,
  "network_ready": true,
  "prefixes": [
    {
      "family": 4,
      "gateway": "45.12.34.1",
      "id": 12,
      "kind": "own",
      "prefix": "45.12.34.0/24",
      "setup": {
        "commands": [
          "IF=$(ip -br link | awk '$3==\"02:00:aa:bb:cc:01\" {sub(/@.*/,\"\",$1); print $1}')",
          "ip link set dev \"$IF\" mtu 1450 up",
          "ip addr add 45.12.34.2/24 dev \"$IF\"",
          "ip route replace default via 45.12.34.1 dev \"$IF\" table 100",
          "ip rule add from 45.12.34.0/24 table 100"
        ],
        "example_ip": "45.12.34.2",
        "gateway": "45.12.34.1",
        "mac": "02:00:aa:bb:cc:01",
        "mtu": 1450
      }
    }
  ],
  "zone_ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `already_attached` | The VM is already attached. |
| 409 | `vm_not_eligible` | The VM must be running. |
| 409 | `l2_not_ready` | VM targets are not open yet; the VM cannot take the prefix now. |
| 409 | `no_byoip_network` | You have no active prefix yet. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/byoip/attach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Detach your own-IP network from a VM

`POST /v1/vm/{id}/byoip/detach`

Removes the own-IP NIC from the VM. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `vm byoip detach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 202** - Accepted. The work continues in the background.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | The site sells Bring Your Own IP. |
| `eligible` | boolean | yes | This VM can receive the own-IP NIC (running VM). |
| `zone_ok` | boolean | yes | VM in the platform BGP zone (Ho Chi Minh City). |
| `network_ready` | boolean | yes | Your private own-IP network exists. |
| `attachment` | object or null | yes | Attachment state of this VM: `attaching`, `attached`, `detaching`, `failed`, plus `mac`. |
| `prefixes` | array of object | yes |  |
| `can_attach` | boolean | yes | Attach is possible now (false while VM targets are not open). |
| `l2_ready` | boolean | yes | `false` = VM targets are not open for own IP prefixes yet. |
| `can_detach` | boolean | yes | Detach is possible now. |

Example:

```json
{
  "attachment": null,
  "can_attach": true,
  "can_detach": false,
  "eligible": true,
  "enabled": true,
  "l2_ready": true,
  "network_ready": true,
  "prefixes": [
    {
      "family": 4,
      "gateway": "45.12.34.1",
      "id": 12,
      "kind": "own",
      "prefix": "45.12.34.0/24",
      "setup": {
        "commands": [
          "IF=$(ip -br link | awk '$3==\"02:00:aa:bb:cc:01\" {sub(/@.*/,\"\",$1); print $1}')",
          "ip link set dev \"$IF\" mtu 1450 up",
          "ip addr add 45.12.34.2/24 dev \"$IF\"",
          "ip route replace default via 45.12.34.1 dev \"$IF\" table 100",
          "ip rule add from 45.12.34.0/24 table 100"
        ],
        "example_ip": "45.12.34.2",
        "gateway": "45.12.34.1",
        "mac": "02:00:aa:bb:cc:01",
        "mtu": 1450
      }
    }
  ],
  "zone_ok": true
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `not_attached` | The VM is not attached. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/vm/<id>/byoip/detach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### VMs eligible for own IP prefix (Ho Chi Minh City zone)

`GET /v1/byoip/vms/eligible`

Your VMs eligible for own IP prefix (Ho Chi Minh City zone). `eligible=false` = VM is not running.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip vms eligible`

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `dedicated` | array of object | yes |  |
| `zones` | array of string | yes |  |
| `l2_ready` | boolean | yes | `false` = VM targets are not open for own IP prefixes yet (Bare Metal still works): VMs in `items` cannot be selected. |

Example:

```json
{
  "dedicated": [
    {
      "eligible": true,
      "id": "ds_3f9a1c2b7d4e5a60",
      "name": "dell-105",
      "public_ip": "23.132.252.247",
      "state": "active"
    }
  ],
  "items": [
    {
      "eligible": true,
      "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
      "name": "web-1",
      "public_ip": "203.0.113.10",
      "state": "active"
    }
  ],
  "l2_ready": true,
  "zones": [
    "vn-hcm"
  ]
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/vms/eligible" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attached VM + IP configuration commands

`GET /v1/byoip/{id}/vms`

Attached VMs, NIC statuses, and IP configuration commands inside each VM.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip vms list`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `needs_vm` | boolean | yes | Prefix is active, but no running VM is attached. |
| `can_bind` | boolean | yes | Can attach, detach, or transfer VMs at this time. |

Example:

```json
{
  "can_bind": true,
  "items": [
    {
      "bound_at": 1761100000,
      "nic": "attached",
      "setup": null,
      "vm": {
        "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
        "name": "web-1",
        "public_ip": "203.0.113.10",
        "state": "active"
      }
    }
  ],
  "needs_vm": false
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/<id>/vms" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach prefix to an additional VM

`POST /v1/byoip/{id}/vms`

Attach the prefix to another VM in your Ho Chi Minh City zone (a prefix can attach to multiple VMs). A second NIC is added while the prefix is active. Requires `Idempotency-Key`; 10 attach/detach/transfer operations per minute.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `byoip vms bind` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `target_kind` | string: `vm`, `dedicated` | no | VM (default) or Bare Metal server. |
| `target_id` | string | no | VM or Bare Metal server to attach. |
| `vm_id` | string | no | Same as `target_id` for a VM (kept for older clients). |

Example:

```json
{
  "target_id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
  "target_kind": "vm"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | Prefix or VM not found in your account. |
| 409 | `vm_not_eligible` | VM must be running. |
| 409 | `l2_not_ready` | VM targets are not open yet; only a Bare Metal server can be attached now. |
| 409 | `already_bound` | Prefix is already attached to this VM. |
| 409 | `byoip_state` | Prefix has ended or is not used on a VM. |
| 409 | `target_not_active` | The Bare Metal subscription is not active (suspended or locked). |
| 409 | `target_mixed` | A prefix attaches to VMs or to a Bare Metal server, not both; use move. |
| 409 | `target_busy` | A prefix attaches to one Bare Metal server only. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `vm_required` | No VM selected. |
| 422 | `vm_zone_not_supported` | VM is not in the Ho Chi Minh City zone. |
| 422 | `target_required` | No Bare Metal server selected. |
| 422 | `target_zone_not_supported` | The Bare Metal server is not in the Ho Chi Minh City zone. |
| 422 | `target_family_not_supported` | Bare Metal servers take IPv4 prefixes only. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/vms" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"target_id":"4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90","target_kind":"vm"}'
```

---

#### Detach prefix from VM (last VM ⇒ prefix pending attachment, BGP retained)

`DELETE /v1/byoip/{id}/vms/{vm}`

Detach prefix from a VM. Detaching the last VM ⇒ prefix waits for another VM (`needs_vm`), BGP remains active. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `byoip vms detach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |
| `vm` | string | yes | Identifier of the resource. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_bound` | Prefix is not attached to this VM. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/byoip/<id>/vms/<vm>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### Own-IP prefixes attached to this Bare Metal server + OS-specific IP commands + free prefixes

`GET /v1/dedicated/{id}/byoip`

Prefixes attached to this Bare Metal server, the commands that add their IPs to the operating system of the server (`setup`: Linux or Windows, as the server reports), and your free IPv4 prefixes that could be attached. A prefix is ROUTED to the primary IP of the server (no virtual network card). Attaching and detaching never charge anything.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `dedicated byoip`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Own IP service is open for your account. |
| `eligible` | boolean | yes | This server can take a prefix: yours, in the Ho Chi Minh City zone, subscription active. |
| `reason` | string or null | no | Why not: `not_found`, `target_zone_not_supported` or `target_not_active`. |
| `prefixes` | array of object | yes |  |
| `available` | array of object | yes |  |
| `can_attach` | boolean | yes | A free prefix can be attached now. |
| `can_detach` | boolean | yes | At least one prefix is attached. |
| `one_machine_per_prefix` | boolean | yes | Always true: a prefix attaches to one Bare Metal server. |

Example:

```json
{
  "available": [],
  "can_attach": false,
  "can_detach": true,
  "eligible": true,
  "enabled": true,
  "one_machine_per_prefix": true,
  "prefixes": [
    {
      "asn": 401617,
      "bgp": {
        "announce": true,
        "roa": "valid"
      },
      "id": 12,
      "kind": "leased",
      "prefix": "45.12.34.0/24",
      "setup": {
        "commands": [
          "ip addr add 45.12.34.1/32 dev eth0"
        ],
        "example_ip": "45.12.34.1",
        "mode": "routed",
        "os": "linux",
        "prefix": "45.12.34.0/24",
        "routed_via": "23.132.252.247"
      },
      "state": "active"
    }
  ],
  "reason": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The server does not exist or is not assigned to you. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/dedicated/<id>/byoip" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Attach a free IPv4 prefix to this Bare Metal server (free of charge)

`POST /v1/dedicated/{id}/byoip/attach`

Attach one of your free IPv4 prefixes to this Bare Metal server. Free of charge. A prefix attached to VMs must be moved (see [Move a prefix](#operation/byoip_vms_move)). Requires `Idempotency-Key`; 10 operations per minute.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `dedicated byoip attach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix_id` | integer | yes | Prefix to attach (see `available`). |

Example:

```json
{
  "prefix_id": 12
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Own IP service is open. |
| `eligible` | boolean | yes | The server can take a prefix. |
| `reason` | string or null | no | Why not. |
| `prefixes` | array of object | yes |  |
| `available` | array of object | yes |  |
| `can_attach` | boolean | yes | A free prefix can be attached. |
| `can_detach` | boolean | yes | A prefix is attached. |
| `one_machine_per_prefix` | boolean | yes | Always true. |

Example:

```json
{
  "available": [],
  "can_attach": false,
  "can_detach": false,
  "eligible": true,
  "enabled": true,
  "one_machine_per_prefix": true,
  "prefixes": [],
  "reason": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server or the prefix is not yours. |
| 409 | `target_mixed` | The prefix is attached to VMs; use move. |
| 409 | `target_busy` | The prefix is attached to another Bare Metal server. |
| 409 | `target_not_active` | The subscription of the server is not active. |
| 409 | `already_bound` | The prefix is already attached to this server. |
| 409 | `byoip_state` | The prefix has ended or is not used on the platform. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `target_zone_not_supported` | The server is not in the Ho Chi Minh City zone. |
| 422 | `target_family_not_supported` | Only IPv4 prefixes can be attached to Bare Metal. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped). |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/byoip/attach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"prefix_id":12}'
```

---

#### Detach a prefix from this Bare Metal server (prefix waits for attachment, BGP kept)

`POST /v1/dedicated/{id}/byoip/detach`

Detach a prefix from this Bare Metal server. The prefix waits for a new attachment (`needs_vm`) and BGP stays active, but traffic is no longer sent to any machine. Free of charge. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `dedicated byoip detach` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix_id` | integer | yes | Prefix to detach. |

Example:

```json
{
  "prefix_id": 12
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `enabled` | boolean | yes | Own IP service is open. |
| `eligible` | boolean | yes | The server can take a prefix. |
| `reason` | string or null | no | Why not. |
| `prefixes` | array of object | yes |  |
| `available` | array of object | yes |  |
| `can_attach` | boolean | yes | A free prefix can be attached. |
| `can_detach` | boolean | yes | A prefix is attached. |
| `one_machine_per_prefix` | boolean | yes | Always true. |

Example:

```json
{
  "available": [
    {
      "asn": 401617,
      "id": 12,
      "prefix": "45.12.34.0/24",
      "state": "active"
    }
  ],
  "can_attach": true,
  "can_detach": false,
  "eligible": true,
  "enabled": true,
  "one_machine_per_prefix": true,
  "prefixes": [],
  "reason": null
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The server or the prefix is not yours, or the prefix is not attached to it. |
| 409 | `byoip_state` | The prefix has ended. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 423 | `dedicated_server_locked` | The service is locked by support (or the account is stopped). |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/dedicated/<id>/byoip/detach" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"prefix_id":12}'
```

---

#### Move prefix from one VM to another in one step

`POST /v1/byoip/{id}/move`

Transfer the prefix from this VM to another of your VMs (Ho Chi Minh City zone) in one step: detaches old VM and attaches new VM simultaneously. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `byoip vms move` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `from_id` | string | no | Currently attached VM or Bare Metal server. |
| `to_id` | string | no | New VM or Bare Metal server. |
| `to_kind` | string: `vm`, `dedicated` | no | Kind of the new target (default `vm`); VM to Bare Metal and back are allowed. |
| `from_vm_id` | string | no | Same as `from_id` (older clients). |
| `to_vm_id` | string | no | Same as `to_id` for a VM (older clients). |

Example:

```json
{
  "from_id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
  "to_id": "ds_3f9a1c2b7d4e5a60",
  "to_kind": "dedicated"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_bound` | Prefix is not attached to the old VM. |
| 404 | `not_found` | Prefix or new VM not found in your account. |
| 409 | `already_bound` | Prefix is already attached to the new VM. |
| 409 | `target_mixed` | The other attachments of the prefix are of a different kind. |
| 409 | `target_busy` | A prefix attaches to one Bare Metal server only. |
| 409 | `target_not_active` | The Bare Metal subscription is not active. |
| 409 | `l2_not_ready` | Moving to a VM is not open yet; moving to a Bare Metal server is not affected. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `vm_zone_not_supported` | New VM is not in the Ho Chi Minh City zone. |
| 422 | `target_zone_not_supported` | The Bare Metal server is not in the Ho Chi Minh City zone. |
| 422 | `target_family_not_supported` | Bare Metal servers take IPv4 prefixes only. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/move" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"from_id":"4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90","to_id":"ds_3f9a1c2b7d4e5a60","to_kind":"dedicated"}'
```

---

#### Request prefix attachment to Private Cloud (manually set up by network team)

`POST /v1/byoip/{id}/vpc-requests`

Request to attach prefix to your Private Cloud (VPC). The network team sets it up manually within 1–2 business days and reports results in the prefix logs. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `byoip vpc request` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `vpc_id` | string | yes | Your Private Cloud. |
| `note` | string | no | Note for the network team (≤ 500 characters). |

Example:

```json
{
  "note": "tier web",
  "vpc_id": "9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | Prefix or Private Cloud not found in your account. |
| 409 | `vpc_request_open` | A request is already pending. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `invalid_argument` | A field is missing, malformed or out of range. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/<id>/vpc-requests" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"note":"tier web","vpc_id":"9c8b7a6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"}'
```

---

#### Cancel pending Private Cloud attachment request

`DELETE /v1/byoip/{id}/vpc-requests/{rid}`

Cancel a pending Private Cloud attachment request. Requires `Idempotency-Key`.

**Required scope:** `byoip:write`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:write` | CLI: `byoip vpc request delete` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |
| `rid` | string | yes | Identifier of the resource. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `byoip` | Byoip | yes | An own IP prefix registered for BGP announcement. |
| `byoip.id` | integer | yes | Prefix identifier. |
| `byoip.prefix` | string | yes | Normalised prefix, e.g. `45.12.34.0/24` or `2a0e:1c80::/48`. |
| `byoip.family` | integer | yes | Address family: 4 or 6. |
| `byoip.kind` | string: `leased`, `own` | yes | `leased` = leased from an IP provider, `own` = held by your organisation. |
| `byoip.kind_label` | string | yes | Display label of the type. |
| `byoip.usage` | string: `vm`, `external` | yes | `vm` = used on VMs of this platform; `external` = announced only (manual setup). |
| `byoip.asn` | integer | yes | Origin ASN announced for the prefix. |
| `byoip.state` | string: `pending_verify`, `needs_review`, `awaiting_payment`, `awaiting_build`, `provisioning`, `active`, `suspended`, `terminating`, `terminated`, `expired`, `canceled`, `rejected`, `failed` | yes | Lifecycle state. Nothing is charged before `provisioning`. |
| `byoip.gateway` | string or null | yes | Gateway address on the private L2 network (`.1` / `::1`). `null` for a prefix routed to a Bare Metal server (`routed` is true): the server keeps its current gateway. |
| `byoip.routed` | boolean | no | True when the prefix is routed to a Bare Metal server through its primary IP: there is no private network and no gateway to configure. |
| `byoip.public_error` | string or null | yes | Why the prefix is waiting/blocked: `insufficient_funds`, `vm_required`, `capacity`, `infra_pending`, `applying`, `removing`, `provision_failed`… |
| `byoip.review_reason` | string or null | no | Reason of the manual review (`announced_by_other`, `blocklisted`, `provider_declared_own`, `customer_request`). |
| `byoip.suspend_reason` | string or null | no | `unpaid`, `no_vm` or `admin`. |
| `byoip.bgp` | object | yes | BGP status: `announce`, `withdraw_reason`, `roa`, `ris_peers_seeing`, `propagated_at`. |
| `byoip.verify` | object | yes | Verification progress: `attempts`, `checked_at`, `next_check_at`, `expires_at`, `verified_at`. |
| `byoip.can` | object | yes | Allowed actions now: `verify`, `review_request`, `cancel`, `attach`, `bind`. |
| `byoip.needs_vm` | boolean | yes | Prefix is active, but no running VM or Bare Metal server is attached — select another target (BGP remains active). |
| `byoip.target_kind` | string or null: `vm`, `dedicated` | yes | What the prefix is attached to: VMs, or one Bare Metal server (routed to its primary IP); `null` when nothing is attached. |
| `byoip.checks` | object | no | Last verification result per check (`rpki`, `irr`, `proof`, `routing`, `blocklist`, `kind_hint`). Detail only. |
| `byoip.token` | string | no | Verification token (publish `byoip-verify=<token>`). Detail only. |
| `byoip.instructions` | object | no | ROA, IRR object text and the LOA values to request from your IP provider. Detail only. |
| `byoip.setup` | object or null | no | Sample VM configuration once active (`commands`, `netplan`, `mtu`). Detail only. |
| `byoip.attachments` | array of object | no |  |
| `byoip.vms` | array of object | no |  |
| `byoip.vpc_requests` | array of object | no |  |
| `byoip.billing` | object | no | `charged_cents`, current ASN subscription period and prices (VND list price). |
| `byoip.created_at` | integer | yes | Creation time (Unix time, seconds, UTC) |
| `byoip.activated_at` | integer or null | yes | Activation time (Unix time, seconds, UTC) |
| `byoip.ended_at` | integer or null | yes | End time (Unix time, seconds, UTC) |
| `byoip.updated_at` | integer | yes | Last update (Unix time, seconds, UTC) |

Example:

```json
{
  "byoip": {
    "activated_at": null,
    "asn": 213035,
    "attachments": [],
    "bgp": {
      "announce": false,
      "propagated_at": null,
      "ris_peers_seeing": null,
      "roa": null,
      "withdraw_reason": null
    },
    "billing": {
      "charged_cents": 0,
      "month_vnd": 0,
      "setup_vnd": 0,
      "subscription": null
    },
    "can": {
      "attach": false,
      "bind": true,
      "cancel": true,
      "review_request": false,
      "verify": true
    },
    "checks": {
      "blocklist": {
        "checked": true,
        "ok": true
      },
      "irr": {
        "ok": true,
        "origins": [
          213035
        ],
        "sources": [
          "RADB"
        ]
      },
      "kind_hint": {
        "ok": true
      },
      "proof": {
        "ok": false,
        "token": "byoip-verify=0123456789abcdef",
        "via": "none"
      },
      "routing": {
        "ok": true,
        "origins": []
      },
      "rpki": {
        "ok": false,
        "status": "unknown"
      }
    },
    "created_at": 1761100000,
    "ended_at": null,
    "family": 4,
    "gateway": null,
    "id": 12,
    "instructions": {
      "irr": {
        "object": "route",
        "text": "route: 45.12.34.0/24\norigin: AS213035"
      },
      "roa": {
        "max_length": 24,
        "origin_asn": 213035,
        "prefix": "45.12.34.0/24"
      },
      "token_line": "byoip-verify=0123456789abcdef"
    },
    "kind": "own",
    "kind_label": "Own IP",
    "needs_vm": false,
    "prefix": "45.12.34.0/24",
    "public_error": null,
    "setup": null,
    "state": "pending_verify",
    "target_kind": "vm",
    "token": "0123456789abcdef",
    "updated_at": 1761100000,
    "usage": "vm",
    "verify": {
      "attempts": 1,
      "checked_at": 1761100000,
      "expires_at": 1761704800,
      "next_check_at": 1761100600,
      "verified_at": null
    },
    "vms": [
      {
        "bound_at": 1761100000,
        "nic": "pending",
        "setup": null,
        "vm": {
          "id": "4f1c2b7e-0d5a-4b8e-9a51-2f6c1d3e7a90",
          "name": "web-1",
          "public_ip": "203.0.113.10",
          "state": "active"
        }
      }
    ],
    "vpc_requests": []
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | Pending request not found. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X DELETE "https://api.onie.net/v1/byoip/<id>/vpc-requests/<rid>" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

#### IPv4 subnets for sale (public, monthly price plus a one-time setup fee)

`GET /v1/public/ip-subnets`

IPv4 subnets for sale (/24–/22, RPKI managed automatically), public — no login. Prices are the final monthly price in US cents; `setup_cents` is charged once per subnet. Filter, sort and page on the server.

**Required scope:** `catalog:read`.

Scope: `catalog:read` | CLI: `ip-subnets market`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | no | Exactly this subnet (for example `45.12.34.0/24`). |
| `len` | string: `24`, `23`, `22` | no | Prefix length. |
| `rir` | string: `afrinic`, `apnic`, `arin`, `lacnic`, `ripencc` | no | Registry. |
| `country` | string | no | Geolocation country (ISO 3166-1 alpha-2). |
| `price_max_cents` | string | no | Maximum monthly price in US cents. |
| `sort` | string: `price`, `-price`, `address`, `-address`, `country`, `len` | no | Sort order. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `available` | boolean | yes | Subnets are on sale on this site now. |
| `items` | array of object | yes |  |
| `total` | integer | yes | Matching subnets. |
| `page` | integer | yes | Page. |
| `per_page` | integer | yes | Page size. |
| `updated_at` | integer or null | no | When the market list was refreshed (unix seconds). |
| `filters` | object | no | Values available for `rir`, `country`, `len`. |
| `balance_cents` | integer | no | Your wallet balance (logged in only). |
| `platform_asn` | integer | no | Platform ASN for routing at this platform (logged in only). |

Example:

```json
{
  "available": true,
  "filters": {
    "countries": [
      "NL"
    ],
    "lens": [
      24,
      23,
      22
    ],
    "rirs": [
      "ripencc"
    ]
  },
  "items": [
    {
      "city": "Amsterdam",
      "country": "NL",
      "id": "45.12.34.0/24",
      "ips": 256,
      "prefix": "45.12.34.0/24",
      "prefix_len": 24,
      "price_cents": 7997,
      "rir": "ripencc",
      "rpki": "automated",
      "setup_cents": 1150
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1,
  "updated_at": 1761100000
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/public/ip-subnets" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### IPv4 subnets for sale priced for your account

`GET /v1/byoip/subnets/market`

Same list as the public market, priced for your account, plus your wallet balance and the platform ASN you may use for routing at this platform.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip subnets market`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | no | Exactly this subnet (for example `45.12.34.0/24`). |
| `len` | string: `24`, `23`, `22` | no | Prefix length. |
| `rir` | string: `afrinic`, `apnic`, `arin`, `lacnic`, `ripencc` | no | Registry. |
| `country` | string | no | Geolocation country (ISO 3166-1 alpha-2). |
| `price_max_cents` | string | no | Maximum monthly price in US cents. |
| `sort` | string: `price`, `-price`, `address`, `-address`, `country`, `len` | no | Sort order. |
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `available` | boolean | yes | Subnets are on sale on this site now. |
| `items` | array of object | yes |  |
| `total` | integer | yes | Matching subnets. |
| `page` | integer | yes | Page. |
| `per_page` | integer | yes | Page size. |
| `updated_at` | integer or null | no | When the market list was refreshed (unix seconds). |
| `filters` | object | no | Values available for `rir`, `country`, `len`. |
| `balance_cents` | integer | no | Your wallet balance (logged in only). |
| `platform_asn` | integer | no | Platform ASN for routing at this platform (logged in only). |

Example:

```json
{
  "available": true,
  "filters": {
    "countries": [
      "NL"
    ],
    "lens": [
      24,
      23,
      22
    ],
    "rirs": [
      "ripencc"
    ]
  },
  "items": [
    {
      "city": "Amsterdam",
      "country": "NL",
      "id": "45.12.34.0/24",
      "ips": 256,
      "prefix": "45.12.34.0/24",
      "prefix_len": 24,
      "price_cents": 7997,
      "rir": "ripencc",
      "rpki": "automated",
      "setup_cents": 1150
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1,
  "updated_at": 1761100000
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/subnets/market" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Your IPv4 subnet orders

`GET /v1/byoip/subnets`

Your subnet orders, newest first.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip subnets list`

**Query parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | no | Page number, starting at 1. |
| `per_page` | integer | no | Items per page. Values above the maximum are clamped. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `items` | array of object | yes |  |
| `total` | integer | yes | Total number of items matching the filters, across all pages. |
| `page` | integer | yes | Current page number (1-based). |
| `per_page` | integer | yes | Page size actually applied (the server clamps `per_page` to its maximum). |

Example:

```json
{
  "items": [
    {
      "activated_at": null,
      "asn": 213035,
      "asn_assigned": true,
      "byoip_id": null,
      "can": {
        "cancel": true
      },
      "country": "NL",
      "created_at": 1761100000,
      "ended_at": null,
      "id": 7,
      "mode": "idc",
      "period_from": 1761100000,
      "period_to": 1763778400,
      "prefix": "45.12.34.0/24",
      "prefix_len": 24,
      "price_cents": 7997,
      "public_error": null,
      "purchased_at": null,
      "rir": "ripencc",
      "setup_cents": 1150,
      "state": "paid"
    }
  ],
  "page": 1,
  "per_page": 25,
  "total": 1
}
```

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/subnets" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Order an IPv4 subnet (charges the first month and the setup fee)

`POST /v1/byoip/subnets`

Orders a subnet from the market. Requires `Idempotency-Key` and `agree_terms: true`. The first month and the setup fee are taken from the wallet now; the subnet is leased in the background and becomes `active` once its LOA is in place. `mode`: `idc` — use it at your own data center (the ASN is optional: leave it out and assign it later with `POST /v1/byoip/subnets/:id/asn`; if given, the RPKI fee is taken now); `platform` — route it at this platform (LOA for the platform ASN or your ASN; a Bring Your Own IP prefix is created for it, BGP at no extra fee).

**Required scope:** `byoip:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:create` | CLI: `byoip subnets create` | Idempotency-Key: required | Destructive or costs money

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `prefix` | string | yes | Subnet from the market list (`id`). |
| `mode` | string: `idc`, `platform` | yes | Where you use the subnet. |
| `asn` | string | no | Origin ASN for the LOA. Optional for `idc` (assign later; giving it now charges the one-time RPKI fee at once); default for `platform` is the platform ASN. |
| `expected_rpki_fee_cents` | integer | no | Optional price guard: the RPKI fee you saw for an `idc` order with an ASN; 409 `price_changed` if it differs. |
| `vm_id` | string | no | Required for `platform` (unless `target_kind=dedicated`): VM (Ho Chi Minh City zone, running) to attach to the prefix once active. |
| `target_kind` | string: `vm`, `dedicated` | no | For `platform`: attach to a VM (default) or to a Bare Metal server of yours in the Ho Chi Minh City zone. |
| `target_id` | string | no | VM identifier, or Bare Metal server identifier (`ds_…`) with `target_kind=dedicated`. |
| `agree_terms` | boolean | yes | You accept the IP usage terms (no spam, scans or abuse). |

Example:

```json
{
  "agree_terms": true,
  "asn": "AS213035",
  "mode": "idc",
  "prefix": "45.12.34.0/24"
}
```

**Response 201** - Created.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subnet` | object | yes | Subnet order. |

Example:

```json
{
  "subnet": {
    "activated_at": null,
    "asn": 213035,
    "asn_assigned": true,
    "byoip_id": null,
    "can": {
      "cancel": true
    },
    "country": "NL",
    "created_at": 1761100000,
    "ended_at": null,
    "id": 7,
    "mode": "idc",
    "period_from": 1761100000,
    "period_to": 1763778400,
    "prefix": "45.12.34.0/24",
    "prefix_len": 24,
    "price_cents": 7997,
    "public_error": null,
    "purchased_at": null,
    "rir": "ripencc",
    "setup_cents": 1150,
    "state": "paid"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `terms_required` | `agree_terms` must be true. |
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Not enough balance for the first month and the setup fee. |
| 403 | `subnet_limit` | Maximum number of subnets reached. |
| 404 | `not_found` | VM not found in your account. |
| 409 | `subnet_taken` | Someone else is ordering this subnet. |
| 409 | `vm_not_eligible` | VM must be running. |
| 409 | `l2_not_ready` | Subnet with a VM target: VM targets are not open yet; choose a Bare Metal server. Checked before the wallet is charged. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `subnet_unavailable` | The subnet is no longer on the market — refresh the list. |
| 422 | `asn_invalid` | Not a public ASN (for `idc` use your own ASN). |
| 422 | `asn_rejected` | The ASN cannot be used for an LOA (unknown or on a blocklist). |
| 422 | `vm_required` | `platform` requires selecting a VM. |
| 422 | `vm_zone_not_supported` | VM is not in the Ho Chi Minh City zone. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/subnets" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"agree_terms":true,"asn":"AS213035","mode":"idc","prefix":"45.12.34.0/24"}'
```

---

#### Subnet order details

`GET /v1/byoip/subnets/{id}`

One subnet order: state, price, billing period and, for `platform`, the Bring Your Own IP prefix created for it (`byoip_id`). `asn_info` carries the assigned ASN (`null` until you assign one), the RPKI state (`none`, `processing`, `pending`, `valid`), the assignment history with LOA numbers and what you can do now (`can.assign`, `can.loa`); `events` is the milestone history, newest first.

**Required scope:** `byoip:read`.

Scope: `byoip:read` | CLI: `byoip subnets get`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subnet` | object | yes | Subnet order. |
| `asn_info` | object | yes | ASN/RPKI/LOA state. |
| `events` | array of object | yes |  |

Example:

```json
{
  "asn_info": {
    "asn": 213035,
    "assigned": true,
    "can": {
      "assign": true,
      "loa": true
    },
    "fee_cents": 2000,
    "rpki": "valid"
  },
  "events": [
    {
      "args": {},
      "at": 1761100000,
      "key": "ordered"
    }
  ],
  "subnet": {
    "activated_at": null,
    "asn": 213035,
    "asn_assigned": true,
    "byoip_id": null,
    "can": {
      "cancel": true
    },
    "country": "NL",
    "created_at": 1761100000,
    "ended_at": null,
    "id": 7,
    "mode": "idc",
    "period_from": 1761100000,
    "period_to": 1763778400,
    "prefix": "45.12.34.0/24",
    "prefix_len": 24,
    "price_cents": 7997,
    "public_error": null,
    "purchased_at": null,
    "rir": "ripencc",
    "setup_cents": 1150,
    "state": "paid"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |

**Example request**

```bash
curl "https://api.onie.net/v1/byoip/subnets/<id>" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Check the RPKI status of a subnet now (RIPEstat)

`POST /v1/byoip/subnets/{id}/rpki-check`

Checks the RPKI state of the subnet right now (RIPEstat `rpki-validation` for the assigned ASN) and returns the subnet with `asn_info.rpki_check`: `state` (`none`, `processing`, `pending` = the ROA is being created, `valid`, `invalid` = the ASN or max length does not match, `not_found` = no ROA yet, `error` = the source could not be reached and there is no earlier result), the ASN, prefix and max length checked, `checked_at`, and the ROAs seen. A failed check never overwrites an earlier result (`stale_error`). The subnet is also checked automatically (every 10 minutes while waiting for the ROA, every 6 hours once valid) and you are notified when the state changes. Limited to once per 60 seconds per subnet (429 with `retry_after`) and 30 per hour per account. Requires an assigned ASN with an issued LOA.

**Required scope:** `byoip:write`.

Scope: `byoip:write` | CLI: `byoip subnets rpki-check`

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subnet` | object | yes | Subnet order. |
| `asn_info` | object | yes | ASN/RPKI/LOA state including `rpki_check`. |
| `events` | array of object | yes |  |
| `checked` | boolean | yes | `false` when the source was unreachable (the earlier state is kept). |

Example:

```json
{
  "asn_info": {
    "asn": 213035,
    "assigned": true,
    "can": {
      "assign": true,
      "check": true,
      "loa": true
    },
    "rpki": "valid",
    "rpki_check": {
      "asn": 213035,
      "checked_at": 1761100000,
      "error": null,
      "max_len": 24,
      "prefix": "45.12.34.0/24",
      "roas": [
        {
          "max_length": 24,
          "origin": "213035",
          "validity": "valid"
        }
      ],
      "stale_error": false,
      "state": "valid"
    }
  },
  "checked": true,
  "events": [],
  "subnet": {
    "activated_at": null,
    "asn": 213035,
    "asn_assigned": true,
    "byoip_id": null,
    "can": {
      "cancel": true
    },
    "country": "NL",
    "created_at": 1761100000,
    "ended_at": null,
    "id": 7,
    "mode": "idc",
    "period_from": 1761100000,
    "period_to": 1763778400,
    "prefix": "45.12.34.0/24",
    "prefix_len": 24,
    "price_cents": 7997,
    "public_error": null,
    "purchased_at": null,
    "rir": "ripencc",
    "setup_cents": 1150,
    "state": "paid"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 404 | `not_found` | Subnet not found. |
| 409 | `loa_not_ready` | No ASN with an issued LOA yet. |
| 429 | `rate_limited` | Once per 60 seconds per subnet (`retry_after` in seconds) and 30 per hour per account. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/subnets/<id>/rpki-check" \
  -H "Authorization: Bearer $API_KEY"
```

---

#### Assign or change the ASN of a subnet (one-time RPKI fee per assignment, we issue the LOA)

`POST /v1/byoip/subnets/{id}/asn`

Assigns (or changes) the origin ASN of a subnet you use at your own data center (`mode: idc`, state `active`). A one-time RPKI fee (`asn_info.fee_cents`) is taken from the wallet for EVERY assignment or change; we then issue the Letter of Authorization (LOA) for the new ASN and publish the ROA. Changing the ASN replaces the previous LOA (the old letter is marked superseded). If the provider rejects the ASN the fee is refunded automatically. The ROA becomes valid within minutes to a few hours (`asn_info.rpki`: `processing` → `pending` → `valid`). The LOA PDF is downloaded from the console once issued. Requires `Idempotency-Key`.

**Required scope:** `byoip:create`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:create` | CLI: `byoip subnets asn` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Request body** (`application/json`)

| Field | Type | Required | Description |
|---|---|---|---|
| `asn` | string | yes | Public origin ASN (`AS64500` or `64500`). Not private/documentation ASNs and not the platform ASNs. |
| `expected_fee_cents` | integer | no | Optional price guard: the fee you saw; 409 `price_changed` if it differs. |

Example:

```json
{
  "asn": "AS213035",
  "expected_fee_cents": 2000
}
```

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subnet` | object | yes | Subnet order. |
| `asn_info` | object | yes | ASN/RPKI/LOA state: `assigned`, `asn`, `rpki`, `current`, `history[]`, `fee_cents`, `can`. |
| `events` | array of object | yes |  |
| `fee_cents` | integer | yes | Fee charged now. |

Example:

```json
{
  "asn_info": {
    "asn": 213035,
    "assigned": true,
    "can": {
      "assign": false,
      "loa": false
    },
    "fee_cents": 2000,
    "rpki": "processing"
  },
  "events": [],
  "fee_cents": 2000,
  "subnet": {
    "activated_at": null,
    "asn": 213035,
    "asn_assigned": true,
    "byoip_id": null,
    "can": {
      "cancel": true
    },
    "country": "NL",
    "created_at": 1761100000,
    "ended_at": null,
    "id": 7,
    "mode": "idc",
    "period_from": 1761100000,
    "period_to": 1763778400,
    "prefix": "45.12.34.0/24",
    "prefix_len": 24,
    "price_cents": 7997,
    "public_error": null,
    "purchased_at": null,
    "rir": "ripencc",
    "setup_cents": 1150,
    "state": "paid"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 402 | `insufficient_funds` | Not enough balance for the RPKI fee. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `byoip_state` | The subnet must be `active` (not leasing, in grace or ended). |
| 409 | `byoip_busy` | A previous assignment is still being processed. |
| 409 | `asn_same` | This ASN is already assigned. |
| 409 | `price_changed` | The fee changed since you looked. |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `asn_invalid` | Not a public ASN. |
| 422 | `asn_rejected` | The ASN cannot be used for an LOA (unknown or on a blocklist) — nothing was charged. |
| 422 | `asn_mode` | Only `idc` subnets take an ASN (platform subnets use the platform ASN). |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |
| 503 | `byoip_unavailable` | Bring Your Own IP is not available on this site yet. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/subnets/<id>/asn" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"asn":"AS213035","expected_fee_cents":2000}'
```

---

#### Cancel a subnet (before leasing: full refund; in use: stop renewal)

`POST /v1/byoip/subnets/{id}/cancel`

Before the subnet is leased (`paid`): cancels and refunds everything. In use (`active`, `grace`): stops renewal at the end of the paid month (no refund). Requires `Idempotency-Key`.

**Required scope:** `byoip:destroy`. **Requires the `Idempotency-Key` header** because this operation charges money or cannot be repeated safely.

Scope: `byoip:destroy` | CLI: `byoip subnets cancel` | Idempotency-Key: required | Destructive or costs money

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Prefix identifier (integer) — for `/v1/vm/:id/byoip…` it is the VM UUID. |

**Response 200** - Success.

| Field | Type | Always present | Description |
|---|---|---|---|
| `subnet` | object | yes | Subnet order. |
| `refund_cents` | integer | no | Refunded amount (before leasing). |

Example:

```json
{
  "subnet": {
    "activated_at": null,
    "asn": 213035,
    "asn_assigned": true,
    "byoip_id": null,
    "can": {
      "cancel": true
    },
    "country": "NL",
    "created_at": 1761100000,
    "ended_at": null,
    "id": 7,
    "mode": "idc",
    "period_from": 1761100000,
    "period_to": 1763778400,
    "prefix": "45.12.34.0/24",
    "prefix_len": 24,
    "price_cents": 7997,
    "public_error": null,
    "purchased_at": null,
    "rir": "ripencc",
    "setup_cents": 1150,
    "state": "paid"
  }
}
```

**Errors specific to this operation** (401, 403 and 429 apply to every operation)

| Status | Code | Meaning |
|---|---|---|
| 400 | `idempotency_key_required` | The `Idempotency-Key` header is missing or longer than 200 characters. |
| 404 | `not_found` | The resource does not exist, or it belongs to another account (the two cases are indistinguishable on purpose). |
| 409 | `byoip_state` | Not possible in the current state (lease in progress). |
| 409 | `idempotency_in_progress` | Another request with the same `Idempotency-Key` is still running. Wait a moment and send the same key again to receive its result. |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was already used for a different operation. Use a fresh key for each distinct operation. |

**Example request**

```bash
curl -X POST "https://api.onie.net/v1/byoip/subnets/<id>/cancel" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

---

_Generated from the OpenAPI document served at `https://api.onie.net/v1/public/openapi.json`._
