# SSH Keys endpoints (Client API: account)

> 9 FeatherPanel Client API: account endpoints from user/ssh-keys.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/user/ssh-keys/

Defined in [`backend/app/routes/user/ssh-keys.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php). Authentication used here: **Signed-in user**. Read [Authentication](https://featherpanel.com/docs/api/authentication/) for how to send credentials and [Rate limits and errors](https://featherpanel.com/docs/api/rate-limits-and-errors/) for the response envelope.

Paths, methods, permissions and rate limits come from the route file. Summaries, parameters and response codes come from the OpenAPI annotations on the controllers; endpoints without annotations show only what the route file declares.

## Endpoints

### GET `/api/user/ssh-keys`

- Auth: Signed-in user
- Default rate limit: 30 / minute (`user-ssh-keys`)
- Route name: `user-ssh-keys`
- Controller: [`UserSshKeyController::getUserSshKeys`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L27)

**Get SSH keys** Retrieve all SSH keys for the authenticated user with pagination and search functionality.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | Page number for pagination |
| `limit` | query | integer | no | Number of records per page |
| `search` | query | string | no | Search term to filter SSH keys by name |
| `include_deleted` | query | boolean | no | Include soft-deleted SSH keys |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `ssh_keys` | UserSshKeyList\[\] |  |
| `pagination` | SshKeyPagination |  |
| `search` | SshKeySearch |  |

```bash
curl -X GET "$PANEL_URL/api/user/ssh-keys" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` SSH keys retrieved successfully · `400` Bad request - Invalid authentication token · `401` Unauthorized - User not authenticated · `500` Internal server error - Failed to retrieve SSH keys

### POST `/api/user/ssh-keys`

- Auth: Signed-in user
- Route name: `user-ssh-key-create`
- Controller: [`UserSshKeyController::createUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L39)

**Create SSH key** Create a new SSH key for the authenticated user with automatic fingerprint generation.

