# channel_connections.templates_list

Listar os templates de um número de WhatsApp. Os modelos da Meta do número, com categoria, status (`APPROVED`, `PENDING`, `REJECTED`, `PAUSED`), motivo da recusa, cabeçalho, corpo, rodapé e botões. Sincroniza antes se a última sincronização tem mais de 1 hora ou com `sync: true`.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/channel_connections.templates_list` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `channels:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `channel_connections_templates_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `channel_connections.templates_list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `channelId` | string (uuid) | sim |  |
| `sync` | boolean | não | padrão false |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "channelId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "sync": {
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "channelId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/channel_connections.templates_list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channelId":"00000000-0000-0000-0000-000000000000","sync":false}'
```

CLI:

```bash
node cli/atomiks.mjs channel_connections.templates_list --json '{"channelId":"00000000-0000-0000-0000-000000000000","sync":false}'
```

MCP: ferramenta `channel_connections_templates_list` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "syncedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "rejectedReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "header": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": "string"
          },
          "footer": {
            "type": [
              "string",
              "null"
            ]
          },
          "buttons": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "type",
                "text",
                "url"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "language",
          "category",
          "status",
          "rejectedReason",
          "header",
          "body",
          "footer",
          "buttons"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "syncedAt",
    "items"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
