Overview
https://hokas.net/api/v1application/json; charset=utf-82.2 MB (write_file: 1 MB)Authentication
Create an hkapi_... key on Dashboard → REST API (/dashboard/api). Keys are shown only once upon creation. Send it via Authorization: Bearer or X-API-Key header on every request.
Authorization: Bearer hkapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # or X-API-Key: hkapi_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Permission Scopes
| Scope | Description |
|---|---|
full | Full access to all endpoints. |
servers | List servers, details, live stats (/stats), and logs (/logs). |
power | Start, stop, restart (/power), and startup run_now. |
files | List, read, write, mkdir, rename, and delete files or folders. |
startup | Read and update startup command (/startup). |
env | Read, set, and remove environment variables (/env). |
network | View and switch network egress mode (wireguard, mullvad, warp, router). |
backups | List, create, schedule, restore, and delete backups. |
github | Link repo, status, deploy, reinstall, and unlink GitHub. |
redeploy | Redeploy / reinstall server container (/redeploy). |
delete | Permanently delete a server (DELETE /servers/{id}). |
Rate Limits & Errors
Rate limits: 120 req/min per key, 240 req/min per user, 60 write req/min, and 40 failed auth attempts per 5 min per IP.
| HTTP | Error Code | Description |
|---|---|---|
400 | invalid_json / invalid_param / action_failed | Invalid JSON body, invalid parameter type, or validation failure. |
401 | unauthorized / invalid_key / expired_key | Missing, invalid, revoked, or expired API key. |
403 | insufficient_scope / api_not_enabled / feature_locked | Missing scope, API disabled on plan, or feature locked. |
404 | not_found | Server (32 hex chars) or endpoint not found. |
409 | server_busy | Server is currently deploying, redeploying, or deleting. |
413 | payload_too_large | Request body exceeds 2.2 MB limit. |
429 | rate_limited / throttled | Too many requests (check Retry-After header). |
503 | node_offline / node_busy / maintenance | Node is offline/busy or panel is in maintenance mode. |
Node Offline or Busy Handling
When a server node is offline, under maintenance, or unreachable, the API never exposes raw internal errors and always returns a clean HTTP 503 JSON response:
{
"ok": false,
"error": "node_offline",
"node_offline": true,
"message": "This server's node is currently offline or not responding. Please try again in a few moments."
}
Servers, Stats & Logs
List all your servers, their 32-char id, limits, status, and api_enabled flag.
Get server details, limits, startup command, linked GitHub repository, and env variable count.
Get live CPU, RAM, disk, and network usage of a running server.
Read live console output (lines: 1–500, default 100).
Power & Startup Command
{"action": "start"} // "start" | "stop" | "restart"Read current startup command.
{"startup_command": "node index.js", "run_now": true}File Management
Internal deploy files (/hokas-deploy.sh, /hokas-deploy.log, /.hokas-tmp) are protected and blocked.
Read a text file (max 2 MB; optional ?start_line=1&end_line=100).
{"path": "/config.json", "content": "{\"port\":3000}"}{"path": "/src/utils"}{"from": "/a.js", "to": "/b.js"}Environment Variables
{"variables": {"NODE_ENV": "production", "PORT": "3000"}, "remove": ["OLD_KEY"]}{"names": ["PORT"]}Network Egress
Returns active mode, available modes (wireguard, mullvad, warp, router:...), and change history.
{"mode": "warp"}Backups & Schedules
{"name": "api-backup-1", "scope": "files"} // "files" | "db" | "both"{"enabled": true, "freq": "daily", "keep": 3, "scope": "files"}GitHub Deploy
{"repo_url": "https://github.com/user/repo", "branch": "main", "auto_deploy": true, "install_deps": true}Redeploy & Delete
{"keep_files": true, "keep_databases": true, "keep_domains": false}Permanently deletes the server and its data. Servers with an active paid membership cannot be deleted.
Quickstart Examples
# Bash / Linux / macOS
curl -X POST "https://hokas.net/api/v1/servers/YOUR_SERVER_ID/power" \
-H "Authorization: Bearer hkapi_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"action":"restart"}'
# Windows PowerShell
$h = @{ Authorization = "Bearer hkapi_YOUR_KEY" }
Invoke-RestMethod -Method Post -Uri "https://hokas.net/api/v1/servers/YOUR_SERVER_ID/power" `
-Headers $h -ContentType "application/json" -Body '{"action":"restart"}'