Service address, protocol conventions, and endpoint list of the Sandbox API, which is E2B-compatible and forwarded through the Bailian AI gateway.
Before calling, configure Authentication. For error handling, see Error Codes.
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} |
To create or update a template, upload the file for
mntConfig as described in File upload, and pass source=sandbox_template, then wait for status to become available.File upload
Files for mounting must be uploaded through the file upload API with source=sandbox_template.
Endpoint
Multipart form upload
Pre-signed URL upload
Use this option for large files or direct-to-OSS uploads.
- Request an upload URL.
-
PUT the file content to
upload_urlin the response. Do not set an additionalContent-Typeheader; otherwise the request may fail with403 SignatureDoesNotMatch. -
Call
POST /api/v1/agentstudio/files/{file_id}/completeto complete the upload. -
Poll
GET /api/v1/agentstudio/files/{file_id}untilstatusbecomesavailable.
Limits
| Dimension | Limit |
|---|---|
| File size | 50 MB |
| Total workspace file storage | 100 GB |
| Retention | 30 days |
.yaml is accepted; .csv, .yml, .sh, .whl, and .tar.gz are not supported; .ts returns a video-format error. The full supported range is determined by the service.
Only files with
source=sandbox_template and status=available can be added to mntConfig. For file error codes, see Errors.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.