---
title: "corestack_ssh_key_update"
url: https://docs.corefinity.com/mcp/tools/corestack_ssh_key_update
type: tool
last_updated: 2026-11-13
feature: ssh-keys
related:
  - https://docs.corefinity.com/api/reference/access/update-ssh-key.md
  - https://docs.corefinity.com/guides/sites/access-and-security/ssh-keys.md
---
# corestack_ssh_key_update

**Change an SSH public key.** Renames an SSH key, or changes which environments a company or website key applies to. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Confirmation: `confirm_fingerprint`
- Runs as a task: yes

## When to use it

Rename a key, or change which environments a company or website key applies to. Removing environments needs `confirm_fingerprint`, typed exactly as corestack_ssh_keys_list shows it; a rename or a widening needs none. Long-running when it changes where the key works.

## Inputs

- `key_id` (integer, required)
- `name` (string): at most 100 characters.
- `applies_to` (object): `{mode: all}` or `{mode: selected, environment_ids}`.
- `confirm_fingerprint` (string): required when `applies_to` removes environments — the key's `SHA256:` fingerprint.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "applies_to": {
      "additionalProperties": false,
      "description": "Company and website keys only: all environments (default), or selected ones (environment_ids, at least one).",
      "properties": {
        "environment_ids": {
          "items": {
            "minimum": 1,
            "type": "integer"
          },
          "maxItems": 500,
          "type": "array"
        },
        "mode": {
          "enum": [
            "all",
            "selected"
          ],
          "type": "string"
        }
      },
      "required": [
        "mode"
      ],
      "type": "object"
    },
    "confirm_fingerprint": {
      "description": "Required when applies_to removes environments: type the key's fingerprint exactly as corestack_ssh_keys_list shows it (SHA256:…). A rename needs none.",
      "maxLength": 60,
      "minLength": 1,
      "type": "string"
    },
    "key_id": {
      "minimum": 1,
      "type": "integer"
    },
    "name": {
      "description": "A name you will recognise the key by (at most 100 characters).",
      "maxLength": 100,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "key_id"
  ],
  "type": "object"
}
```

## Refusals

- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- `forbidden`: a company's key and the person's role lacks the Edit Company SSH Keys permission. The message names it
  and says an owner of the company can grant it in Roles; `details.permission` is `editCompanySSHKeys`. Nothing is
  changed.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).
- `switched_off`: SSH keys are not switched on for this object yet.
- `confirm_mismatch`: the typed fingerprint is not this key's.
- `ssh_managed_on_another_environment`: this CoreStack Enterprise environment runs on the same server as another environment whose SSH the Control Panel manages, so its own keys are added, changed and removed there; the refusal's `managed_on` names that environment (`{id, name}`).
- `enterprise_panel_only`: SSH keys for CoreStack Enterprise environments are managed in the Control Panel only at the moment.

## Example

```json
{
  "name": "corestack_ssh_key_update",
  "arguments": {
    "key_id": 70120,
    "name": "Deploy key (CI)"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_ssh_key_update with key_id 70120, name Deploy key (CI). (Change an SSH public key.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [PATCH /api/ssh/keys/{key}](https://docs.corefinity.com/api/reference/access/update-ssh-key.md)
- Guide: [SSH keys](https://docs.corefinity.com/guides/sites/access-and-security/ssh-keys.md)