Request body: [`SshKeyCreateRequest`](https://featherpanel.com/docs/api/schemas/#schema-sshkeycreaterequest) (application/json) · Response data: [`UserSshKey`](https://featherpanel.com/docs/api/schemas/#schema-usersshkey)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | SSH key name |
| `public_key` | string | yes | SSH public key |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | SSH key ID |
| `user_id` | integer | User ID |
| `name` | string | SSH key name |
| `public_key` | string | SSH public key |
| `fingerprint` | string | SSH key fingerprint |
| `created_at` | string (date-time) | Creation timestamp |
| `updated_at` | string (date-time) | Last update timestamp |
| `deleted_at` | string (date-time) | Deletion timestamp |

```bash
curl -X POST "$PANEL_URL/api/user/ssh-keys" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"","public_key":""}'
```

Plugin events: [`featherpanel:user:ssh_key:created`](https://featherpanel.com/docs/plugins/events/user/#user-ssh-key-created)

Responses: `201` SSH key created successfully · `400` Bad request - Invalid authentication token, missing required fields, or invalid name length · `401` Unauthorized - User not authenticated · `500` Internal server error - Failed to create SSH key

### GET `/api/user/ssh-keys/{id}`

- Auth: Signed-in user
- Default rate limit: 30 / minute (`user-ssh-keys`)
- Route name: `user-ssh-key-get`
- Controller: [`UserSshKeyController::getUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L49)

**Get specific SSH key** Retrieve details of a specific SSH key by ID for the authenticated user.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | SSH key ID |

Response data: [`UserSshKey`](https://featherpanel.com/docs/api/schemas/#schema-usersshkey)

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | SSH key ID |
| `user_id` | integer | User ID |
| `name` | string | SSH key name |
| `public_key` | string | SSH public key |
| `fingerprint` | string | SSH key fingerprint |
| `created_at` | string (date-time) | Creation timestamp |
| `updated_at` | string (date-time) | Last update timestamp |
| `deleted_at` | string (date-time) | Deletion timestamp |

```bash
curl -X GET "$PANEL_URL/api/user/ssh-keys/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` SSH key retrieved successfully · `400` Bad request - Invalid authentication token or SSH key ID · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to SSH key · `404` Not found - SSH key not found · `500` Internal server error - Failed to retrieve SSH key

### PUT `/api/user/ssh-keys/{id}`

- Auth: Signed-in user
- Default rate limit: 10 / minute (`user-ssh-keys`)
- Route name: `user-ssh-key-update`
- Controller: [`UserSshKeyController::updateUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L66)

**Update SSH key** Update an existing SSH key for the authenticated user. Can update name and public key.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | SSH key ID |

Request body: [`SshKeyUpdateRequest`](https://featherpanel.com/docs/api/schemas/#schema-sshkeyupdaterequest) (application/json) · Response data: [`UserSshKey`](https://featherpanel.com/docs/api/schemas/#schema-usersshkey)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | SSH key name |
| `public_key` | string | no | SSH public key |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | SSH key ID |
| `user_id` | integer | User ID |
| `name` | string | SSH key name |
| `public_key` | string | SSH public key |
| `fingerprint` | string | SSH key fingerprint |
| `created_at` | string (date-time) | Creation timestamp |
| `updated_at` | string (date-time) | Last update timestamp |
| `deleted_at` | string (date-time) | Deletion timestamp |

```bash
curl -X PUT "$PANEL_URL/api/user/ssh-keys/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"","public_key":""}'
```

Plugin events: [`featherpanel:user:ssh_key:updated`](https://featherpanel.com/docs/plugins/events/user/#user-ssh-key-updated)

Responses: `200` SSH key updated successfully · `400` Bad request - Invalid authentication token, SSH key ID, request data, or invalid name length · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to SSH key · `404` Not found - SSH key not found · `500` Internal server error - Failed to update SSH key

### DELETE `/api/user/ssh-keys/{id}`

- Auth: Signed-in user
- Default rate limit: 10 / minute (`user-ssh-keys`)
- Route name: `user-ssh-key-delete`
- Controller: [`UserSshKeyController::deleteUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L83)

**Delete SSH key** Soft delete an SSH key for the authenticated user. The key can be restored later.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | SSH key ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

```bash
curl -X DELETE "$PANEL_URL/api/user/ssh-keys/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:user:ssh_key:deleted`](https://featherpanel.com/docs/plugins/events/user/#user-ssh-key-deleted)

Responses: `200` SSH key deleted successfully · `400` Bad request - Invalid authentication token or SSH key ID · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to SSH key · `404` Not found - SSH key not found · `500` Internal server error - Failed to delete SSH key

### POST `/api/user/ssh-keys/{id}/restore`

- Auth: Signed-in user
- Route name: `user-ssh-key-restore`
- Controller: [`UserSshKeyController::restoreUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L100)

**Restore SSH key** Restore a soft-deleted SSH key for the authenticated user.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | SSH key ID |

Response data: [`UserSshKey`](https://featherpanel.com/docs/api/schemas/#schema-usersshkey)

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | SSH key ID |
| `user_id` | integer | User ID |
| `name` | string | SSH key name |
| `public_key` | string | SSH public key |
| `fingerprint` | string | SSH key fingerprint |
| `created_at` | string (date-time) | Creation timestamp |
| `updated_at` | string (date-time) | Last update timestamp |
| `deleted_at` | string (date-time) | Deletion timestamp |

```bash
curl -X POST "$PANEL_URL/api/user/ssh-keys/$ID/restore" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:user:ssh_key:updated`](https://featherpanel.com/docs/plugins/events/user/#user-ssh-key-updated)

Responses: `200` SSH key restored successfully · `400` Bad request - Invalid authentication token or SSH key ID · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to SSH key · `404` Not found - SSH key not found · `500` Internal server error - Failed to restore SSH key

### DELETE `/api/user/ssh-keys/{id}/hard-delete`

- Auth: Signed-in user
- Default rate limit: 5 / minute (`user-ssh-keys`)
- Route name: `user-ssh-key-hard-delete`
- Controller: [`UserSshKeyController::hardDeleteUserSshKey`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L115)

**Hard delete SSH key** Permanently delete an SSH key for the authenticated user. This action cannot be undone.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | SSH key ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

```bash
curl -X DELETE "$PANEL_URL/api/user/ssh-keys/$ID/hard-delete" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:user:ssh_key:deleted`](https://featherpanel.com/docs/plugins/events/user/#user-ssh-key-deleted)

Responses: `200` SSH key permanently deleted successfully · `400` Bad request - Invalid authentication token or SSH key ID · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to SSH key · `404` Not found - SSH key not found · `500` Internal server error - Failed to permanently delete SSH key

### POST `/api/user/ssh-keys/generate-fingerprint`

- Auth: Signed-in user
- Route name: `user-ssh-key-generate-fingerprint`
- Controller: [`UserSshKeyController::generateFingerprint`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L132)

**Generate SSH key fingerprint** Generate a fingerprint from an SSH public key for validation purposes.

Request body: [`SshKeyFingerprintRequest`](https://featherpanel.com/docs/api/schemas/#schema-sshkeyfingerprintrequest) (application/json) · Response data: [`SshKeyFingerprintResponse`](https://featherpanel.com/docs/api/schemas/#schema-sshkeyfingerprintresponse)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `public_key` | string | yes | SSH public key to generate fingerprint for |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `fingerprint` | string | Generated fingerprint |
| `public_key` | string | Original public key |

```bash
curl -X POST "$PANEL_URL/api/user/ssh-keys/generate-fingerprint" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"public_key":""}'
```

Responses: `200` Fingerprint generated successfully · `400` Bad request - Invalid authentication token, missing public key, empty public key, or invalid SSH key format · `401` Unauthorized - User not authenticated · `500` Internal server error - Failed to generate fingerprint

### GET `/api/user/ssh-keys/activities`

- Auth: Signed-in user
- Default rate limit: 30 / minute (`user-ssh-keys`)
- Route name: `user-ssh-key-activities`
- Controller: [`UserSshKeyController::getUserSshKeyActivities`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/User/UserSshKeyController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ssh-keys.php#L142)

**Get SSH key activities** Retrieve SSH key related activities for the authenticated user with pagination.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | Page number for pagination |
| `limit` | query | integer | no | Number of records per page |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `activities` | SshKeyActivity\[\] |  |
| `pagination` | SshKeyPagination |  |

```bash
curl -X GET "$PANEL_URL/api/user/ssh-keys/activities" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` SSH key activities retrieved successfully · `400` Bad request - Invalid authentication token · `401` Unauthorized - User not authenticated · `500` Internal server error - Failed to retrieve activities
