API, command line and Terraform
Manage your servers, domains, DNS records and functions from code. Most things you can do in the panel can also be done through the REST API with a personal API key.
1. Create an API key
Create a key on the API Keys page in the panel. A key is tied to a single account and never carries more permissions than your role in it; it can be made read-only, limited to specific products and given an expiry date. The full key is shown only once, when it is created.
Go to API keys →2. Your first request
Send the key in the Authorization header:
curl -H "Authorization: Bearer hz_..." \ https://api.haizora.com/v1/portal/servers
What you need to know
- Read-only keys can only make read requests and behave like a read-only role on the account.
- A write key works with the creator's current role; if the person is removed from the account, the key becomes invalid immediately.
- A key cannot be used to create other keys; team and invitation actions can only be done from the panel.
- Error responses carry the error.code and error.message fields.
- Each key can make at most 300 requests per minute; if exceeded, a 429 response with a Retry-After header is returned.
Command-line tool: haizoraPreparing for release
A dependency-free Node.js tool for signing in, listing servers and power actions, DNS records and publishing functions (Node 18 and above).
haizora login # paste an hz_... token haizora servers list haizora servers power <id> reboot haizora dns list example.com haizora dns add example.com A www 203.0.113.10 --ttl 300 haizora workers deploy ./worker.js --name hello
Terraform providerPreparing for release
Resources for servers, managed databases, serverless functions and DNS records. Server and database resources create orders; the service is provisioned after the invoice is paid.
provider "haizora" {} # HAIZORA_TOKEN
resource "haizora_dns_record" "www" {
domain_id = data.haizora_domain.main.id
type = "A"
name = "www"
value = "203.0.113.10"
}
resource "haizora_function" "hello" {
name = "hello"
code = file("worker.js")
}The command-line tool and the Terraform provider have not yet been published to npm and the Terraform Registry. Until then, you can use the REST API directly.
API reference
This list is generated from the OpenAPI 3.1 document. You can download the document to generate a client with Postman, Insomnia or openapi-generator.
Download openapi.jsonLoading API documentation…