Everstack
API ReferenceSandboxExpose Port

Port Exposure

POST/v1/sandbox/{sessionId}/ports
POST/v1/sandbox/{'{sessionId}'}/ports

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Parameters

NameInTypeRequiredDescription
sessionIdpathstringYes

Request Body

PropertyTypeRequiredDescription
tenantIdstringNo
portintegerNo
protocolstringNo

Responses

200 Expose a sandbox port via subdomain

PropertyTypeDescription
mappingobject

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

Request

curl -X POST "https://{instance}.{region}.everstack.ai/v1/sandbox/{sessionId}/ports" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenantId":"string","port":0,"protocol":"string"}'
const response = await fetch("https://{instance}.{region}.everstack.ai/v1/sandbox/{sessionId}/ports", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "tenantId": "string",
  "port": 0,
  "protocol": "string"
}),
});
const data = await response.json();
import requests

response = requests.post(
    "https://{instance}.{region}.everstack.ai/v1/sandbox/{sessionId}/ports",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
  "tenantId": "string",
  "port": 0,
  "protocol": "string"
},
)
data = response.json()

Response

{
  "mapping": {
    "id": "string",
    "sandboxId": "string",
    "port": 0,
    "protocol": "string",
    "subdomain": "string",
    "url": "string",
    "status": "string",
    "createdAt": "2024-01-01T00:00:00Z"
  }
}
{
  "code": 0,
  "message": "string",
  "details": [
    {
      "@type": "string"
    }
  ]
}