/v1/ssh-keysAdds an SSH public key to your account and to the workspace. The key must be a single line in
OpenSSH authorized_keys format, such as the contents of ~/.ssh/id_ed25519.pub.
Names and keys are unique per account, across all your workspaces: you cannot add two keys with the same name, or the same key twice.
Requires the owner, admin or developer role. Viewers get 403.
Authentication
Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
Request body
namestringRequiredLabel for the key. Leading and trailing spaces are trimmed. Must be unique among your keys.
public_keystringRequiredThe public key in OpenSSH authorized_keys format (<type> <base64> [comment]). Leading and trailing whitespace is trimmed.
Response
The key was added.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
uidstringRequiredUnique identifier of the key. Use it in ssh_key_uids when creating a VM.
namestringRequiredLabel given to the key.
fingerprintstringRequiredSHA-256 fingerprint of the public key, in the same format as ssh-keygen -l.
created_atstring (date-time)RequiredWhen the key was added.
Errors
| Status | Meaning |
|---|---|
400 | Validation failed: invalid request (malformed JSON, or name or public_key missing or empty), name and public_key are required (a field is only whitespace), invalid ssh public key, an ssh key with this name already exists, or this ssh key has already been added to your account. A missing X-Workspace-Slug header returns workspace is required. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
Errors use the standard error format.