Skip to main content

Overview

Sandbox API prerequisites, endpoint assembly, authentication, available instance and template management APIs, and error responses.

Before calling, configure Authentication. For error handling, see Errors.
The Sandbox API is compatible with the E2B protocol and provides sandbox instance lifecycle management and template management. Control-plane requests are forwarded through the Bailian AI gateway.

Prerequisites

  1. Activate Bailian and create an API Key.
  2. Complete service authorization: first-time use of Sandbox requires SLR authorization. See Quick Start.
  3. Get your workspace ID: view it in the dropdown at the top-right of the Bailian console, in the form {workspace_id}.

Endpoint

The API base URL is assembled from the workspace and region:
https://{workspace_id}.{region}.maas.aliyuncs.com/api/v1/agentstudio/sandbox
  • workspace_id: workspace ID
  • region: region ID, currently only cn-beijing

Available APIs

Instance Management

CapabilityMethodPath
Create instancePOST/sandboxes
List instancesGET/v2/sandboxes
Get instanceGET/sandboxes/{sandboxID}
Connect to instancePOST/sandboxes/{sandboxID}/connect
Pause instancePOST/sandboxes/{sandboxID}/pause
Resume instancePOST/sandboxes/{sandboxID}/resume
Release instanceDELETE/sandboxes/{sandboxID}

Template Management

CapabilityMethodPath
Create templatePOST/v3/templates
List templatesGET/v2/templates
Get templateGET/templates/{templateCode}
Update templatePUT/templates/{templateCode}
Get build statusGET/templates/{templateCode}/builds/{buildID}/status
Delete templateDELETE/templates/{templateCode}

E2B Official Reference

Sandbox currently exposes an E2B-compatible HTTP API. Each endpoint's method, path, and response structure stay close to the official E2B definitions. Except for the Update Template endpoint, which is a Bailian-specific protocol, the common fields and semantics of the other endpoints can be found in the official E2B API documentation:
This documentation lists only the endpoints and Bailian extension fields that Bailian supports. Bailian's authentication, endpoint, and extension configurations follow this documentation; common protocol fields can be cross-referenced with the official E2B docs.

SDK

In addition to calling the REST API directly, you can integrate via the official E2B SDK. See Manage and Use Instances.
Managed Agent API
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration