Skip to main content

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).

Quick start​

  1. In the panel, at cloud.ariaservice.net/users/api-tokens, create a token with the scopes hosting:accounts:read and hosting:accounts:write.
  2. 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>
ScopeAllows
hosting:accounts:readreading accounts, usage, DNS, mailboxes and databases
hosting:accounts:writeevery 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 pathPurpose
GET /datacentersthe region's datacenters
GET /plansplans for sale (datacenter, kind=shared|reseller)
GET /accounts, POST /accountslist 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}/passwordchange the panel, FTP and SSH password
POST /accounts/{id}/logina one-time login link into the control panel
GET /accounts/{id}/usage, /nameservers, /traffic, /alertsusage, name servers, traffic, alerts
/accounts/{id}/dns-recordsDNS records (GET, POST, PUT /{record}, DELETE /{record})
/accounts/{id}/email-accountsmailboxes
/accounts/{id}/databases, /database-usersdatabases and their users
/accounts/{id}/ssh-keys, /shellSSH keys and shell access
/accounts/{id}/php, /redis, /traffic/settingsPHP, 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 pathUse
GET /accounts/{id}/reseller/usageaccounts, disk and bandwidth used against the plan's totals, and whether overselling is allowed
GET /accounts/{id}/reseller/packagesthe packages defined and how many accounts run each
GET /accounts/{id}/reseller/accounts, POST /accounts/{id}/reseller/accountslist 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}/packagemove to another package
POST /accounts/{id}/reseller/accounts/{username}/passwordset the control panel, FTP and SSH password
POST /accounts/{id}/reseller/accounts/{username}/loginone-time login link into the customer's control panel
POST /accounts/{id}/reseller/accounts/{username}/suspend, /unsuspendsuspend and lift the suspension
POST /accounts/{id}/reseller/accounts/{username}/resetwipe 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.

HTTPcode
400invalid_input, invalid_region
401unauthorized
402insufficient balance
403forbidden, insufficient_scope (the token has no hosting scope)
404not_found, region_not_found
409the account's state does not allow it now
429rate_limit_exceeded (with Retry-After)
503hosting_unavailable, region_unavailable (with Retry-After where known)
504gateway_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.