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

# List Template

You can list the sandbox templates available to you either from the CLI or programmatically through the SDK. The SDK returns each template's ID, aliases or names, resource sizing, visibility, and build metadata.

## Examples

<CodeGroup>
  ```bash CLI icon="terminal" theme={"system"}
  # Pretty table (default); alias: template ls
  novita-sandbox-cli template list

  # JSON output
  novita-sandbox-cli template list --format json

  # Scope to a team
  novita-sandbox-cli template list --team <teamID>
  ```

  ```js JavaScript & TypeScript icon="js" theme={"system"}
  import { Novita } from 'novita-sandbox'

  const novita = new Novita()
  const paginator = novita.template.list({
    templateType: 'template_build', // or 'snapshot_template'
    page: 1,
    limit: 20,
  })

  const page = await paginator.nextPage()
  console.log(`total: ${page.total}, pages: ${page.totalPages}`)
  for (const t of page.templates) {
    console.log(t.templateId, t.aliases, t.cpuCount, t.memoryMB, t.public)
  }
  ```

  ```python Python icon="python" theme={"system"}
  from novita_sandbox import Novita

  novita = Novita()
  res = novita.template.list(
      template_type="template_build",  # or "snapshot_template"
      page=1,
      limit=20,
  )

  print(f"total: {res.total}, pages: {res.total_pages}")
  for t in res.items:
      print(t.template_id, t.aliases, t.cpu_count, t.memory_mb, t.public)
  ```
</CodeGroup>

## Response

The response is paginated. The top-level fields are:

| Field        | Type            | Description                |
| ------------ | --------------- | -------------------------- |
| `templates`  | TemplateInfo\[] | The templates on this page |
| `total`      | number          | Total number of templates  |
| `page`       | number          | Current page number        |
| `limit`      | number          | Items per page             |
| `totalPages` | number          | Total number of pages      |

Each entry in `templates` includes:

| Field (JS / Python)                 | Type           | Description                     |
| ----------------------------------- | -------------- | ------------------------------- |
| `templateId` / `template_id`        | string         | Template ID                     |
| `aliases` / `names`                 | string\[]      | Template aliases / names        |
| `cpuCount` / `cpu_count`            | number         | vCPU count                      |
| `memoryMB` / `memory_mb`            | number         | Memory in MiB                   |
| `diskSizeMB` / `disk_size_mb`       | number         | Disk size in MiB                |
| `envdVersion` / `envd_version`      | string         | Envd version                    |
| `public`                            | boolean        | Whether the template is public  |
| `buildId` / `build_id`              | string         | Latest build ID                 |
| `buildCount` / `build_count`        | number         | Number of builds                |
| `createdAt` / `created_at`          | Date           | Creation time                   |
| `updatedAt` / `updated_at`          | Date           | Last update time                |
| `lastSpawnedAt` / `last_spawned_at` | Date \| null   | Last time a sandbox was spawned |
| `createdBy` / `created_by`          | object \| null | Creator (`id`, `email`)         |
