Create database user
POST /api/v2/shared-hosting/{accountId}/database-users
Create a MySQL user on a web hosting account. The account must be active (403 forbidden otherwise) and on cPanel (409 account_not_eligible_cpanel otherwise). The API does not add the account’s name prefix. When the account’s databases are named like abcde_wp_example, start the user name with the same prefix. The new user has no access to any database yet. Link it with POST /api/v2/shared-hosting/{accountId}/database-users/{username}/privileges. The response never repeats the password.
Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredThe web hosting account ID (
acct_…).Body
usernamestringrequiredThe MySQL user name. Letters, digits and underscores. The API accepts up to 64 characters. The database server takes at most 32, the prefix included. A longer name answers 502
upstream_failed.passwordstringrequired8-128 characters with uppercase, lowercase, and a number. It must also be hard to guess. The user name inside the password counts against it. Generate your own.
Example
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/database-users" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "username": "abcde_wp_exampleuser", "password": "Amber-Ladder-41-Orchard" }'Responses
201 Database user created.
{ "id": "dbu_01hxa3b4c5d6e7f8g9h0j1k2m3", "username": "abcde_wp_exampleuser", "host": null, "databases": []}Response fields
idstringThe database user ID (
dbu_…).usernamestringThe MySQL user name.
hoststring or nullAlways
null here.databasesarray of stringAlways empty on creation.
Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | password_too_weak: detail names the broken rule. The body also has minimumScore (3). When the password is easy to guess, it also has score and suggestions. Show suggestions to the user. invalid_request with pointer /body: a field is missing or empty, username has other characters than letters, digits and underscores, or password is longer than 128 characters. |
| 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_failed: the control panel did not create the user. The usual causes are a user name that is already taken, one longer than 32 characters, or one without the account’s prefix on a server that uses prefixes. Sending the same name again fails the same way. Check the names with GET /api/v2/shared-hosting/{accountId}/database-users first. |