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

# Retrieve Template

> Retrieves a template by UUID or alias, including its current draft content and publish state.



## OpenAPI

````yaml /openapi.json get /templates/{template}
openapi: 3.1.0
info:
  title: Dugble API
  description: >-
    Programmatic access to Dugble email, SMS, sending infrastructure, contacts,
    audiences, suppressions, and broadcasts. Authenticate with a team token sent
    as a Bearer token.
  version: 1.0.0
  contact:
    name: Dugble Support
    email: support@dugble.com
servers:
  - url: https://api.dugble.com
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Email
    description: Send and manage transactional emails.
  - name: SMS
    description: Send and manage SMS messages.
  - name: Domains
    description: Manage and verify sending domains.
  - name: Templates
    description: Create, version, publish, preview, and test reusable email templates.
  - name: Sender IDs
    description: Manage SMS sender IDs.
  - name: Contacts
    description: Manage contacts and their audience memberships.
  - name: Contact Properties
    description: Manage typed custom property definitions used by contacts.
  - name: Topics
    description: Manage contact subscription topics.
  - name: Segments
    description: Manage audience segments.
  - name: Suppressions
    description: Manage suppressed email recipients.
  - name: Broadcasts
    description: Create, schedule, and analyze email broadcasts.
paths:
  /templates/{template}:
    get:
      tags:
        - Templates
      summary: Retrieve Template
      description: >-
        Retrieves a template by UUID or alias, including its current draft
        content and publish state.
      operationId: getTemplate
      parameters:
        - $ref: '#/components/parameters/TemplateIdentifier'
      responses:
        '200':
          description: Template retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateResourceEnvelope'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    TemplateIdentifier:
      name: template
      in: path
      required: true
      description: Template UUID or alias.
      schema:
        type: string
  schemas:
    TemplateResourceEnvelope:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/TemplateResource'
    TemplateResource:
      type: object
      required:
        - object
        - id
        - current_version_id
        - name
        - category
        - created_at
        - updated_at
        - status
        - reply_to
        - html
        - variables
        - has_unpublished_versions
      properties:
        object:
          type: string
          enum:
            - template
        id:
          type: string
          format: uuid
        current_version_id:
          type: string
          format: uuid
        alias:
          type:
            - string
            - 'null'
        name:
          type: string
        category:
          $ref: '#/components/schemas/TemplateCategory'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - draft
            - published
        published_at:
          type:
            - string
            - 'null'
          format: date-time
        from:
          type:
            - string
            - 'null'
        subject:
          type:
            - string
            - 'null'
        reply_to:
          type: array
          items:
            type: string
        html:
          type: string
        text:
          type:
            - string
            - 'null'
        variables:
          type: array
          items:
            $ref: '#/components/schemas/TemplateVariableResource'
        has_unpublished_versions:
          type: boolean
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - BAD_REQUEST
                - UNAUTHORIZED
                - FORBIDDEN
                - STEP_UP_REQUIRED
                - NOT_FOUND
                - CONFLICT
                - PAYMENT_REQUIRED
                - PAYLOAD_TOO_LARGE
                - UNPROCESSABLE_ENTITY
                - TOO_MANY_REQUESTS
                - INTERNAL_ERROR
                - SERVICE_UNAVAILABLE
            message:
              type: string
    TemplateCategory:
      type: string
      enum:
        - otp
        - welcome
        - receipt
        - alert
        - notification
        - custom
    TemplateVariableResource:
      type: object
      required:
        - id
        - key
        - type
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        type:
          type: string
          enum:
            - string
            - number
        fallback_value: {}
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  responses:
    Error:
      description: >-
        The request failed. See the HTTP status and structured error code for
        the category.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Team token
      description: >-
        Pass a Dugble team token in the Authorization header as Bearer <token>.
        Team token secrets use the dgb_team_ prefix.

````