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

# Preview Template Version

> Requires `notification-template:find-one`. Renders the version in
every language it has (or only `locales`) with a sample payload
generated from the event payload schema, merged with `payload`.
`draft` renders unsaved halves instead of the stored ones. Answers
one `{ language, content, errors }` per language; a language that
does not render has empty `content` and its errors by field. The
body may be empty.




## OpenAPI

````yaml api-reference/notification/template-version/openapi.yaml POST /notification/template/{document_id}/version/{version}/preview
openapi: 3.0.1
info:
  title: Notification Template Version API
  description: |
    Versions of an event template (notification/notification-platform,
    ADR 0129): open a draft, save it, preview it, test-send it to yourself,
    publish it, compare versions and roll back, plus the channel contract
    the template editor builds its form from.

    **Halves.** A version has a `base` half shared by every language
    (layout, links, push `action`, ...) and a text half per language in
    `translations` (`es`, `en`, `pt`, `fr`, `it`). The fields of each half
    come from `GET /notification/channel/{channel}/contract`. A template has
    at most one draft; the published version keeps serving sends while the
    draft is edited. Publishing archives the previous version.

    **Errors.** Version writes answer `404 template-not-found` or `404
    version-not-found`, and `409 version-not-draft` when the version is not
    a draft. `422` carries one `{ code, field, language?, position?,
    message }` per problem in `error.errors`.
  version: '2026-11-03'
servers:
  - description: Production
    url: https://api.bbrands.io/api/v3
  - description: Certification
    url: https://certification.api.bbrands.io/api/v3
  - description: Development
    url: https://development.api.bbrands.io/api/v3
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Notification Template Version
    description: Drafts, publication, preview, test sends and diffs of a template.
  - name: Notification Channel Contract
    description: JSON Schema of the template halves of a channel.
paths:
  /notification/template/{document_id}/version/{version}/preview:
    post:
      tags:
        - Notification Template Version
      summary: Preview a template version
      description: |
        Requires `notification-template:find-one`. Renders the version in
        every language it has (or only `locales`) with a sample payload
        generated from the event payload schema, merged with `payload`.
        `draft` renders unsaved halves instead of the stored ones. Answers
        one `{ language, content, errors }` per language; a language that
        does not render has empty `content` and its errors by field. The
        body may be empty.
      operationId: notificationTemplateVersionPreview
      parameters:
        - $ref: '#/components/parameters/TemplateId'
        - $ref: '#/components/parameters/Version'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                locales:
                  type: array
                  maxItems: 5
                  items:
                    $ref: '#/components/schemas/Locale'
                languages:
                  type: array
                  maxItems: 5
                  description: Alias of `locales`.
                  items:
                    $ref: '#/components/schemas/Locale'
                payload:
                  type: object
                  additionalProperties: true
                  description: Overrides of the generated sample payload.
                sample:
                  type: object
                  nullable: true
                  additionalProperties: true
                  description: Alias of `payload`.
                timezone:
                  type: string
                  maxLength: 64
                  description: IANA time zone for dates (default America/Santiago).
                  example: America/Santiago
                draft:
                  type: object
                  additionalProperties: false
                  description: Unsaved halves to render.
                  properties:
                    base:
                      type: object
                      additionalProperties: true
                    metadata:
                      type: object
                      additionalProperties: true
                      description: Alias of `base`.
                    translations:
                      $ref: '#/components/schemas/Translations'
            example:
              locales:
                - es
                - en
              payload:
                onboarding_url: https://app.maihuego.com/onboarding/abc
      responses:
        '200':
          description: One render per language
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        language:
                          $ref: '#/components/schemas/Locale'
                        content:
                          type: object
                          additionalProperties: true
                          description: >-
                            Rendered content; empty when the language does not
                            render.
                        errors:
                          type: object
                          additionalProperties:
                            type: string
                          description: Field → message.
                  message:
                    type: string
                  meta:
                    $ref: '#/components/schemas/Meta'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    TemplateId:
      name: document_id
      in: path
      required: true
      description: Template identifier.
      schema:
        type: string
        format: uuid
    Version:
      name: version
      in: path
      required: true
      description: Version number.
      schema:
        type: integer
        minimum: 1
        maximum: 100000
  schemas:
    Locale:
      type: string
      enum:
        - es
        - en
        - pt
        - fr
        - it
    Translations:
      type: object
      description: Text half per language.
      properties:
        es:
          type: object
          additionalProperties: true
        en:
          type: object
          additionalProperties: true
        pt:
          type: object
          additionalProperties: true
        fr:
          type: object
          additionalProperties: true
        it:
          type: object
          additionalProperties: true
    Meta:
      type: object
      properties:
        correlation:
          type: string
          description: Request correlation id; quote it when reporting an issue.
        status:
          type: integer
        timestamp:
          type: string
          format: date-time
        version:
          type: string
          nullable: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            errors:
              type: array
              items: {}
            message:
              type: string
        meta:
          $ref: '#/components/schemas/Meta'
  responses:
    BadRequest:
      description: Malformed path, unknown body field or a body that is not JSON
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, revoked or expired credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: The caller lacks the required permission
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Template or version not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: A `secret` API key, `hzk_<env>_<prefix>_<secret>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.