Rotate an environment's host keys
Starts or moves on a host-key rotation of a CoreStack or CoreCluster environment: stage offers new host keys beside the current ones, finish switches to them, cancel drops a staged rotation and now switches at once, so every client then sees a changed host key. Type the environment's name in confirm_environment; an environment takes six rotation steps an hour.
Path parameters
The id of a CoreStack Enterprise environment. Not the same number as a site row id. At least 1.
Body
stage offers new host keys beside the current ones. finish switches to the staged keys. cancel drops a staged rotation. now makes new keys and switches at once.
stagenowfinishcancelThe environment's name, exactly as GET /environments/{environment}/ssh answers it.
Returns
202 The rotation step was started. rotation_id is the rotation's id and rotation is the rotation as it stands. Follow it by reading GET / until rotation.state is done, cancelled, aborted or failed for the same rotation.rotation_id; a staged rotation waits in offered until it is finished or its day comes. change_id is always 0: a rotation is not a change that GET /ssh/changes/{change} answers. Poll the operation until it finishes.
Fields of the 202 answer
Always 0. A rotation is followed by its rotation_id, not as a change.
The rotation as it stands. Null only when it could not be read back; read the host keys instead.
The rotation's id, the same value as rotation.rotation_id in the host keys.
If 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 | 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_rotation_in_progress | A host-key rotation is already in progress. Wait for it to finish, or finish or cancel it. |
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. |
422 | ssh_host_keys_unmanaged | Host keys on this environment are managed by Corefinity. Nothing to rotate here. |
422 | ssh_rotation_unavailable | The environment cannot rotate its host keys now, or there is no staged rotation to finish or cancel. Read the host keys again. |
429 | ssh_throttled | Too many host-key rotations on this environment. Try again later. |
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 POST https://manage.corefinity.com/api/environments/1311/ssh/host-keys/rotation \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"action": "now",
"confirm_environment": "Production"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->post('https://manage.corefinity.com/api/environments/1311/ssh/host-keys/rotation', [
'action' => 'now',
'confirm_environment' => 'Production',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/environments/1311/ssh/host-keys/rotation', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
action: 'now',
confirm_environment: 'Production',
}),
});
// 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.post(
"https://manage.corefinity.com/api/environments/1311/ssh/host-keys/rotation",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"action": "now",
"confirm_environment": "Production",
},
)
data = res.json() if res.content else None{
"change_id": 0,
"rotation": {
"id": 3301,
"last_error_public": null,
"mode": "staged",
"offered_at": "2026-11-06T09:20:00+00:00",
"promote_after": "2026-11-13T09:20:00+00:00",
"rotation_id": "hkr-0f1e2d3c4b5a",
"state": "offered"
},
"rotation_id": "hkr-0f1e2d3c4b5a"
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "ssh_rotation_in_progress",
"field": null,
"message": "A host-key rotation is already in progress.",
"reason": "ssh_rotation_in_progress"
}{
"code": "confirm_mismatch",
"errors": {
"confirm_environment": [
"The name you typed is not this environment's name."
]
},
"field": "confirm_environment",
"message": "The name you typed is not this environment's name.",
"reason": "confirm_mismatch"
}{
"code": "ssh_throttled",
"field": null,
"message": "Too many host-key rotations on this environment. Try again later.",
"reason": "ssh_throttled",
"retry_after": 1840,
"retry_after_seconds": 1840
}Try it is off for this endpointIt overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.