Mint a viewer token
curl --request POST \
--url https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"scope": "view",
"channels": [
"dom"
],
"ttlSeconds": 600
}
'import requests
url = "https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens"
payload = {
"scope": "view",
"channels": ["dom"],
"ttlSeconds": 600
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({scope: 'view', channels: ['dom'], ttlSeconds: 600})
};
fetch('https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"embedUrl": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}Live view
Mint a viewer token
Mints a short-lived, signed viewer token for one sandbox and returns the
embed URL that opens the live view with it. The token travels in the URL
fragment (#t=...), which browsers never send to a server.
control scope needs an API key, or a dashboard role of member or above.
The key needs the sandboxes:use scope and, if it is limited to a list of
sandboxes, this sandbox must be on it.
POST
/
v1
/
sandboxes
/
{sandboxID}
/
viewer-tokens
Mint a viewer token
curl --request POST \
--url https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"scope": "view",
"channels": [
"dom"
],
"ttlSeconds": 600
}
'import requests
url = "https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens"
payload = {
"scope": "view",
"channels": ["dom"],
"ttlSeconds": 600
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({scope: 'view', channels: ['dom'], ttlSeconds: 600})
};
fetch('https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/viewer-tokens', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"embedUrl": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}Authorizations
ApiKeyAuthBearerAuth
An Anona Compute API key (e2b_ followed by lowercase hex).
Path Parameters
Body
application/json
view watches; control also sends input (terminal keystrokes, desktop mouse and keyboard).
Available options:
view, control What the token opens. The first channel picks the embed view (pty opens the terminal view).
Available options:
dom, pty, desktop, thumb, ssh Required range:
30 <= x <= 600