Endpoint
Copy
GET /v1/templates
Request
Headers
Copy
X-API-Key: your_api_key_here
Query Parameters
| Parameter | Type | Description |
|---|---|---|
category | string | Filter by category |
language | string | Filter by language |
Response
Success (200 OK)
Copy
{
"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
Copy
# 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
Copy
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
Copy
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
}
}
);
Related
- Get Template - Get details of a specific template
- Create Sandbox - Create a sandbox from a template

