Delete an SSH key
DELETE/api/v1/ssh-keys/{key_id}
Deletes a key from the account. Servers that have it keep it.
Parameters
| Name | In | Description |
|---|---|---|
| key_id | path, integerrequired | SSH key id, from List SSH keys |
Example request
curl -X DELETE "https://platform.serverscamp.com/api/v1/ssh-keys/$KEY_ID" \
-H "Authorization: Bearer $API_TOKEN"import os, requests
token = os.environ["API_TOKEN"]
key_id = 42
r = requests.delete(
f"https://platform.serverscamp.com/api/v1/ssh-keys/{key_id}",
headers={"Authorization": f"Bearer {token}"},
)
r.raise_for_status()
print(r.json())const keyId = 42;
const r = await fetch(`https://platform.serverscamp.com/api/v1/ssh-keys/${keyId}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
});
console.log(r.status, await r.json());Answer
Status 200 with this body.
| Field | Type | Description |
|---|---|---|
| success | boolean | Operation success |
| message | string, optional | Success message |
| data | object, optional | Additional data |
{
"success": true,
"message": "SSH key deleted"
}Errors
| Status | When |
|---|---|
401 | No token, or a token that is not valid |
404 | No such key in your account |
422 | The body or a parameter is not what the operation takes |
Every operation can also answer 401 without a valid token. All errors