Skip to main content
Create a new sandbox from a template. The sandbox will be provisioned with resources (vCPU, memory, disk) defined by the template.

Endpoint

Request

Headers

Body Parameters

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"
Or using template name:
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

Status Codes

Errors

Template Not Found (404)

Cause: The specified 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)

Cause: Invalid parameter value (e.g., negative timeout, missing template). Fix: Verify all parameters meet requirements:
  • timeout_seconds must be positive
  • Either template_id or template_name must be provided
  • env_vars must be a valid object

Service Unavailable (503)

Cause: No compute nodes are available to provision the sandbox. Fix: Retry the request after a few moments. This is usually temporary.

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:

Next Steps