Create domains through the API
Provision and remove domains via API, using the same API key as your CI/CD.
API keys
API keys let pipelines and scripts call the API without a user session. The full token starts with hk_live_ and is shown only once at creation.
Authentication
Send the Authorization header on every request. Store these values as CI secrets:
- • HOST_API_URL — public API URL (include /api if applicable)
- • HOST_DEPLOY_TOKEN — hk_live_… API key value
- • HOST_DOMAIN_ID — numeric domain ID (optional if creating the domain via API)
Permissions per key
- • Deploy — POST /v1/domains/{id}/deploy (registry JSON or artifact multipart)
- • Create domains — POST /v1/domains; when scope is a list, the new domain is added to the key automatically
- • Delete domains — DELETE /v1/domains/{id} (only domains in the key scope)
Create and revoke in the panel
Under Infrastructure → API keys you can create keys (name, domain scope, and permissions) and revoke active keys. The full secret is never shown again after creation.
Create and delete domains
With the right permissions on the API key, CI can provision or remove domains without using the panel.
Create domain
Requires «Create domains» permission. deploy_source: registry or artifact; for artifact set artifact_runtime (static, node, php, …). When the key scope is a list, the new domain is attached automatically.
curl -sfS -X POST "${HOST_API_URL}/v1/domains" \
-H "Authorization: Bearer ${HOST_DEPLOY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"full_host": "app.example.com",
"deploy_source": "artifact",
"artifact_runtime": "static",
"max_replicas": 1
}'
Delete domain
Requires «Delete domains» permission and the domain must be in the key scope. Domains with subdomains cannot be deleted until children are removed.
curl -sfS -X DELETE "${HOST_API_URL}/v1/domains/{DOMAIN_ID}" \
-H "Authorization: Bearer ${HOST_DEPLOY_TOKEN}"