Skip to content

API overview ​

REST API under /api, used by the console, CLI, plugins and your scripts.

Web login (POST /api/login) accepts username/password or an access key only. The system token is for Authorization: Bearer API calls and cannot be used to log in.

Conventions ​

ItemValue
Base URLhttp(s)://<host>:1881/api
AuthAuthorization: Bearer <token> or session
CSRFX-CSRF-Token on writes
EncodingJSON / UTF-8
Errorsoften HTTP 200 with non-200 code

Envelope ​

json
{
  "code": 200,
  "msg": "成功",
  "data": {},
  "timestamp": 1730000000
}
CodeMeaning
200success
400bad request
401unauthenticated
403forbidden / CSRF
404not found
500server error

WARNING

Do not rely on the HTTP status alone; check code.

Example ​

bash
BASE=https://idc.example.com
TOKEN=6f1c...
CSRF=$(curl -s $BASE/api/csrf-token | jq -r .csrf_token)

curl -s $BASE/api/server/detail -H "Authorization: Bearer $TOKEN"

curl -s -X POST $BASE/api/client/powers/pve-lab/<uuid> \
  -H "Authorization: Bearer $TOKEN" \
  -H "X-CSRF-Token: $CSRF" \
  -H "Content-Type: application/json" \
  -d '{"action":"start"}'

Groups ​

GroupPrefix
Auth & users/api/users, /api/login
System/api/system/*, /api/token/*
Hosts/api/server/*
Instances/api/client/*
Network/api/client/nat*, /api/client/proxys/*, /api/admin/proxys/*
Storage / backup/api/client/{isos,hdd,backup}/*
Tasks/api/tasks, /api/system/async_task/*
Maintenance/api/system/{outbox,tombstone}/*

Full endpoint list: see the Chinese API 概览 (same paths).

Released under the AGPLv3 License.