Skip to main content
Get detailed information about a specific template, including its default resources and configuration.

Endpoint

GET /v1/templates/{template_id}

Request

Headers

X-API-Key: your_api_key_here

Path Parameters

ParameterTypeDescription
template_idstringThe ID or name of the template

Response

Success (200 OK)

{
  "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
  }
}

Error Responses

404 Not Found:
{
  "error": "Template not found",
  "code": "NOT_FOUND"
}

Examples

cURL

# By ID
curl -H "X-API-Key: your_api_key_here" \
     https://api.hopx.dev/v1/templates/52

# By name
curl -H "X-API-Key: your_api_key_here" \
     https://api.hopx.dev/v1/templates/code-interpreter

Python

import os
import requests

api_key = os.environ.get("HOPX_API_KEY")
template_id = "code-interpreter"  # or "52"

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

response = requests.get(
    f"https://api.hopx.dev/v1/templates/{template_id}",
    headers=headers
)

if response.status_code == 200:
    template = response.json()
    print(f"Template: {template['display_name']}")
    print(f"Description: {template['description']}")
    print(f"Default Resources: {template['default_resources']}")
else:
    print(f"Error: {response.status_code}")
    print(response.json())

JavaScript

const apiKey = process.env.HOPX_API_KEY;
const templateId = 'code-interpreter'; // or '52'

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

if (response.ok) {
  const template = await response.json();
  console.log(`Template: ${template.display_name}`);
  console.log(`Description: ${template.description}`);
  console.log(`Default Resources:`, template.default_resources);
} else {
  const error = await response.json();
  console.error('Error:', error);
}