Delete an SSH key
Removes a key, a Legacy key included, from its owner. Send the key's fingerprint in confirm_fingerprint, in the request body; the key stops working on every environment it reached through this owner, and remaining_sources lists the places the same key is still held. Removing a company key needs the Delete or the Edit Company SSH Keys permission.
Path parameters
The id of a key, as the key lists answer it in id. Digits only. At least 1.
Body
The key's fingerprint, exactly as the lists answer it.
Returns
202 The removal was started. Follow change_id with GET /ssh/changes/{change}. Poll the operation until it finishes.
Fields of the 202 answer
Places the same key is still held. It keeps working through them.
Fields of each item
agencycompanywebsiteenvironmentuserlegacysystemWhere a key is held: a company, a website, an environment or a person.
Fields
The id of the company, website, environment or user.
companywebsiteenvironmentuserIf it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | forbidden | The person is not allowed to do this. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
404 | not_found | Not found. |
409 | ssh_managed_on_another_environment | This environment's SSH is managed on another environment. Make the change on the environment the answer names. |
422 | confirm_mismatch | Send the confirmation exactly as the field named in field asks for it. |
422 | invalid_arguments | The arguments do not match the tool's input schema, or the Control Panel refused a field. Fix the fields named in the answer and call again. |
429 | ssh_throttled | Too many SSH key changes — try again in a minute. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X DELETE https://manage.corefinity.com/api/ssh/keys/7305 \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"confirm_fingerprint": "SHA256:o6poLLVqPDVYtxLTdagh8mUo96coeRXfX7Uxorxr158"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->delete('https://manage.corefinity.com/api/ssh/keys/7305', [
'confirm_fingerprint' => 'SHA256:o6poLLVqPDVYtxLTdagh8mUo96coeRXfX7Uxorxr158',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/ssh/keys/7305', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
confirm_fingerprint: 'SHA256:o6poLLVqPDVYtxLTdagh8mUo96coeRXfX7Uxorxr158',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.delete(
"https://manage.corefinity.com/api/ssh/keys/7305",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"confirm_fingerprint": "SHA256:o6poLLVqPDVYtxLTdagh8mUo96coeRXfX7Uxorxr158",
},
)
data = res.json() if res.content else None{
"change_id": 48215,
"remaining_sources": []
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "ssh_managed_on_another_environment",
"field": null,
"managed_on": {
"id": 1312,
"name": "Staging"
},
"message": "SSH for this server is managed on Staging.",
"reason": "ssh_managed_on_another_environment"
}{
"code": "confirm_mismatch",
"errors": {
"confirm_fingerprint": [
"The fingerprint you typed is not this key's."
]
},
"field": "confirm_fingerprint",
"message": "The fingerprint you typed is not this key's.",
"reason": "confirm_mismatch"
}{
"code": "ssh_throttled",
"field": null,
"message": "Too many SSH key changes — try again in a minute.",
"reason": "ssh_throttled"
}Try it is off for this endpointIt deletes data that cannot be brought back. Copy the request and run it yourself when you are sure.