Sandbox API prerequisites, endpoint assembly, authentication, available instance and template management APIs, and error responses.
Before calling, configure Authentication. For error handling, see Errors.
Prerequisites
- Activate Bailian and create an API Key.
- Complete service authorization: first-time use of Sandbox requires SLR authorization. See Quick Start.
- 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:
workspace_id: workspace IDregion: region ID, currently onlycn-beijing
Available APIs
Instance Management
| Capability | Method | Path |
|---|---|---|
| Create instance | POST | /sandboxes |
| List instances | GET | /v2/sandboxes |
| Get instance | GET | /sandboxes/{sandboxID} |
| Connect to instance | POST | /sandboxes/{sandboxID}/connect |
| Pause instance | POST | /sandboxes/{sandboxID}/pause |
| Resume instance | POST | /sandboxes/{sandboxID}/resume |
| Release instance | DELETE | /sandboxes/{sandboxID} |
Template Management
| Capability | Method | Path |
|---|---|---|
| Create template | POST | /v3/templates |
| List templates | GET | /v2/templates |
| Get template | GET | /templates/{templateCode} |
| Update template | PUT | /templates/{templateCode} |
| Get build status | GET | /templates/{templateCode}/builds/{buildID}/status |
| Delete template | DELETE | /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.