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

# List templates

> List all templates available in your workspace

Returns every template in the workspace the API key belongs to. Use this to discover `template_id` values before calling the generate or schema endpoints.

Serves both kinds of template. Without `type` you get video templates, exactly as before; pass `type=IMAGE_TEMPLATE` to list image templates instead.

<ParamField header="Authorization" type="string" required>
  `Bearer {api_key}`
</ParamField>

<ParamField query="type" type="string" default="TEMPLATE">
  `TEMPLATE` for video templates, `IMAGE_TEMPLATE` for image templates. Any other value is a `400`. One call returns one kind — there is no "all templates" response, since the two carry different fields.
</ParamField>

<ParamField query="page" type="integer" default="1" />

<ParamField query="page_size" type="integer" default="30">
  Capped at 100.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://dev-backend-ai.truefans.in/api/external/v1/templates/?page=1&page_size=30" \
    -H "Authorization: Bearer $TRUEFAN_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "templates": [
      {
        "template_id": "7a4facd6-136f-4d8a-8db6-0eb3b3e7086f",
        "name": "Customer shoutout",
        "aspect_ratio": "16:9",
        "scene_count": 2,
        "thumbnail_url": "https://assets-studio.truefans.in/editor/.../thumb.jpg",
        "estimated_credits": "0.68",
        "sample_csv_url": "https://assets-studio.truefans.in/editor/.../sample.csv",
        "created": "2026-08-01T10:00:00Z",
        "modified": "2026-08-15T14:30:00Z"
      }
    ],
    "pagination": { "page": 1, "page_size": 30, "total": 1, "total_pages": 1 }
  }
  ```

  ```json 200 OK — ?type=IMAGE_TEMPLATE theme={null}
  {
    "type": "IMAGE_TEMPLATE",
    "templates": [
      {
        "template_id": "b81c04ff-2a7e-4c19-9f0d-5c2a1e3d7b44",
        "name": "Diwali greeting card",
        "aspect_ratio": "1:1",
        "thumbnail_url": "https://assets-studio.truefans.in/editor/.../thumb.png",
        "sample_csv_url": "https://assets-studio.truefans.in/editor/.../sample.csv",
        "created": "2026-08-01T10:00:00Z",
        "modified": "2026-08-15T14:30:00Z"
      }
    ],
    "pagination": { "page": 1, "page_size": 30, "total": 1, "total_pages": 1 }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": "type must be one of TEMPLATE or IMAGE_TEMPLATE",
    "allowed": ["IMAGE_TEMPLATE", "TEMPLATE"]
  }
  ```

  ```json 401 Unauthorized theme={null}
  { "error": "API key required" }
  ```
</ResponseExample>

## Response fields

<ResponseField name="template_id" type="string">Reference this in every generate/schema call for the template.</ResponseField>

<ResponseField name="type" type="string">
  Echoes back which kind this response contains — `TEMPLATE` or `IMAGE_TEMPLATE`.
</ResponseField>

<ResponseField name="estimated_credits" type="string">
  What a single generation against this template costs. **Video templates only** — an image template has no stored per-render cost, so the field is absent there. See [Get template schema](/docs/api-reference/templates/get-template-schema)'s `credits_per_row` instead.
</ResponseField>

<ResponseField name="sample_csv_url" type="string | null">
  A downloadable example — `null` if the template has no variables. Prefer [Get template schema](/docs/api-reference/templates/get-template-schema) for building an actual request; this is a convenience export only.
</ResponseField>

<Tip>
  For the exact variable names and an example request body, call [Get template schema](/docs/api-reference/templates/get-template-schema) with the `template_id` from this response — passing the same `type` you used here.
</Tip>

<Note>
  An image template response omits `scene_count` and `estimated_credits` — it is built from layers rather than scenes, and its cost depends on its variable count rather than being fixed per render. Those keys are absent, not `null`.
</Note>
