Create a preview link
curl --request POST \
--url https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"port": 3000,
"ttlSeconds": 900
}
'import requests
url = "https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links"
payload = {
"port": 3000,
"ttlSeconds": 900
}
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({port: 3000, ttlSeconds: 900})
};
fetch('https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"url": "<string>",
"sandboxID": "<string>",
"port": 123,
"expiresAt": "2023-11-07T05:31:56Z"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}{
"code": 123,
"message": "<string>",
"error_code": "<string>"
}Sandbox access
Create a preview link
A signed link that opens one port of the sandbox in a browser until it
expires. The edge exchanges it for a cookie scoped to that port’s host.
Port 49983 (envd) cannot be shared. Needs sandboxes:use.
POST
/
v1
/
sandboxes
/
{sandboxID}
/
preview-links
Create a preview link
curl --request POST \
--url https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"port": 3000,
"ttlSeconds": 900
}
'import requests
url = "https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links"
payload = {
"port": 3000,
"ttlSeconds": 900
}
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({port: 3000, ttlSeconds: 900})
};
fetch('https://api.compute.anonalabs.com/v1/sandboxes/{sandboxID}/preview-links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"url": "<string>",
"sandboxID": "<string>",
"port": 123,
"expiresAt": "2023-11-07T05:31:56Z"
}{
"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