# channel_connections.list

Listar as contas conectadas de WhatsApp ou Instagram. As "instâncias de canal" do original (`GET /channel-instances`), só do canal pedido (`whatsapp`: números da API oficial e por QR code; `instagram`) e só as que o membro pode usar. Cada item traz `status` (`live`, `connecting` = QR ainda sem leitura, `error` = precisa reconectar), `syncing` (coexistência importando o histórico), número e conta da WABA, qualidade (`GREEN`/`YELLOW`/`RED`), limite de envio (`messagingLimitTier`), status do número, verificação do negócio e nome em revisão (da Meta, ao vivo e com cache de 5 minutos), nome, usuário, foto, seguidores e mídias do Instagram, `usagePermissions` (Chat ao Vivo, automações e disparo) e as flags do Atomiks (`humanAgent`, `receiveGroups`, `alwaysOnline`). Dado que a Meta não devolver vem `null`. Desconectados não aparecem.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/channel_connections.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_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `channel_connections.list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `channel` | "whatsapp" \| "instagram" | sim |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "channel": {
      "type": "string",
      "enum": [
        "whatsapp",
        "instagram"
      ]
    }
  },
  "required": [
    "channel"
  ]
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs channel_connections.list --json '{"channel":"whatsapp"}'
```

MCP: ferramenta `channel_connections_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"
          },
          "channel": {
            "type": "string",
            "enum": [
              "whatsapp",
              "whatsapp_unofficial",
              "instagram"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "connecting",
              "live",
              "error"
            ]
          },
          "syncing": {
            "type": "boolean"
          },
          "stableKey": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "wabaId": {
            "type": [
              "string",
              "null"
            ]
          },
          "numberStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "businessVerified": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "qualityRating": {
            "type": [
              "string",
              "null"
            ]
          },
          "messagingLimitTier": {
            "type": [
              "string",
              "null"
            ]
          },
          "requestedNameStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "instagramName": {
            "type": [
              "string",
              "null"
            ]
          },
          "instagramUsername": {
            "type": [
              "string",
              "null"
            ]
          },
          "instagramBio": {
            "type": [
              "string",
              "null"
            ]
          },
          "instagramWebsite": {
            "type": [
              "string",
              "null"
            ]
          },
          "instagramFollowersCount": {
            "type": [
              "number",
              "null"
            ]
          },
          "instagramFollowsCount": {
            "type": [
              "number",
              "null"
            ]
          },
          "instagramMediaCount": {
            "type": [
              "number",
              "null"
            ]
          },
          "instagramAccountType": {
            "type": [
              "string",
              "null"
            ]
          },
          "profilePhotoUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "usagePermissions": {
            "type": "object",
            "properties": {
              "liveChat": {
                "type": "boolean"
              },
              "automations": {
                "type": "boolean"
              },
              "broadcast": {
                "type": "boolean"
              }
            },
            "required": [
              "liveChat",
              "automations",
              "broadcast"
            ],
            "additionalProperties": false
          },
          "connectionType": {
            "type": "string"
          },
          "humanAgent": {
            "type": "boolean"
          },
          "receiveGroups": {
            "type": "boolean"
          },
          "alwaysOnline": {
            "type": "boolean"
          },
          "providerUpdateAvailable": {
            "type": "boolean"
          },
          "lastWebhookAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "syncedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "archivedAt": {
            "type": "null"
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "channel",
          "status",
          "syncing",
          "stableKey",
          "displayName",
          "phone",
          "wabaId",
          "numberStatus",
          "businessVerified",
          "qualityRating",
          "messagingLimitTier",
          "requestedNameStatus",
          "instagramName",
          "instagramUsername",
          "instagramBio",
          "instagramWebsite",
          "instagramFollowersCount",
          "instagramFollowsCount",
          "instagramMediaCount",
          "instagramAccountType",
          "profilePhotoUrl",
          "usagePermissions",
          "connectionType",
          "humanAgent",
          "receiveGroups",
          "alwaysOnline",
          "providerUpdateAvailable",
          "lastWebhookAt",
          "syncedAt",
          "archivedAt",
          "createdAt"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "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).
