API reference

Every public endpoint. The base URL is https://www.hostkingpro.com. Auth is either a session cookie (browsers) or Authorization: Bearer hk_live_โ€ฆ (CLI). Mint a token at /dashboard/api-keys.

OpenAPI 3.1 spec

Machine-readable. Use it for Postman, Insomnia, or to generate client SDKs.

/api/openapi.jsonTry in playground โ†’
MethodPathAuthSummary
GET/api/healthzno authLiveness probe. Always 200 if the process is up.
{ status: 'ok', service, build_sha, node_env, timestamp }
GET/api/readyzno authReadiness probe. 200 if Supabase is reachable, /home exists, โ‰ฅ1 Server registered. 503 otherwise.
{ status: 'ready'|'not_ready', checks: { supabase, home_dir, pods } }
GET/api/metricsno authLive control-plane metrics from /proc: CPU %, memory %, swap, loadavg (1/5/15 min). Useful for embedding in monitoring.
{ cpu: { pct_used, loadavg }, memory: { total_mb, used_mb, pct_used }, swap: { total_mb, free_mb } }
GET/api/networkno authNetwork info: hostname, uptime, interfaces (IPv4/IPv6/MAC), and listening sockets (with protocol + process). Useful for ops debugging.
{ hostname, uptime, primary_ip, interfaces, listening }
GET/api/badgeno authEmbeddable SVG badge (shields.io-style). ?label=X&status=Y&color=Z. Status maps to a color automatically.
image/svg+xml
GET/api/versionno authBuild metadata: service, version, build_sha, node_env, node_version, started_at, uptime_seconds. Used by the CLI and by anyone who wants to verify deployment.
{ service, version, build_sha, node_env, node_version, started_at, uptime_seconds }
GET/api/templates/[slug]/downloadno authBuilds and serves a starter-template zip (Next.js, Express, Hono, FastAPI, OpenAI, static).
application/zip
GET/api/samples/[slug]/downloadno authBuilds and serves a sample-app zip (Express, Node, static, WordPress).
application/zip
GET/api/me/orgssession cookieList the orgs the current user is a member of.
{ orgs: [{ role, organizations: { id, name, slug, plan_tier, plan_weight_pcu, subscription_status } }] }
GET/api/me/usagesession cookieCurrent usage vs the plan's limits.
{ org, usage: { sites, seats, deploys_30d, storage_mb } }
GET/api/me/api-keyssession cookieList API keys (no hashes).
POST/api/me/api-keyssession cookieMint a new API key. Returns the plaintext once.
POST/api/me/api-keys/revokesession cookieRevoke a key by id. The key's hash stays in the DB so we can refuse it.
GET/api/sitessession cookieList sites across the user's orgs.
POST/api/sitessession cookieCreate a new site. Body: { name, organization_id, site_type, port, memory_limit_mb, cpu_quota_percent, domain? }.
GET/api/sites/[id]session cookieGet a single site as JSON.
POST/api/sites/[id]/restartsession cookieRestart the systemd unit. Owner or admin only.
POST/api/sites/[id]/stopsession cookieStop the unit (no traffic).
POST/api/sites/[id]/startsession cookieStart the unit.
POST/api/sites/[id]/redeploysession cookieRe-run the last build. Picks up env-var changes after a manual save.
POST/api/sites/[id]/deletesession cookieStop the unit, remove it, delete /home/<tenant>, mark site row as 'deleted'. Owner or admin only.
POST/api/sites/[id]/envsession cookieReplace env vars. Form fields are key_0/val_0, key_1/val_1, etc.
POST/api/sites/[id]/domainsession cookieSet the custom domain.
POST/api/sites/[id]/transfersession cookieMove the site to a different org. Owner of source + member of target.
GET/api/sites/[id]/metricssession cookieLive cgroup memory + CPU. Returns { running, memory: { current_mb, max_mb, pct }, cpu: { usage_seconds } }.
GET/api/sites/[id]/logssession cookieTail the systemd journal. ?tail=N (default 200, max 2000), ?severity=info|warn|error, ?since=ISO, ?until=ISO, ?format=raw (plain-text attachment). JSON: { unit, lines: [{ ts, severity, msg }] }.
GET/api/sites/[id]/healthsession cookieReal HTTP probe to the site's loopback. Returns { ok, status_code, latency_ms }.
GET/api/sites/[id]/deployssession cookieRecent deploys for a site.
GET/api/sites/[id]/previewsession cookieProxy a request to the running site. ?path=/foo (default '/'). 5s timeout. Streams the raw response with the original content-type.
POST/api/sites/[id]/sharesession cookieMint a time-limited public share token for the site status page. Body: {ttl_hours?: number}. Returns {token, share_url, expires_at, site_name}. Default TTL: 24h. Max: 720h.
DELETE/api/sites/[id]/sharesession cookieRevoke all active share tokens for the current user/site.
POST/api/sites/bulksession cookieBulk action on multiple sites. Body: {site_ids: [...], action: 'start'|'stop'|'restart'|'redeploy'}. Max 100 sites. Returns {succeeded, failed, forbidden}. Owner/admin only.
GET/api/me/orgssession cookieList the orgs the current user is a member of, with role.
GET/api/me/usagesession cookieCurrent usage vs the plan's limits.
GET/api/me/activitysession cookieRecent audit events for the user's orgs. ?limit=N (max 50, default 5). Used by the sidebar widget.
POST/api/cronsession cookieCreate a cron job. Form: name, schedule (5-field cron), endpoint (URL), enabled.
POST/api/cron/[id]/togglesession cookieToggle the enabled flag on a cron job.
POST/api/cron/[id]/deletesession cookiePermanently delete a cron job.
POST/api/webhooks/testsession cookieFire a test webhook delivery to a URL. Body: {url, event?, secret?}. Signs with HMAC-SHA256 if secret is given. 10s timeout. Records the attempt in webhook_deliveries.
POST/api/sites/_backupsession cookieTrigger a one-shot backup. Form: site_id.
GET/api/notificationssession cookieList the current user's notifications. ?limit=N (default 50, max 200). ?unread_only=true to filter.
{notifications: [{id, type, title, body, link, severity, read_at, created_at}], unread_count: N}
POST/api/notifications/read-allsession cookieMark all of the current user's notifications as read.
PATCH/api/notifications/[id]session cookieMark a single notification as read.
DELETE/api/notifications/[id]session cookieDelete a single notification.
POST/api/sites/githubsession cookieConnect a GitHub repo to a site. Form: site_id, repo (owner/name), branch.
POST/api/webhookssession cookieSubscribe a URL to org events. Form: url (https://), events (multi).
POST/api/webhooks/[id]/deletesession cookieRemove a webhook subscription.
POST/api/deploysession cookieUpload a zip and trigger a deploy. Form: file, site_id, source (zip|github|vercel|cli).
GET/api/deploy/[id]/statussession cookieStatus + last N log lines for a deploy.
GET/api/deploy/[id]/streamsession cookieSSE stream of live deploy logs.
POST/api/internal/github-webhookinternal onlyGitHub push receiver. HMAC-SHA256 signed. Maps repo โ†’ site via site.github_repo match.
POST/api/internal/scan-resultinternal onlyClamAV scan result receiver (Phase 3B).
GET/metricsno authPrometheus text-format metrics. 7 metric families.
GET/sitemap.xmlno authXML sitemap of public marketing + docs routes.

Try the API in the CLI: hostking sites:list ยท hostking usage ยท hostking site:metrics <id>