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

# Obter Templates

> Recupere todos os templates HSM configurados no seu bot

Obtenha a lista de todos os templates configurados no seu bot. Você pode filtrar por nome, status ou categoria.

```
GET /v1/bots/{botId}/templates
```

<Tip>
  Revise os templates existentes antes de criar um novo para evitar duplicatas.
</Tip>

***

## Parâmetros de Path

| Propriedade | Tipo   | Descrição                             |
| ----------- | ------ | ------------------------------------- |
| **botId**   | string | ID único do bot. Exemplo: `123456789` |

***

## Parâmetros de Query

| Propriedade  | Tipo   | Descrição                                                                                      |
| ------------ | ------ | ---------------------------------------------------------------------------------------------- |
| **query**    | string | Pesquisar templates por **elementName**                                                        |
| **status**   | string | Pesquisar templates por status. Valores possíveis: `PENDING`, `REJECTED`, `APPROVED`           |
| **category** | string | Pesquisar templates por categoria. Valores possíveis: `UTILITY`, `MARKETING`, `AUTHENTICATION` |

***

## Respostas

<AccordionGroup>
  <Accordion title="200 - Resposta bem-sucedida">
    ```json theme={null}
    {
      "data": [
        {
          "template": "Hello! We are *Jelou*. \nWelcome _{{1}}_.",
          "displayName": "Welcome",
          "elementName": "welcome_customer",
          "params": [
            {"label": "Customer name", "param": "1"}
          ],
          "paramsNumber": 1,
          "isVisible": true,
          "language": "EN",
          "status": "APPROVED",
          "category": "UTILITY",
          "createdAt": "2021-01-28T15:08:38.492Z",
          "updatedAt": "2021-01-28T15:08:38.492Z"
        }
      ]
    }
    ```
  </Accordion>

  <Accordion title="401 - Não Autorizado">
    ```json theme={null}
    {
      "message": "Authentication failed"
    }
    ```
  </Accordion>

  <Accordion title="404 - Não Encontrado">
    ```json theme={null}
    {
      "message": ["The Bot could not be found at the moment."],
      "statusMessage": "failed",
      "error": {
        "code": "E1019",
        "key": "BOT_NOT_FOUND"
      }
    }
    ```
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml GET /v1/bots/{botId}/templates
openapi: 3.1.0
info:
  title: Jelou API
  description: >-
    API for the Jelou platform. Send messages, manage campaigns, handle
    conversations, users, databases, and widgets.
  version: 1.0.0
servers:
  - url: https://api.jelou.ai
    description: Production server
security:
  - basicAuth: []
tags:
  - name: Messages
    description: Send messages to users
  - name: Campaigns
    description: HSM campaigns and templates
  - name: Conversations
    description: Chat history and metrics
  - name: Users
    description: User state and cache management
  - name: Resources
    description: Media resource management
  - name: Datum
    description: Database CRUD operations
  - name: Widget
    description: Widget and room management
  - name: PMA Custom
    description: External support panel integration
paths:
  /v1/bots/{botId}/templates:
    get:
      tags:
        - Campaigns
      summary: Obtener Plantillas
      description: Recupera todas las plantillas HSM configuradas en un bot.
      operationId: getTemplates
      parameters:
        - name: botId
          in: path
          required: true
          schema:
            type: string
        - name: query
          in: query
          description: Buscar por elementName
          schema:
            type: string
        - name: status
          in: query
          schema:
            type: string
            enum:
              - PENDING
              - REJECTED
              - APPROVED
        - name: category
          in: query
          schema:
            type: string
            enum:
              - UTILITY
              - MARKETING
              - AUTHENTICATION
      responses:
        '200':
          description: Plantillas recuperadas exitosamente
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    Unauthorized:
      description: Unauthorized - Invalid authentication credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not found - Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        statusMessage:
          type: string
        status:
          type: integer
        error:
          type: object
          properties:
            code:
              type: string
            key:
              type: string
            description:
              type: string
            developerMessages:
              type: object
            clientMessages:
              type: object
        validationError:
          type: object
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Basic authentication using Base64 encoded clientId:clientSecret

````