- Docs
- Administrator guide
- API tokens
API tokens
Create, scope, store and rotate tokens for the PikoStack hosting API, the WHMCS module and your own scripts.
Every call to /api/v1 needs a bearer token:
Authorization: Bearer <token>
Tokens have one of two roles:
| Role | Can |
|---|---|
admin |
Read and write: create, change and delete servers |
readonly |
Read only: list plans, templates and servers |
Create a token#
sudo pikod token -name whmcs -role admin
The command prints the secret once, plus a configuration snippet with its SHA-256 hash. Only the hash is stored in /etc/pikostack/pikod.yaml:
tokens:
- name: whmcs
role: admin
sha256: "<64 hex characters>"
Add the snippet, check the file and reload:
sudo pikod check-config /etc/pikostack/pikod.yaml
sudo systemctl reload pikod
Good practice#
- One token per integration, named after it, so you can revoke one without touching the others
readonlyfor monitoring and reporting- Restrict access to the API port with
--trustedso only your billing server can reach it - Rotate tokens by adding the new one, switching the integration, then removing the old hash
TLS#
pikod refuses to listen on a non-loopback address without TLS. To expose the API to a remote billing server, set tls_cert and tls_key in pikod.yaml and change listen, for example to 0.0.0.0:8443.
Something unclear or wrong on this page? Tell us. © 2026 PikoStack.