Skip to main content
List all available templates that can be used to create sandboxes.

Endpoint

GET /v1/templates

Request

Headers

X-API-Key: your_api_key_here

Query Parameters

ParameterTypeDescription
categorystringFilter by category
languagestringFilter by language

Response

Success (200 OK)

{
  "data": [
    {
      "id": "52",
      "name": "code-interpreter",
      "display_name": "Code Interpreter",
      "description": "Python environment with data science libraries",
      "category": "development",
      "language": "python",
      "default_resources": {
        "vcpu": 2,
        "memory_mb": 2048,
        "disk_gb": 10
      }
    }
  ]
}

Examples

cURL

# List all templates
curl -H "X-API-Key: your_api_key_here" \
     https://api.hopx.dev/v1/templates

# Filter by category
curl -H "X-API-Key: your_api_key_here" \
     "https://api.hopx.dev/v1/templates?category=development"

# Filter by language
curl -H "X-API-Key: your_api_key_here" \
     "https://api.hopx.dev/v1/templates?language=python"

Python

import os
import requests

api_key = os.environ.get("HOPX_API_KEY")

headers = {
    "X-API-Key": api_key
}

# List all templates
response = requests.get(
    "https://api.hopx.dev/v1/templates",
    headers=headers
)

if response.status_code == 200:
    data = response.json()
    templates = data["data"]
    for template in templates:
        print(f"{template['name']}: {template['display_name']}")

# Filter by category
params = {"category": "development"}
response = requests.get(
    "https://api.hopx.dev/v1/templates",
    headers=headers,
    params=params
)

# Filter by language
params = {"language": "python"}
response = requests.get(
    "https://api.hopx.dev/v1/templates",
    headers=headers,
    params=params
)

JavaScript

const apiKey = process.env.HOPX_API_KEY;

// List all templates
const response = await fetch('https://api.hopx.dev/v1/templates', {
  headers: {
    'X-API-Key': apiKey
  }
});

if (response.ok) {
  const data = await response.json();
  data.data.forEach(template => {
    console.log(`${template.name}: ${template.display_name}`);
  });
}

// Filter by category
const categoryParams = new URLSearchParams({ category: 'development' });
const categoryResponse = await fetch(
  `https://api.hopx.dev/v1/templates?${categoryParams}`,
  {
    headers: {
      'X-API-Key': apiKey
    }
  }
);

// Filter by language
const languageParams = new URLSearchParams({ language: 'python' });
const languageResponse = await fetch(
  `https://api.hopx.dev/v1/templates?${languageParams}`,
  {
    headers: {
      'X-API-Key': apiKey
    }
  }
);