Update Crate SSH Key
Last updated Changelog
On this page
PATCH /crates/{handle}/keys/{fingerprint}
Changes a key on the crate. Send only what changes. A new public_key rotates it: every login that accepted the old key accepts the new one instead, and their connections drop, so nothing stays signed in with the old key. logins replaces the list of logins that accept it; one that loses it has its connections dropped. {fingerprint} is the key’s current fingerprint, with or without SHA256:. 404 when the crate has no such key or names a login it doesn’t have; 422 when the new key can’t be read or the crate already has it as another key.
Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| label | string | No | unchanged | A name for the key (max 100); empty clears it |
| public_key | string | No | unchanged | One line from a .pub file, replacing the key |
| logins | array | No | unchanged | Full login names that accept it |
Response
{ "fingerprint": "SHA256:evMii4DCaw+hEMB69TCBxgJ7IHWp5YzNTFV9ALfjTUg", "message": "Key saved." }
fingerprint is the key’s fingerprint after the change.
Errors
Besides the errors any endpoint can return:
| Status | Code | When |
|---|---|---|
| 400 | operation_rejected |
The server behind the API (mail, database, storage) or the registrar refused the operation. error says why. |
| 403 | scope_denied |
This API key does not have Crates write access for this crate. |
| 403 | service_inactive |
This crate is not active. |
| 404 | not_found |
Key not found. Crate not found. Login not found. |
| 502 | upstream_unavailable |
This crate has no storage node. |