Create an authenticated preview
curl --request POST \
--url https://api.runaether.dev/workspaces/{workspaceID}/preview-auth \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"port": 32768,
"sibling_ports": [
32768
]
}
'import requests
url = "https://api.runaether.dev/workspaces/{workspaceID}/preview-auth"
payload = {
"port": 32768,
"sibling_ports": [32768]
}
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({port: 32768, sibling_ports: [32768]})
};
fetch('https://api.runaether.dev/workspaces/{workspaceID}/preview-auth', 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://api.runaether.dev/workspaces/{workspaceID}/preview-auth",
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([
'port' => 32768,
'sibling_ports' => [
32768
]
]),
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://api.runaether.dev/workspaces/{workspaceID}/preview-auth"
payload := strings.NewReader("{\n \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\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://api.runaether.dev/workspaces/{workspaceID}/preview-auth")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/workspaces/{workspaceID}/preview-auth")
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 \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\n}"
response = http.request(request)
puts response.read_body{
"kind": "url",
"requires_client_application": true,
"local_storage": {},
"reload": true,
"url": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Workspaces
Create an authenticated preview
Runs the repository-owned preview auth hook for one preview port inside the running workspace and answers 201 with the authenticated preview it created.
Use this tool when you need to:
- Open a workspace preview that needs a signed-in session without signing in by hand
- Get the URL, or the local storage entries, that authenticate a preview in the browser
Examples:
- POST /workspaces/{workspaceID}/preview-auth {"port": 3000}
- POST /workspaces/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/preview-auth {"port": 3000, "sibling_ports": [8080]}
Hints:
- port is required, 1 to 65535; sibling_ports is optional, at most 128 ports of 1 to 65535; the schema answers a plain 422 otherwise, and no body is 400. The hook gets the preview origin of port plus those of the sibling ports and of every preview the workspace declares.
- The hook is the auth_command declared for the port under previews in the repository's .aether/environment.json; it may run for 30 seconds.
- URL results can be opened directly: kind url with url, requires_client_application false. local_storage results require explicit client-side application: kind local_storage with local_storage entries and reload, requires_client_application true.
- Refused with 404 preview_auth_not_declared when the port declares no auth_command, and 422 when the hook fails, with its code (preview_auth_command_failed, preview_auth_timeout, preview_auth_output_too_large for stdout over 64 KiB, preview_auth_invalid_output) and stderr_tail, the last 8 KiB of its stderr at most.
- Refused with 409 workspace_not_running when its machine is not running, 409 preview_auth_workspace_upgrade_required for a workspace that predates preview auth (restart it), 503 workspace_preview_auth_service_not_ready when the workspace service still refuses connections after 90 seconds, and 502 when it cannot be reached or the workspace has no machine.
- Use connectTask on its task instead to start the workspace or open a live connection to it first; use getWorkspace to read its declared previews.
- Owners, admins and members of the workspace's organization, whichever organization the caller selected; a viewer or billing member is refused with 403 org_role_insufficient, a suspended organization with 403 org_suspended, a workspace the caller cannot see is 404, and 503 when the membership check is unavailable. An agent host's grant is refused with 403 agent_host_route_not_allowed.
POST
/
workspaces
/
{workspaceID}
/
preview-auth
Create an authenticated preview
curl --request POST \
--url https://api.runaether.dev/workspaces/{workspaceID}/preview-auth \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"port": 32768,
"sibling_ports": [
32768
]
}
'import requests
url = "https://api.runaether.dev/workspaces/{workspaceID}/preview-auth"
payload = {
"port": 32768,
"sibling_ports": [32768]
}
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({port: 32768, sibling_ports: [32768]})
};
fetch('https://api.runaether.dev/workspaces/{workspaceID}/preview-auth', 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://api.runaether.dev/workspaces/{workspaceID}/preview-auth",
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([
'port' => 32768,
'sibling_ports' => [
32768
]
]),
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://api.runaether.dev/workspaces/{workspaceID}/preview-auth"
payload := strings.NewReader("{\n \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\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://api.runaether.dev/workspaces/{workspaceID}/preview-auth")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/workspaces/{workspaceID}/preview-auth")
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 \"port\": 32768,\n \"sibling_ports\": [\n 32768\n ]\n}"
response = http.request(request)
puts response.read_body{
"kind": "url",
"requires_client_application": true,
"local_storage": {},
"reload": true,
"url": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"stderr_tail": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Body
application/json