> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hopx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Templates

> Complete guide to HopX templates - listing, viewing, building, and configuring templates for sandbox creation. Templates define the base environment for HopX sandboxes. Learn how to list pre-built templates, view template details, build custom templates from Docker images, configure resources, and optimize with caching strategies.

Templates define the base environment for HopX sandboxes. This hub covers all template operations, from listing pre-built templates to building custom templates with Docker images.

## Related

* [CLI Template Commands](/cli/commands/template) - Template management from CLI

## What You'll Learn

* How to list and view available templates
* How to get detailed template information
* How to build custom templates from Docker images
* How to configure template resources and settings
* How to cache and optimize templates

## Template Management Overview

| Operation                                                       | SDK Method                    | API Endpoint               |
| --------------------------------------------------------------- | ----------------------------- | -------------------------- |
| **[Listing](/core-concepts/templates/listing)**                 | `Sandbox.list_templates()`    | `GET /v1/templates`        |
| **[Getting Details](/core-concepts/templates/getting-details)** | `Sandbox.get_template()`      | `GET /v1/templates/:name`  |
| **[Building](/core-concepts/templates/building)**               | `TemplateBuilder`             | `POST /v1/templates/build` |
| **[Configuration](/core-concepts/templates/configuration)**     | `TemplateBuilder.configure()` | Template configuration     |
| **[Caching](/core-concepts/templates/caching)**                 | Template caching              | Cache management           |

## Core Concepts

### Listing Templates

Discover available pre-built and custom templates.

* **[Listing Templates](/core-concepts/templates/listing)** - List available templates
* **SDK**: [Python: Sandbox.list\_templates()](/sdk/python/sandbox#list_templates) | [JavaScript: Sandbox.listTemplates()](/sdk/javascript/sandbox#listtemplates)
* **API**: [GET /v1/templates](/api/control-plane/list-templates)

### Getting Template Details

View detailed information about specific templates.

* **[Getting Template Details](/core-concepts/templates/getting-details)** - View template information
* **SDK**: [Python: Sandbox.get\_template()](/sdk/python/sandbox#get_template) | [JavaScript: Sandbox.getTemplate()](/sdk/javascript/sandbox#gettemplate)
* **API**: [GET /v1/templates/:name](/api/control-plane/get-template)

### Building Templates

Create custom templates from Docker images and build steps.

* **[Building Templates](/core-concepts/templates/building)** - Build custom templates
* **SDK**: [Python: TemplateBuilder](/sdk/python/template-builder) | [JavaScript: TemplateBuilder](/sdk/javascript/template-builder)
* **API**: [POST /v1/templates/build](/api/control-plane/build-template)

### Template Configuration

Configure template resources, environment, and build steps.

* **[Template Configuration](/core-concepts/templates/configuration)** - Configure templates
* **SDK**: [Python: TemplateBuilder.configure()](/sdk/python/template-builder#configure) | [JavaScript: TemplateBuilder.configure()](/sdk/javascript/template-builder#configure)
* **API**: Template configuration in build endpoint

### Template Caching

Optimize template loading with caching strategies.

* **[Template Caching](/core-concepts/templates/caching)** - Cache templates for faster creation
* **SDK**: Template caching options | **API**: Cache management endpoints

## SDK Reference

### Python SDK

Complete reference for Python template operations.

* **[Sandbox.list\_templates()](/sdk/python/sandbox#list_templates)** - List templates
* **[Sandbox.get\_template()](/sdk/python/sandbox#get_template)** - Get template details
* **[TemplateBuilder](/sdk/python/template-builder)** - Build custom templates
  * `from_image()` - Create from Docker image
  * `configure()` - Configure resources
  * `build()` - Build template

### JavaScript SDK

Complete reference for JavaScript/TypeScript template operations.

* **[Sandbox.listTemplates()](/sdk/javascript/sandbox#listtemplates)** - List templates
* **[Sandbox.getTemplate()](/sdk/javascript/sandbox#gettemplate)** - Get template details
* **[TemplateBuilder](/sdk/javascript/template-builder)** - Build custom templates
  * `fromImage()` - Create from Docker image
  * `configure()` - Configure resources
  * `build()` - Build template

## API Reference

### Control Plane API

REST API endpoints for template operations.

* **[Control Plane API Overview](/api/control-plane/overview)** - API overview
* **[List Templates](/api/control-plane/list-templates)** - `GET /v1/templates` - List all templates
* **[Get Template](/api/control-plane/get-template)** - `GET /v1/templates/:name` - Get template details
* **[Build Template](/api/control-plane/build-template)** - `POST /v1/templates/build` - Build custom template

## Quick Start

If you're new to templates, start here:

1. **[Listing Templates](/core-concepts/templates/listing)** - Discover available templates
2. **[Getting Template Details](/core-concepts/templates/getting-details)** - View template information
3. **[Building Templates](/core-concepts/templates/building)** - Create your first custom template

## Related Topics

* **[Sandboxes](/core-concepts/sandboxes/creating)** - Create sandboxes from templates
* **[Code Execution](/core-concepts/code-execution/synchronous)** - Execute code in template environments
* **[Environment Variables](/core-concepts/environment/getting)** - Configure template environments
* **[File Operations](/core-concepts/filesystem/reading)** - Work with files in template-based sandboxes

## Next Steps

* Learn about [Creating Sandboxes](/core-concepts/sandboxes/creating) from templates
* Explore [Building Templates](/core-concepts/templates/building) for custom environments
* Review [Template Configuration](/core-concepts/templates/configuration) for advanced setup
* Check out [Template Caching](/core-concepts/templates/caching) for optimization
