# Templates

Canonical: https://docs.bluehola.com/docs/templates-flows-media/templates
OpenAPI: https://docs.bluehola.com/openapi.yaml

# Templates

Template messages are the **only** message type available once the 24-hour customer service window has closed, so a template's review status directly determines whether it can be sent.

| Endpoint | Purpose |
| --- | --- |
| [List Templates](get-v1-templates.md) | The template list with the latest review status. |
| [Create Template](post-v1-templates.md) | Create a template and submit it for Meta review. |
| [Template Details](get-v1-templates-id.md) | A single template's structure and status. |
| [Edit Template](patch-v1-templates-id.md) | Change content or Max Price; content edits must be reviewed again. |
| [Delete Template](delete-v1-templates-id.md) | Delete a template. |
| [Sync Templates from Meta](post-v1-templates-sync.md) | Pull templates and review status from Meta, fixing any local drift. |
| [Upload Template Media Header](post-v1-templates-media.md) | Upload the media asset a template's header needs. |
| [Template Analytics](get-v1-templates-analytics.md) | A template's send and engagement data. |
| [Enable Template Analytics](post-v1-templates-analytics-enable.md) | A one-time confirmation to turn on template analytics for a WABA. |

:::info

When sending, the `parameters` inside `components` must match the placeholders declared when the template was created **exactly in count and order**, or Meta returns a parameter mismatch (`TEMPLATE_PARAM_MISMATCH`). The platform verifies the template is `APPROVED` before sending.

:::

## Max Price for marketing templates

Use the optional `optimizationSpec` on [Create Template](post-v1-templates.md) or [Edit Template](patch-v1-templates-id.md) to cap Meta's price per delivered marketing message. It is a **bid cap, not a campaign budget**: BlueMedia's rate-card, balance, credit-reservation and customer-budget rules remain unchanged.

Send with the existing `POST /v1/messages` or broadcast endpoints. A Max Price template requires the recipient phone number in `to`; it cannot be sent to a BSUID-only recipient. A broadcast containing any effective BSUID-only recipient is rejected at creation, including `dryRun`.

On `delivered` and `read` status webhooks, Max Price traffic uses `pricing.category: "marketing_lite_dynamic"` and may include `pricing.cost`. The cost is Meta's estimate in the currency's base unit; the Meta invoice is the source of truth for final charges. See [Webhook Integration](../guides/webhook-integration.md).

For the related failure codes (`TEMPLATE_NOT_FOUND` needs a sync first, `TEMPLATE_PAUSED` means paused for low quality, `TEMPLATE_DISABLED` means permanently disabled and a new one must be created), see [Error Codes](../guides/error-codes.md). This group of endpoints requires the `templates:manage` scope — see [Authentication & Scopes](../guides/authentication.md).
