Endpoint
Request
Headers
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string or integer | Yes* | Template ID to use |
template_name | string | Yes* | Template name (alternative to template_id) |
region | string | No | Preferred region (e.g., us-east, eu-west) |
timeout_seconds | integer | No | Auto-kill timeout in seconds |
internet_access | boolean | No | Enable internet access (default: true) |
env_vars | object | No | Environment variables to set in sandbox |
Either
template_id or template_name must be provided. Resources (vcpu, memory, disk) are always loaded from the template - you cannot specify custom resources.Example Request
Replace
$HOPX_API_KEY with your actual API key from console.hopx.dev, or set it as an environment variable: export HOPX_API_KEY="your-API key-here"Replace
$HOPX_API_KEY with your actual API key from console.hopx.dev, or set it as an environment variable: export HOPX_API_KEY="your-API key-here"Response
Success (201 Created)
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Sandbox ID (use for all subsequent operations) |
status | string | Current sandbox status (creating, running, etc.) |
public_host | string | VM Agent API base URL for this sandbox |
direct_url | string | Alternative VM Agent API URL (same as public_host) |
template_id | string | Template ID used to create sandbox |
template_name | string | Template name |
resources | object | Allocated resources (from template) |
auth_token | string | JWT token for VM Agent API authentication |
token_expires_at | string | ISO 8601 timestamp when token expires |
Status Codes
| Code | Description |
|---|---|
201 | Sandbox created successfully |
400 | Invalid request (missing template, invalid timeout, etc.) |
401 | Authentication required |
402 | Payment required (insufficient balance) |
404 | Template not found |
503 | Service unavailable (no available nodes) |
Errors
Template Not Found (404)
template_id or template_name doesn’t exist.
Fix: List available templates using GET /v1/templates to find valid template IDs or names.
Invalid Request (400)
timeout_secondsmust be positive- Either
template_idortemplate_namemust be provided env_varsmust be a valid object
Service Unavailable (503)
Use Cases
Quick Code Execution
Create a sandbox for quick code execution:Long-Running Job
Create a sandbox for a long-running task:Region-Specific Deployment
Create a sandbox in a specific region:Related
- SDK: Sandbox.create() - Python SDK method
- Get Sandbox - Retrieve sandbox information
- List Sandboxes - Query all your sandboxes
- VM Agent API - Execute code in your new sandbox
- CLI Sandbox Commands - Manage sandboxes from CLI
Next Steps
- Get Sandbox - Retrieve sandbox information
- List Sandboxes - Query all your sandboxes
- VM Agent API - Execute code in your new sandbox

