Skip to content

Authorize a web hosting SSH key

POST /api/v2/shared-hosting/{accountId}/ssh-keys/{fingerprint}/actions/authorize

Let an SSH key that is on the web hosting account but not authorized log in over SSH and SFTP. Use it for a key imported without authorization, for example in cPanel. A key added with POST /api/v2/shared-hosting/{accountId}/ssh-keys is authorized already. A key that is already authorized returns 200 without a change. The account must be active and on cPanel.

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_…).
fingerprintstringrequired
The SSH key ID (ssh_…).

Example

POST /api/v2/shared-hosting/{accountId}/ssh-keys/{fingerprint}/actions/authorize
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/ssh-keys/ssh_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/authorize" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json"

Responses

200 The key is authorized.

Response 200
{
"name": "deploy-key",
"fingerprint": "SHA256:mKqU+0K8OhKmA8bBQi9Rz0Q5l7/g160hIP+rJYSTNj4",
"authorized": true
}
Response fields
namestring
The key’s name on the account.
fingerprintstring
The key’s fingerprint.
authorizedboolean
Always true.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400{fingerprint} is not a valid SSH key ID (invalid_request).
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404No such key on this account (ssh_key_not_found).
409The account is not on cPanel (account_not_eligible_cpanel).
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.
502The key could not be looked up or authorized right now (upstream_failed).