Add Crate SSH Key
Last updated Changelog
On this page
http
POST /crates/{handle}/keys
Loads a public key onto the crate, accepted by the logins named (none is fine: logins can accept it later). ssh-ed25519, ecdsa-sha2-nistp256/384/521, security keys (sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com) and ssh-rsa of 2048 bits or more are accepted. 422 when the key can’t be read or the crate already has it; a crate holds up to 50 keys.
Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| public_key | string | Yes | One line from a .pub file |
|
| label | string | No | the key’s comment | A name for the key (max 100) |
| logins | array | No | [] |
Full login names that accept it, like c7xk2m9p-nas |
Response (201)
json
{ "fingerprint": "SHA256:evMii4DCaw+hEMB69TCBxgJ7IHWp5YzNTFV9ALfjTUg", "message": "Key added." }
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 |
Crate not found. Login not found. |
| 502 | upstream_unavailable |
This crate has no storage node. |