Get web hosting usage
GET /api/v2/shared-hosting/{accountId}/account-stats
Get how much of its plan a web hosting account uses: disk, bandwidth, addon domains, subdomains, mailboxes, forwarders, FTP accounts and databases. The account must be active. liveResources holds CPU, memory, process and disk I/O readings at the moment of the request, against the account’s own limits. Use it to check whether a slow site is held back by those limits. A null reading means unknown, not zero. A null limit means no limit or none reported. liveResources is null when the server reports no such readings. On an account that is not on cPanel no usage is reported. Counts are 0. Disk and bandwidth readings, every limit and liveResources are null.
Authentication: An API key with the scopes read:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredacct_…).Example
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/account-stats" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 Usage and limits for the account.
{ "disk": { "usedBytes": 4294967296, "limitBytes": 21474836480, "usedGb": 4, "limitGb": 20, "usagePercent": 20, "exceeded": false }, "bandwidth": { "usedBytes": 10737418240, "limitBytes": 1099511627776, "usedGb": 10, "limitGb": 1024, "usagePercent": 0.98, "exceeded": false }, "addonDomains": { "used": 1, "limit": 5, "remaining": 4, "usagePercent": 20, "exceeded": false }, "subDomains": { "used": 3, "limit": 50, "remaining": 47, "usagePercent": 6, "exceeded": false }, "emailAccounts": { "used": 2, "limit": 25, "remaining": 23, "usagePercent": 8, "exceeded": false }, "emailForwarders": { "used": 1, "limit": null, "remaining": null, "usagePercent": null, "exceeded": false }, "ftpAccounts": { "used": 2, "limit": 10, "remaining": 8, "usagePercent": 20, "exceeded": false }, "mysqlDatabases": { "used": 3, "limit": 10, "remaining": 7, "usagePercent": 30, "exceeded": false }, "liveResources": { "cpu": { "percentOfLimit": 99 }, "entryProcesses": { "used": 1, "limit": 20 }, "physicalMemory": { "usedBytes": 3296559104, "limitBytes": 8589934592 }, "processes": { "used": 32, "limit": 250 }, "io": { "bytesPerSecond": 30720, "limitBytesPerSecond": 314572800 }, "iops": { "used": 0, "limit": 10240 } }}Response fields
diskobjectusedBytesnumber or nulllimitBytesnumber or nullusedGbnumber or nulllimitGbnumber or nullusagePercentnumber or nullexceededbooleanbandwidthobjectusedBytesnumber or nulllimitBytesnumber or nullusedGbnumber or nulllimitGbnumber or nullusagePercentnumber or nullexceededbooleanaddonDomainsobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleansubDomainsobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleanemailAccountsobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleanemailForwardersobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleanftpAccountsobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleanmysqlDatabasesobjectusedintegerlimitinteger or nullremaininginteger or nullusagePercentnumber or nullexceededbooleanliveResourcesobject or nullErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller. |
| 409 | Conflict. code is account_suspended. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |