Hosting API
The hosting API manages Arianet shared hosting (cPanel and DirectAdmin): ordering accounts, renewing and changing plans, DNS records, mailboxes, databases and their users, SSH keys, PHP, Redis and traffic. The arianet hosting CLI commands are built on it. Reseller hosting is managed through the same API (reseller hosting).
- Base URL:
https://api.ariaservice.net/hosting/v1 - Format: JSON over HTTPS
- Authentication: a personal API token sent as a Bearer token (Authentication)
- OpenAPI 3.1:
https://api.ariaservice.net/hosting/v1/openapi.json, browsable in the interactive reference
Quick start
- In the panel, at cloud.ariaservice.net/users/api-tokens, create a token with the scopes
hosting:accounts:readandhosting:accounts:write. - Call the API:
export ARIANET_TOKEN="paste-your-token-here"
BASE=https://api.ariaservice.net/hosting/v1
AUTH="Authorization: Bearer $ARIANET_TOKEN"
curl -s $BASE/datacenters -H "$AUTH"
curl -s "$BASE/plans?kind=shared" -H "$AUTH"
curl -s -X POST $BASE/accounts -H "$AUTH" -H "Content-Type: application/json" \
-d '{"datacenter":"thr","plan_id":3,"term":"monthly","domain":"example.com","password":"S3cret-pass"}'
An order answers with the account and an action; creating the account is asynchronous, follow it with GET /actions/{id} until state is success or error. The price is charged to the account's wallet.
Authentication and scopes
Authorization: Bearer <token>
| Scope | Allows |
|---|---|
hosting:accounts:read | reading accounts, usage, DNS, mailboxes and databases |
hosting:accounts:write | every change: ordering, renewing, changing plans, deleting, one-time panel logins, DNS, email, databases, SSH, PHP, Redis and traffic |
A token without any scope is unrestricted. A token never reaches further than its owner: for a team member the account's IAM policies apply too (a reseller plan, for example, also needs hosting:reseller:manage).
Regions
Hosting runs as a separate install per region. The Arianet-Region header picks one; without it the request goes to the default region:
curl -s $BASE/accounts -H "$AUTH" -H "Arianet-Region: iran-1"
An account is only visible in the region it was created in. An unknown region answers 404 region_not_found.
Resources
| Method and path | Purpose |
|---|---|
GET /datacenters | the region's datacenters |
GET /plans | plans for sale (datacenter, kind=shared|reseller) |
GET /accounts, POST /accounts | list and order accounts |
GET /accounts/{id}, PATCH /accounts/{id}, DELETE /accounts/{id} | details, auto-renew (auto_renew), termination |
POST /accounts/{id}/actions/{op} | change_plan ({"plan_id":4}), renew, reset ({"password":"..."}) |
POST /accounts/{id}/password | change the panel, FTP and SSH password |
POST /accounts/{id}/login | a one-time login link into the control panel |
GET /accounts/{id}/usage, /nameservers, /traffic, /alerts | usage, name servers, traffic, alerts |
/accounts/{id}/dns-records | DNS records (GET, POST, PUT /{record}, DELETE /{record}) |
/accounts/{id}/email-accounts | mailboxes |
/accounts/{id}/databases, /database-users | databases and their users |
/accounts/{id}/ssh-keys, /shell | SSH keys and shell access |
/accounts/{id}/php, /redis, /traffic/settings | PHP, Redis, overage billing |
GET /actions, GET /actions/{id} | asynchronous operations |
Request and response bodies of every endpoint are in the interactive reference.
Reseller hosting
A reseller account (kind=reseller) can create and manage accounts for its own customers, on the packages it defined in its control panel. All these paths are under /accounts/{id}/reseller, where {id} is the reseller account; a customer account is addressed by its username.
| Method and path | Use |
|---|---|
GET /accounts/{id}/reseller/usage | accounts, disk and bandwidth used against the plan's totals, and whether overselling is allowed |
GET /accounts/{id}/reseller/packages | the packages defined and how many accounts run each |
GET /accounts/{id}/reseller/accounts, POST /accounts/{id}/reseller/accounts | list customer accounts; create one on a package, within the plan's limits |
DELETE /accounts/{id}/reseller/accounts/{username} | delete a customer account and its data |
POST /accounts/{id}/reseller/accounts/{username}/package | move to another package |
POST /accounts/{id}/reseller/accounts/{username}/password | set the control panel, FTP and SSH password |
POST /accounts/{id}/reseller/accounts/{username}/login | one-time login link into the customer's control panel |
POST /accounts/{id}/reseller/accounts/{username}/suspend, /unsuspend | suspend and lift the suspension |
POST /accounts/{id}/reseller/accounts/{username}/reset | wipe back to a fresh account (same username, domain and package; files, mail, databases and DNS are deleted) |
For team members, these paths need the hosting:reseller:manage IAM permission on top of the token's scope.
Errors
Errors are JSON, {"error": "...", "code": "..."}; branch on code, not on the message.
| HTTP | code |
|---|---|
| 400 | invalid_input, invalid_region |
| 401 | unauthorized |
| 402 | insufficient balance |
| 403 | forbidden, insufficient_scope (the token has no hosting scope) |
| 404 | not_found, region_not_found |
| 409 | the account's state does not allow it now |
| 429 | rate_limit_exceeded (with Retry-After) |
| 503 | hosting_unavailable, region_unavailable (with Retry-After where known) |
| 504 | gateway_timeout: the region did not answer in time; the request may still have been applied, check before retrying |
Every answer carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset.