Add an SSH key to a sandbox
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
publicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com',
name: '<string>'
})
};
fetch('https://vms.dev/api/v1/sandboxes/{id}/ssh-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://vms.dev/api/v1/sandboxes/{id}/ssh-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com",
"name": "<string>"
}
'import requests
url = "https://vms.dev/api/v1/sandboxes/{id}/ssh-keys"
payload = {
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "ssk_06d8k3m7q2v9x4b1n5c0e8f2ja",
"sandboxId": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja",
"name": "dev@example.com",
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al",
"fingerprint": "SHA256:DbPhl9dNAPM0TB3+SLh/OdwIJ9Rtl3hGJU6s/NJyjOg",
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}Sandboxes
Add an SSH key to a sandbox
Adds a public key to the sandbox. Then ssh <name>@ssh.vms.dev with this key opens a shell in the sandbox as user, and so does SSH to the IPv6 address of the sandbox. A running sandbox gets the key in a few seconds. A sandbox can have 20 keys. Needs the sandboxes:ssh scope.
POST
/
v1
/
sandboxes
/
{id}
/
ssh-keys
Add an SSH key to a sandbox
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
publicKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com',
name: '<string>'
})
};
fetch('https://vms.dev/api/v1/sandboxes/{id}/ssh-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://vms.dev/api/v1/sandboxes/{id}/ssh-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com",
"name": "<string>"
}
'import requests
url = "https://vms.dev/api/v1/sandboxes/{id}/ssh-keys"
payload = {
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al dev@example.com",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "ssk_06d8k3m7q2v9x4b1n5c0e8f2ja",
"sandboxId": "sbx_06d8k3m7q2v9x4b1n5c0e8f2ja",
"name": "dev@example.com",
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINiCC4DtKiK4pnatEMwz9fpZks348+f9WnodyRCkr/al",
"fingerprint": "SHA256:DbPhl9dNAPM0TB3+SLh/OdwIJ9Rtl3hGJU6s/NJyjOg",
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}{
"error": {
"code": "no_capacity",
"message": "<string>",
"requestId": "<string>",
"retryAfterSeconds": 4503599627370495,
"sandboxId": "<string>"
}
}Authorizations
Body
application/json
Response
The key is added.