Allow a database access host
POST /api/v2/shared-hosting/{accountId}/database-access-hosts
Allow one more host to connect to the account’s MySQL databases over TCP. The list is account-wide. Every database user may then connect from that host with its own password. host is an IP address (203.0.113.7), an IP range with % as the wildcard (203.0.113.%), a hostname or % for every host. localhost is refused because the local socket is always allowed. Use 127.0.0.1 for an app on the hosting that connects over TCP. % leaves the databases protected by their passwords alone. Prefer one address. Adding a host that is already listed answers 201 again. The account must be active and on cPanel. Connect to access.serverHostname from GET /api/v2/shared-hosting/{accountId}/account-details, not to your domain. The domain may point somewhere else.
Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredacct_…).Body
hoststringrequired% as the wildcard, a hostname or % for every host. Case-insensitive. Never localhost.Example
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/database-access-hosts" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "host": "203.0.113.7" }'curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/database-access-hosts" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "host": "127.0.0.1" }'Responses
201 Host allowed.
{ "host": "203.0.113.7", "note": null}Response fields
hoststringnotestring or nullnull here. Notes are set in the control panel.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | The host is missing, malformed or localhost. |
| 401 | Unauthorized. Authentication is required. |
| 403 | forbidden. With requiredScopes in the body, the key lacks a scope. The key needs all the scopes in that list, although detail asks for one of them. Without requiredScopes, the hosting account is not active. Check serviceStatus on GET /api/v2/shared-hosting/{accountId}. |
| 404 | Not found. The resource does not exist or is not owned by the caller. |
| 409 | account_not_eligible_cpanel: the account is on Hostup’s previous hosting platform. Support moves it to cPanel at no charge. |
| 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. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |