# groups.groups_list

Listar grupos de uma campanha. Grupos vivos da campanha por `position`, 50 por página (até 100). Paginação por `cursor` (devolvido em `nextCursor`), busca por nome e filtros rodam no servidor: `capturing`, `paused`, `full` (membros + reservas >= capacidade), `invalid_link`, `issues` (sem acesso ou link inválido). `folderId` aceita `none`; `linkId` aceita `main` (link principal). Cada grupo traz a ocupação real.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `campaignId` | string (uuid) | sim |  |
| `cursor` | string | não |  |
| `limit` | integer | não | padrão 50 |
| `search` | string | não |  |
| `filter` | "all" \| "capturing" \| "paused" \| "full" \| "invalid_link" \| "issues" | não | padrão "all" |
| `folderId` | "none" \| string (uuid) | não |  |
| `linkId` | "main" \| string (uuid) | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "campaignId": {
      "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)$"
    },
    "cursor": {
      "type": "string",
      "maxLength": 20
    },
    "limit": {
      "default": 50,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "search": {
      "type": "string",
      "maxLength": 100
    },
    "filter": {
      "default": "all",
      "type": "string",
      "enum": [
        "all",
        "capturing",
        "paused",
        "full",
        "invalid_link",
        "issues"
      ]
    },
    "folderId": {
      "anyOf": [
        {
          "type": "string",
          "const": "none"
        },
        {
          "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)$"
        }
      ]
    },
    "linkId": {
      "anyOf": [
        {
          "type": "string",
          "const": "main"
        },
        {
          "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)$"
        }
      ]
    }
  },
  "required": [
    "campaignId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/groups.groups_list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"campaignId":"00000000-0000-4000-8000-000000000001","limit":50,"filter":"all"}'
```

CLI:

```bash
node cli/atomiks.mjs groups.groups_list --json '{"campaignId":"00000000-0000-4000-8000-000000000001","limit":50,"filter":"all"}'
```

MCP: ferramenta `groups_groups_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"
          },
          "jid": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "position": {
            "type": "number"
          },
          "memberCount": {
            "type": "number"
          },
          "reservedCount": {
            "type": "number"
          },
          "capacity": {
            "type": "number"
          },
          "occupancyPct": {
            "type": "number"
          },
          "captureActive": {
            "type": "boolean"
          },
          "inviteStatus": {
            "type": "string"
          },
          "isAdmin": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "accessIssue": {
            "type": [
              "string",
              "null"
            ]
          },
          "folderId": {
            "type": [
              "string",
              "null"
            ]
          },
          "linkId": {
            "type": [
              "string",
              "null"
            ]
          },
          "channelId": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastJoinAt": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "jid",
          "name",
          "position",
          "memberCount",
          "reservedCount",
          "capacity",
          "occupancyPct",
          "captureActive",
          "inviteStatus",
          "isAdmin",
          "accessIssue",
          "folderId",
          "linkId",
          "channelId",
          "lastJoinAt"
        ],
        "additionalProperties": false
      }
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ]
    },
    "total": {
      "type": "number"
    }
  },
  "required": [
    "items",
    "nextCursor",
    "total"
  ],
  "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).
