---
title: "Detach an SSH key from a rental"
method: POST
path: "/v2/on-demand/rentals/ssh-keys/detach"
tags: ["rentals"]
---

# Detach an SSH key from a rental

`POST /v2/on-demand/rentals/ssh-keys/detach`

## Request

- Base URL: `https://api.hyperbolic.ai`
- URL: `https://api.hyperbolic.ai/v2/on-demand/rentals/ssh-keys/detach`
- Auth: HTTP bearer

Detach a saved SSH public key from a running or pending virtual machine rental, without a restart.

## Request body

- object
  - `rentalId` union, required
    - string: The rental's `rentalId`.
    - integer: Deprecated. The rental's legacy numeric id; use `rentalId`.
  - `sshPublicKeyId` integer, required

## Response `200`

Successful response

- SuccessResponse: Result of an operation that returns no payload.
  - `success` boolean, required

## Other responses

- `400`: Invalid input data
- `401`: Authorization not provided
- `403`: Insufficient access
- `500`: Internal server error

## Changes

- **2026-10-14** `e5723257832a`: 1 breaking, 1 info
  - removed `subschema #1, subschema #2` from the `rentalId` request property `anyOf` list
  - added `subschema #1, subschema #2` to the `rentalId` request property `anyOf` list
- **2026-10-13** `2783d282fe8e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/hyperbolic/apis/castle-api/changes/v2/on-demand/rentals/ssh-keys/detach/post.md)

---

[API](https://skmtc.dev/hyperbolic/apis/castle-api.md) - [All operations](https://skmtc.dev/hyperbolic/apis/castle-api/llms.txt) - [OpenAPI document](https://skmtc.dev/hyperbolic/apis/castle-api/revisions/d4d4f25214b8?raw)
