# broadcasts.list

Listar envios em massa de um canal. Lista "Meus envios de …" de Mensagens > Broadcasts, do mais recente ao mais antigo. Só `whatsapp` tem envios (os de `contacts.bulk_send`); `email`, `sms` e `voice` ainda não existem e voltam vazios com `available: false` e o `reason`. `name` busca no nome (modelo ou começo do texto) e `status` filtra (`sending`, `sent`, `failed`…). Cada item traz `sent`, `failed` e `skipped` (contatos), `processed` (os três somados) e `total`. Detalhes e falhas de um envio: `contacts.bulk_send_get`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `channel` | "whatsapp" \| "email" \| "sms" \| "voice" | não | padrão "whatsapp" |
| `page` | integer | não | padrão 1 |
| `perPage` | integer | não | padrão 20 |
| `name` | string | não |  |
| `status` | "draft" \| "scheduled" \| "sending" \| "sent" \| "failed" \| "insufficient_credits" \| "suppressed"[] | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "channel": {
      "default": "whatsapp",
      "type": "string",
      "enum": [
        "whatsapp",
        "email",
        "sms",
        "voice"
      ]
    },
    "page": {
      "default": 1,
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "perPage": {
      "default": 20,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "name": {
      "type": "string",
      "maxLength": 100
    },
    "status": {
      "maxItems": 7,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "draft",
          "scheduled",
          "sending",
          "sent",
          "failed",
          "insufficient_credits",
          "suppressed"
        ]
      }
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/broadcasts.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channel":"whatsapp","page":1,"perPage":20}'
```

CLI:

```bash
node cli/atomiks.mjs broadcasts.list --json '{"channel":"whatsapp","page":1,"perPage":20}'
```

MCP: ferramenta `broadcasts_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": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "channelId": {
            "type": "string"
          },
          "templateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "params": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "scheduled",
              "sending",
              "sent",
              "failed",
              "insufficient_credits",
              "suppressed"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "finishedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "number"
          },
          "processed": {
            "type": "number"
          },
          "sent": {
            "type": "number"
          },
          "failed": {
            "type": "number"
          },
          "skipped": {
            "type": "number"
          }
        },
        "required": [
          "id",
          "name",
          "channelId",
          "templateId",
          "text",
          "params",
          "status",
          "createdAt",
          "finishedAt",
          "error",
          "total",
          "processed",
          "sent",
          "failed",
          "skipped"
        ],
        "additionalProperties": false
      }
    },
    "total": {
      "type": "number"
    },
    "available": {
      "type": "boolean"
    },
    "reason": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "items",
    "total",
    "available",
    "reason"
  ],
  "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).
