Get sandbox

Updated at:

Retrieve the details of a specific instance, including resource specifications, data-plane access information, and network and lifecycle configuration. Compatible with the E2B get-sandbox protocol and corresponds to get_info() in the SDK.

Prerequisites

Configure the endpoint and authentication first. See API overview and authentication.

Endpoint

GET/sandboxes/{sandboxID}

Retrieve the details of a specific instance. Compatible with the E2B get-sandbox protocol and corresponds to get_info() in the SDK. Returns 404 if the instance does not exist, with the message 沙箱实例不存在 (the sandbox instance does not exist). If no network or lifecycle configuration exists, the corresponding field is omitted or returned as an empty object.

Path parameters

sandboxIDstringRequired

Unique instance ID.

Response fields

sandboxIDstring

Unique instance ID.

bailianSandboxIdstring

Alibaba Cloud Model Studio extension identifier. Usually not needed by developers.

templateIDstring

Template ID.

statestring

Instance state, for example running.

cpuCountinteger

Number of vCPUs.

memoryMBinteger

Memory size in MB.

envdVersionstring

envd version.

domainstring

Data-plane access domain.

envdAccessTokenstring

envd access token.

trafficAccessTokenstring

Traffic access token.

envdUrlstring

envd access URL.

allowInternetAccessboolean

Whether the instance can access the internet.

networkobject

Instance-level network configuration. Sub-fields: allowPublicTraffic (boolean, whether public traffic is allowed), allowOut (array<string>, egress allowlist), denyOut (array<string>, egress denylist). Omitted or returned as an empty object when no network configuration exists.

lifecycleobject

Lifecycle configuration. Sub-fields: onTimeout (string, behavior on expiry, for example pause), autoResume (boolean, whether connecting to a paused instance resumes it automatically). Omitted or returned as an empty object when no lifecycle configuration exists.

Request example

curl -X GET "$BASE_URL/sandboxes/sbx-xxx" \
  -H "Authorization: Bearer $BAILIAN_API_KEY"

BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandbox, and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.

Response example

{
  "sandboxID": "sbx-xxx",
  "bailianSandboxId": "your-bailian-sandbox-id",
  "templateID": "your-template-id",
  "state": "running",
  "cpuCount": 1,
  "memoryMB": 2048,
  "envdVersion": "your-envd-version",
  "domain": "your-sandbox-domain",
  "envdAccessToken": "your-envd-access-token",
  "trafficAccessToken": "your-traffic-access-token",
  "envdUrl": "your-envd-url",
  "allowInternetAccess": true,
  "network": {
    "allowPublicTraffic": true,
    "allowOut": ["example.com"],
    "denyOut": ["10.0.0.0/8"]
  },
  "lifecycle": {
    "onTimeout": "pause",
    "autoResume": true
  }
}