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

# Templates

> Pre-built training packages for common use cases

Templates are pre-built training packages that bundle workflows for common use cases. Instead of building training from scratch, apply a template to get a working agent quickly—then customize from there.

**Use templates for:**

* Getting started quickly with a new bot
* Replicating training across multiple locations
* Applying best-practice workflows without building them manually

## Listing Templates

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch("https://api.helloannie.com/v1/templates", {
    headers: { "Authorization": "Bearer YOUR_API_KEY" }
  })

  const { data } = await response.json()
  // data.templates contains an array of available templates
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.helloannie.com/v1/templates",
      headers={"Authorization": "Bearer YOUR_API_KEY"}
  )

  data = response.json()["data"]
  # data["templates"] contains an array of available templates
  ```

  ```bash cURL theme={null}
  curl https://api.helloannie.com/v1/templates \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</CodeGroup>

## Applying a Template

Templates may contain variables (placeholders) that must be filled in when applying. Check the template's `variables` array to see what values are required.

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.helloannie.com/v1/templates/TEMPLATE_ID/apply",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        botId: "YOUR_BOT_ID",
        variables: {
          "office_name": "Downtown Dental",
          "office_phone": "+15551234567"
        }
      })
    }
  )

  const { data } = await response.json()
  // data.workflowId contains the created workflow ID
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.helloannie.com/v1/templates/TEMPLATE_ID/apply",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "botId": "YOUR_BOT_ID",
          "variables": {
              "office_name": "Downtown Dental",
              "office_phone": "+15551234567"
          }
      }
  )

  data = response.json()["data"]
  # data["workflowId"] contains the created workflow ID
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.helloannie.com/v1/templates/TEMPLATE_ID/apply \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "botId": "YOUR_BOT_ID",
      "variables": {
        "office_name": "Downtown Dental",
        "office_phone": "+15551234567"
      }
    }'
  ```
</CodeGroup>

<Info>
  The `variables` field is required, even if the template has no variables. Pass an empty object `{}` if the template doesn't require any variables.

  More documentation on template variables is coming soon.
</Info>

## Batch Applying Templates

Apply multiple templates to a bot in a single operation. Each template requires its own `variables` object:

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.helloannie.com/v1/templates/batch/apply",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        botId: "YOUR_BOT_ID",
        templates: [
          {
            templateId: "TEMPLATE_1_ID",
            variables: { "office_name": "Downtown Dental" }
          },
          {
            templateId: "TEMPLATE_2_ID",
            variables: {}
          }
        ]
      })
    }
  )

  const { data } = await response.json()
  // data.jobId can be used to track progress
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.helloannie.com/v1/templates/batch/apply",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "botId": "YOUR_BOT_ID",
          "templates": [
              {"templateId": "TEMPLATE_1_ID", "variables": {"office_name": "Downtown Dental"}},
              {"templateId": "TEMPLATE_2_ID", "variables": {}}
          ]
      }
  )

  data = response.json()["data"]
  # data["jobId"] can be used to track progress
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.helloannie.com/v1/templates/batch/apply \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "botId": "YOUR_BOT_ID",
      "templates": [
        { "templateId": "TEMPLATE_1_ID", "variables": { "office_name": "Downtown Dental" } },
        { "templateId": "TEMPLATE_2_ID", "variables": {} }
      ]
    }'
  ```
</CodeGroup>

***

<Card title="Templates API" icon="code" href="/api-reference/templates/list-templates">
  See the full API reference for template endpoints.
</Card>
