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

**Keep a Legacy SSH key.** Keeps a Legacy SSH key (from corestack_ssh_legacy_list) working after the old shared list ends, for the owner given. Scope: write. Long-running: answers with a task.

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

## When to use it

Keep a Legacy key (from corestack_ssh_legacy_list) so it still works after the old shared list ends: at an environment, website or company (it logs in as `web`), or as your own personal key (`user` with your id). Long-running.

## Inputs

- `key_id` (integer, required): a Legacy key's id.
- `owner` (object, required): `{type, id}` — where to keep it.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "key_id": {
      "description": "A Legacy key's id (corestack_ssh_legacy_list).",
      "minimum": 1,
      "type": "integer"
    },
    "owner": {
      "additionalProperties": false,
      "description": "Where to keep it: an environment, website or company (it logs in as web), or user — your own id — to make it your personal key.",
      "properties": {
        "id": {
          "minimum": 1,
          "type": "integer"
        },
        "type": {
          "enum": [
            "environment",
            "website",
            "company",
            "user"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "id"
      ],
      "type": "object"
    }
  },
  "required": [
    "key_id",
    "owner"
  ],
  "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`: keeping the key as a company's key and the person's role lacks the Create Company SSH Keys permission.
  The message names it and says an owner of the company can grant it in Roles; `details.permission` is
  `createCompanySSHKeys`. 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.
- `ssh_not_legacy`: the key is not a Legacy key.
- `ssh_legacy_ended`: the Legacy list has already ended.
- `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_legacy_key_keep",
  "arguments": {
    "key_id": 80211,
    "owner": {
      "type": "company",
      "id": 4211
    }
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_ssh_legacy_key_keep with key_id 80211, owner {"type":"company","id":4211}. (Keep a Legacy SSH key.) Tell me what it returned.
```

## The same task elsewhere

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