API reference · SSH keys
Delete an SSH key
DELETE
/v1/ssh-keys/{ssh_key_id}API keyssh_key:deleteProject
- TypeScript
client.sshKeys.delete()- Python
client.ssh_keys.delete()- CLI
hayonix ssh-keys delete
Removes the key from the project. Within moments pods stop accepting it, and open SSH sessions made with it are closed.
Project API key (Authorization: Bearer sk_…), or a console session. Requires the ssh_key:delete permission (a key's scope, or a role that includes it).
Examples
The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.
curl -sS -X DELETE "$API_BASE_URL/ssh-keys/ssh_01jc5zq4m8k3v6x9t2w7r0b1e4" \
-H "Authorization: Bearer $API_KEY"Request
| Header | Required | Description |
|---|---|---|
Authorization | yes | Bearer and your API key. The key implies its project. |
X-Project-Id | session only | The project to act in, for console sessions. Requests with an API key leave it out. |
Path parameters
ssh_key_idstringrequiredID of the ssh key
ID with prefix ssh_
Response
200 JSON — The key was deleted
idstringrequiredID of the deleted resource
objectstringrequiredAlways `ssh_key`
One of
ssh_keydeletedbooleanrequiredAlways true: the resource is deleted
One of
true
Example response
Example response
{
"id": "string",
"object": "ssh_key",
"deleted": true
}Errors
Errors use the standard envelope. What this operation can answer:
| Status | Type | When |
|---|---|---|
400 | invalid_request_error | A parameter or body field is missing or not allowed; param names it. |
401 | authentication_error | The key or session is missing, revoked or expired. |
403 | permission_error | The credential lacks the permission this needs, or the organization is suspended. |
404 | not_found_error | No such resource in this project (an ID from another project is answered the same way). |
409 | conflict_error | The resource's current state does not allow this. |
429 | rate_limit_error rate_limited | Too many requests; retry after retry-after seconds. |