Skip to content

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

accountIdstringrequired
The web hosting account ID (acct_…).

Body

hoststringrequired
An IP address, an IP range with % as the wildcard, a hostname or % for every host. Case-insensitive. Never localhost.

Example

POST /api/v2/shared-hosting/{accountId}/database-access-hosts
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"
}'

Responses

201 Host allowed.

Response 201
{
"host": "203.0.113.7",
"note": null
}
Response fields
hoststring
The host as stored: trimmed and in lower case.
notestring or null
Always null 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.

400The host is missing, malformed or localhost.
401Unauthorized. Authentication is required.
403forbidden. 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}.
404Not found. The resource does not exist or is not owned by the caller.
409account_not_eligible_cpanel: the account is on Hostup’s previous hosting platform. Support moves it to cPanel at no charge.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.