Appearance
Containers beta
LXC containers (product family container, scope console-containers).
Containers are being rolled out: while they are not available for the token's user, every path answers 404. A container is addressed by its id (ULID); one you cannot see answers 404.
| Method | Path | |
|---|---|---|
| GET | /containers | the containers of your teams and the ones granted to you |
| GET | /containers/{container} | one container, with live status |
| PATCH | /containers/{container} | rename |
| DELETE | /containers/{container} | delete (with the name as confirmation) |
| POST | /containers/{container}/power | start, stop, shutdown, reboot |
| POST | /containers/{container}/reinstall | reinstall from a template |
| GET | /containers/{container}/post-install | the latest post-install run |
| GET, POST | /containers/{container}/backups | list, create |
| POST | /containers/{container}/backups/{backup}/restore | restore |
| DELETE | /containers/{container}/backups/{backup} | delete |
| GET, POST | /containers/{container}/snapshots | list, create |
| POST | /containers/{container}/snapshots/{name}/rollback | roll back |
| DELETE | /containers/{container}/snapshots/{name} | delete |
Permissions as in the Console: reading needs a view grant, power and reinstall the power level, name, backups and snapshots the manage level; deleting is for the team only.
Background operations (202) answer {"message": …} and run in the background; read the container (or the lists) again to see the result, or - as an app - wait for the product.updated webhook. An unknown backup or snapshot answers 404.
The container object
GET /containers/{container} returns the container with:
| Field | |
|---|---|
status | running, stopped; null when the status cannot be read right now; provisioning while the container is being set up beta |
provisioning_status beta | null when ready, provisioning or failed - see Products being set up |
location | {id, name} |
template | {id, name} |
primary_ipv4, primary_ipv6 | the container's primary addresses (with …_cidr and …_gateway) |
gpu | {vendor, model, vram_gb, mode, count} of a GPU container, else null (also in the list) |
options | the LXC options of the order, {"features": […], "devices": […]}; empty lists without |
post_install | the latest post-install run (see Post-install scripts) |
The list (GET /containers, paginated, sorted by name) has the same fields without the live status (null) and without post_install. PATCH returns the changed container.
bash
curl https://console.anikeen.com/api/v1/containers/01JD… \
-H "Authorization: Bearer $ANIKEEN_TOKEN" -H "Accept: application/json"Rename
http
PATCH /v1/containers/{container}
{"name": "game-2"}name is a hostname (max. 255 characters); the hostname inside the container changes with the next restart.
Delete
http
DELETE /v1/containers/{container}
{"name": "game-2"}- →
204. - The body's
namemust be the container's name (422otherwise). 409while the deletion protection is on.- Deleted containers are kept for 14 days (support can restore them), then purged.
- Deleting a GPU container gives its GPU back at once.
Power
http
POST /v1/containers/{container}/power
{"action": "reboot"}action: start, stop, shutdown, reboot → 202. start and reboot answer 409 ({"message": …}, no error code) while the container is suspended for an unpaid invoice.
Reinstall
http
POST /v1/containers/{container}/reinstall
{"template_id": "01JC…", "ssh_key": "01JC…", "options": null, "post_install_script": "#!/bin/bash\n…"}| Field | |
|---|---|
template_id | required, one of the active templates available for the container on its host (for a GPU container: one that supports its GPU) |
ssh_key | optional, an SSH key of the team |
options | optional: replaces the LXC options as in the order; absent or null keeps them |
post_install_script | optional, needs a template with supports_post_install_script - see Post-install scripts |
→ 202. All data and snapshots are lost; address and hostname stay. The new root password is mailed to the team owner. 409 while suspended.
Backups
| Request | Body | Result |
|---|---|---|
GET …/backups | {"data": [...]} with id, notes, size, created_at, newest first (not paginated) | |
POST …/backups | {"notes": "before update"} | 202 |
POST …/backups/{backup}/restore | 202; stops the container, restores the backup over it and starts it again if it was running | |
DELETE …/backups/{backup} | 202 |
Snapshots
| Request | Body | Result |
|---|---|---|
GET …/snapshots | {"data": [...]} with name, description, parent, created_at, newest first | |
POST …/snapshots | {"name": "before_update", "description": "Before the update"} | 202 |
POST …/snapshots/{name}/rollback | 202; starts the container again if it was running | |
DELETE …/snapshots/{name} | 202 |
Snapshot name: a letter, then letters, digits, -, _; max. 40 characters; unique (an existing name answers 422). description: optional, max. 1000 characters. Backup notes: optional, max. 1000 characters.
What survives what
- The LXC options stay through reinstall, backup restore and snapshot rollback (they are set again after restoring an older state). If they cannot be applied at that moment, the reinstall, restore or rollback fails without changing anything.
- A GPU container keeps its GPU through reinstall, backup restore, snapshot rollback, a billing suspension and a transfer.
With the PHP SDK
php
$container = $console->containers()->find($id);
$container->power('reboot');
$container->snapshots()->create('before_update', 'Before the update');See SDK containers.