Get up and running with the HopX API in minutes. This quickstart walks you through creating your first sandbox, executing code, and cleaning up.Documentation Index
Fetch the complete documentation index at: https://docs.hopx.ai/llms.txt
Use this file to discover all available pages before exploring further.
What You’ll Learn
In this quickstart, you’ll learn how to:- Authenticate with the HopX API using API keys
- Create sandboxes using the Control Plane API
- Execute code using the VM Agent API
- Handle API responses and extract results
- Delete sandboxes to free resources
- Use common API patterns and variations
Prerequisites
Before you begin, you’ll need:- An API key from console.hopx.dev
curlinstalled (or any HTTP client)- Basic familiarity with REST APIs
Step 1: Set Your API key
Set your API key as an environment variable:Replace
YOUR_KEY_ID and YOUR_SECRET with your actual API key from the dashboard.Step 2: Create a Sandbox
Create a sandbox from a pre-built template:id and auth_token from the response. You’ll need them for the next steps.
Step 3: Execute Code
Execute Python code in your sandbox using the VM Agent API:Step 4: Clean Up
Delete the sandbox when you’re done:What Just Happened?
- Created a sandbox - You spun up an isolated cloud environment from the
code-interpretertemplate - Executed code - You ran Python code in the sandbox and received the output
- Cleaned up - You deleted the sandbox to free resources
Related
- Python SDK Quickstart - Get started with the Python SDK
- JavaScript SDK Quickstart - Get started with the JavaScript SDK
- Creating Sandboxes - Learn more about sandbox creation
- Code Execution - Understand code execution concepts
- CLI Reference - Command-line interface
Next Steps
- Control Plane API - Learn about all sandbox management endpoints
- VM Agent API - Explore code execution, file operations, and more
- Authentication - Deep dive into API key management and security
- SDK Quickstart - Use the Python or JavaScript SDK for easier integration
Common Variations
Create Sandbox with Environment Variables
Execute JavaScript Code
List All Sandboxes
Troubleshooting
Error: 401 Unauthorized
Your API key is missing or invalid. Verify:- The
HOPX_API_KEYenvironment variable is set correctly - You’re using the
Authorization: Bearerheader format - Your API key hasn’t been revoked in the dashboard
Error: 404 Template Not Found
The template ID doesn’t exist. Try:- Listing available templates:
GET /v1/templates - Using a template name instead:
"template_name": "code-interpreter"

