Issue an SSH certificate
curl --request POST \
--url https://sailbox-api.sailresearch.com/v1/ssh/certificate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com"
}
'import requests
url = "https://sailbox-api.sailresearch.com/v1/ssh/certificate"
payload = { "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com'
})
};
fetch('https://sailbox-api.sailresearch.com/v1/ssh/certificate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sailbox-api.sailresearch.com/v1/ssh/certificate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sailbox-api.sailresearch.com/v1/ssh/certificate"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sailbox-api.sailresearch.com/v1/ssh/certificate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sailbox-api.sailresearch.com/v1/ssh/certificate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"certificate": "<string>",
"key_id": "<string>"
}{
"error": {
"message": "memory_gib for size m must be between 8 and 128",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "Your API key has been disabled due to insufficient credits. Visit https://app.sailresearch.com/billing to add credits.",
"type": "billing_error",
"param": null,
"code": "credits_exhausted",
"billing_url": "https://app.sailresearch.com/billing"
}
}{
"error": {
"message": "sailboxes require an organization-scoped API key",
"type": "permission_error",
"param": null,
"code": null
}
}{
"error": {
"message": "request body too large",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Too many concurrent requests. Please retry after some of your organization's in-flight requests complete.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited"
}
}{
"error": {
"message": "failed to fetch sailbox",
"type": "server_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Authentication service unavailable",
"type": "server_error",
"param": null,
"code": null
}
}SSH access
Issue an SSH certificate
Signs your SSH public key so you can connect to a Sailbox that has SSH turned on. Save the returned certificate next to your private key as <key>-cert.pub and ssh presents it automatically. Certificates are short-lived, so ask for a fresh one rather than storing it long term.
Turning SSH on inside a Sailbox needs an SDK or the CLI, and only has to happen once per Sailbox. After that, publish port 22 as a tcp listener and dial the host and port it returns. See Networking for the full walkthrough.
POST
/
ssh
/
certificate
Issue an SSH certificate
curl --request POST \
--url https://sailbox-api.sailresearch.com/v1/ssh/certificate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com"
}
'import requests
url = "https://sailbox-api.sailresearch.com/v1/ssh/certificate"
payload = { "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com'
})
};
fetch('https://sailbox-api.sailresearch.com/v1/ssh/certificate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sailbox-api.sailresearch.com/v1/ssh/certificate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'public_key' => 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sailbox-api.sailresearch.com/v1/ssh/certificate"
payload := strings.NewReader("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sailbox-api.sailresearch.com/v1/ssh/certificate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sailbox-api.sailresearch.com/v1/ssh/certificate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"public_key\": \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"certificate": "<string>",
"key_id": "<string>"
}{
"error": {
"message": "memory_gib for size m must be between 8 and 128",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error",
"param": null,
"code": "invalid_api_key"
}
}{
"error": {
"message": "Your API key has been disabled due to insufficient credits. Visit https://app.sailresearch.com/billing to add credits.",
"type": "billing_error",
"param": null,
"code": "credits_exhausted",
"billing_url": "https://app.sailresearch.com/billing"
}
}{
"error": {
"message": "sailboxes require an organization-scoped API key",
"type": "permission_error",
"param": null,
"code": null
}
}{
"error": {
"message": "request body too large",
"type": "invalid_request_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Too many concurrent requests. Please retry after some of your organization's in-flight requests complete.",
"type": "rate_limit_error",
"param": null,
"code": "rate_limited"
}
}{
"error": {
"message": "failed to fetch sailbox",
"type": "server_error",
"param": null,
"code": null
}
}{
"error": {
"message": "Authentication service unavailable",
"type": "server_error",
"param": null,
"code": null
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Your SSH public key, in OpenSSH authorized_keys format.
Minimum string length:
1Pattern:
\SExample:
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4yn2NJYJ23X+VL6P4UO7AO5G6l3QqJ0ffuLUbnR2BX you@example.com"
⌘I