You need an API key to authenticate to the Agent Sandbox Flash Edition data plane. Before you connect through the E2B SDK, the E2B CLI, or direct Agent Sandbox Flash Edition data plane calls, we recommend that you first create an API key in the Agent Sandbox console and pass it to your local or runtime environment through environment variables.
Prerequisites
Before you create an API key, make sure that:
-
Function Compute is activated.
-
Agent Sandbox Flash Edition is activated.
-
Your Alibaba Cloud account or RAM user has permission to manage Agent Sandbox Flash Edition API keys.
Create an API Key
-
Go to the Agent Sandbox console. In the left-side navigation pane, choose Speed Edition > API Keys.
-
On the API key management page, click Create an API Key.
-
In the creation panel, enter a description and set an expiration time.
-
Description: identifies the purpose of the API key, such as development, production, a specific application, or a specific team. Use a traceable name instead of a generic value such as "test" or "default".
-
Expiration time: you can choose no expiration or a custom expiration time. For production, set an explicit expiration time and establish a rotation mechanism.
-
-
Click Create.
-
After the API key is created, copy the full API key and store it securely.
Important: Do not put API keys in code repositories, images, templates, logs, screenshots, support tickets, or frontend pages. If an API key is leaked, disable or reset it immediately.
Use in SDKs and the CLI
When you connect the E2B SDK to Agent Sandbox Flash Edition, you typically pass the API key, API URL, and domain through environment variables:
export E2B_API_KEY="<your-api-key>"
export E2B_API_URL="https://api.<region>.sandbox.aliyuncs.com"
export E2B_DOMAIN="<region>.sandbox.aliyuncs.com"
New E2B CLI versions authenticate with E2B_API_KEY. E2B_ACCESS_TOKEN is a deprecated legacy E2B authentication variable and should not be used in new integration flows. If an older CLI still asks for it, upgrade the CLI and retry.
The <region> value must match the region where Agent Sandbox Flash Edition is deployed. If the API key, API URL, domain, template, and sandbox do not belong to the same account or region, authentication, template discovery, sandbox creation, or connection can fail.
View and manage API keys
On the API Keys page, you can view the masked value, description, account ID, status, creation time, and expiration time of each API key, and filter keys by status or description keywords.
API keys support the following management operations:
-
Edit: update the description or expiration time, or enable or disable the API key.
-
Reset: generate a new API key value. After a reset, the old value stops working and applications that still use it will fail authentication.
-
Delete: disable the API key before you delete it. We recommend that after you disable the key, you observe for a period of time and confirm that no business still uses it before you delete it.
Security recommendations
-
Separate API keys by application, environment, team, or tenant. Do not share one long-lived key across multiple people or systems.
-
In production, prefer custom expiration times and rotate keys regularly.
-
Before you reset or delete a key, confirm that the business side has already switched to a new key.
-
If you suspect a leak, disable or reset the API key first, and then investigate the source of the leak.
-
If you need SDK configuration details, continue with Use Agent Sandbox Flash Edition with the SDK. For full connection parameters, see E2B SDK Connection Parameters.