Quickstart
Create your first cloud sandbox in under a minute
Prerequisites
- A GitHub account
- A GitHub personal access token (or use the device flow)
All API requests use a GitHub token (starts with ghp_). Do not use Claude API keys (sk-ant-...), Anthropic OAuth tokens, or other non-GitHub tokens.
1. Get a GitHub token
Install the GitHub CLI and authenticate:
# Install gh (macOS)
brew install gh
# Login via browser
gh auth login
# Get your token
export GITHUB_TOKEN=$(gh auth token)This opens a browser for OAuth login and stores credentials locally. gh auth token prints the token for use with the API.
2. Create a sandbox
curl -X POST https://api.yolocode.ai/api/e2b-sandboxes \
-H "Authorization: Bearer <your_github_token_ghp_...>" \
-H "Content-Type: application/json" \
-d '{
"name": "my-first-sandbox",
"taskDescription": "Set up a Next.js project",
"gitHubRepo": "your-username/your-repo",
"githubToken": "<your_github_token_ghp_...>"
}'The response includes your sandbox details:
{
"id": "sandbox-abc123",
"name": "my-first-sandbox",
"displayName": "nextjs-setup",
"status": "running",
"host": "sandbox-abc123.e2b.dev",
"websshHost": "sandbox-abc123-8888.e2b.dev",
"claudeHost": "sandbox-abc123-9999.e2b.dev"
}3. Run a command
curl -X POST https://api.yolocode.ai/api/e2b-sandboxes/<sandbox_id>/exec \
-H "Authorization: Bearer <your_github_token_ghp_...>" \
-H "Content-Type: application/json" \
-d '{"command": "ls -la"}'4. Chat with Claude
curl -X POST https://api.yolocode.ai/api/e2b-sandboxes/<sandbox_id>/chat \
-H "Authorization: Bearer <your_github_token_ghp_...>" \
-H "Content-Type: application/json" \
-d '{"message": "What files are in this project?"}'This returns a Server-Sent Events stream with Claude's response.