# groups.groups_update_bulk

Alterar vários grupos de uma vez. Liga/desliga a captação (`captureActive`), move para uma pasta (`folderId`, `null` tira da pasta) ou para um link de captação (`linkId`, `null` = link principal). Só grupos vivos da campanha; pasta e link têm que ser da campanha. Devolve quantos mudaram.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/groups.groups_update_bulk` (corpo JSON)
- Quem pode chamar: administrador da conta
- Escopo da chave: `marketing:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `groups_groups_update_bulk`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `groups.groups_update_bulk`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `campaignId` | string (uuid) | sim |  |
| `groupIds` | string (uuid)[] | sim |  |
| `set` | object | sim |  |

<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)$"
    },
    "groupIds": {
      "minItems": 1,
      "maxItems": 1000,
      "type": "array",
      "items": {
        "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)$"
      }
    },
    "set": {
      "type": "object",
      "properties": {
        "captureActive": {
          "type": "boolean"
        },
        "folderId": {
          "anyOf": [
            {
              "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)$"
            },
            {
              "type": "null"
            }
          ]
        },
        "linkId": {
          "anyOf": [
            {
              "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)$"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    }
  },
  "required": [
    "campaignId",
    "groupIds",
    "set"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/groups.groups_update_bulk \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"campaignId":"00000000-0000-4000-8000-000000000001","groupIds":["00000000-0000-4000-8000-000000000001"],"set":{"captureActive":false}}'
```

CLI:

```bash
node cli/atomiks.mjs groups.groups_update_bulk --json '{"campaignId":"00000000-0000-4000-8000-000000000001","groupIds":["00000000-0000-4000-8000-000000000001"],"set":{"captureActive":false}}'
```

MCP: ferramenta `groups_groups_update_bulk` 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": {
    "updated": {
      "type": "number"
    }
  },
  "required": [
    "updated"
  ],
  "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).
