SSH ›
Add ssh key
POST
/v1/sandboxes/{id}/ssh/keysLets a public key log in to the sandbox as root. It opens nothing and starts nothing: whether the sandbox can be reached is PUT /v1/sandboxes/{id}/ssh. A key that is already let in is not added twice, and the answer is the same. The sandbox has to be running. A fork has its source's keys, and a roll-back puts back the ones the snapshot had.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const key = await sandbox.ssh.addKey(publicKey);
Answer201 Created · SshKey
- {
- "id": string,
- "fingerprint": string,
- "type": string,
- "comment": string | null,
- }
The key may log in.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Body
publicKeyrequiredstring |
Returns
201 The key may log in.
SshKey4 fields
idstring
What the key is named by when it is removed: the SHA-256 of the key, written so that it can stand in a path.
fingerprintstring
The same, as ssh-keygen -l prints it.
typestring
commentstringnull
What follows the key on its line.
More
Null when nothing does.Errors and other answers
| 400 | invalid_request publicKey is not one OpenSSH public key line. |
| 404 | Not found. |
| 409 | sandbox_not_running. |
| 501 | ssh_endpoint_not_configured sandboxes here are not logged in to over SSH. GET /v1/policy says so as ssh. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.