Accept an SSH Key
Last updated Changelog
On this page
http
POST /crates/{handle}/logins/{login}/keys
Has the login accept a key. A key the crate already has (matched by fingerprint) is ticked for the login; a new one is loaded onto the crate on the way. 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 login already accepts 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 a key new to the crate (max 100) |
Response (201)
json
{ "fingerprint": "SHA256:evMii4DCaw+hEMB69TCBxgJ7IHWp5YzNTFV9ALfjTUg", "message": "Key accepted." }
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. |