# activities.list

Histórico global de atividades. Atividades de todos os contatos que quem pede enxerga, do mais recente para o mais antigo, com os filtros do Histórico de atividades do Clickmax. Cada item traz `eventName` (nome do evento no original, como `crm.tag.lead.apply.v1`), `name`, `category` (Checkout, Email, Chat, Tag, Lead, Opportunity, PageView, Cart, PaymentFailedOrExpired ou MemberArea), `leadId`/`leadName`, `opportunityId`, `leadTaskId`, `messageId`, quem fez (`actorType`, `actorId`, `actorName`) e `meta` com os detalhes do tipo (tag, etapa, valor, produto, texto da mensagem…).

Filtros (E entre eles; dentro de cada lista, qualquer valor): `eventName`, `startDate`/`endDate` (AAAA-MM-DD ou ISO; dia sem hora vale o dia inteiro em UTC), `tagIds`, `pipelineIds`, `flowIds`, `productIds`. `offerIds`, `pageIds`, `funnelIds` e `messageIds` existem no original e não têm fonte aqui: com algum valor a lista vem vazia. `leadId` limita a um contato (precisa estar visível, senão `not_found`).

Paginação como o original: `page` (de 1) e `perPage` (50, até 100); `meta.countItens` é o total ("N atividades no total") e `meta.countPages` as páginas. Só as 5 000 mais recentes de cada fonte ficam ao alcance de páginas fundas: acima disso `data` vem vazio e `countPages` para antes; filtre por período para chegar mais longe. `timezone` é o fuso da conta, para agrupar por dia. Ao vivo: repita `page: 1, perPage: 50` a cada 5 segundos.

Fontes: mensagens e notas internas, atendimentos, compras e cancelamentos, oportunidades (criada, ganha, perdida), tarefas, consentimentos de envio, execuções de automação (flows e Instagram) e eventos de domínio (etiquetas, campos, etapas, vendas de integrações, carrinho, assinatura, comentários do Instagram). Tipos do original sem fonte aqui (e-mail, campanha, voz, Telegram, páginas, área de membros do original, leitura da conversa por IA…) aparecem em `activities.filter_options` com `hasSource: false`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `eventName` | string[] | não |  |
| `startDate` | string | não |  |
| `endDate` | string | não |  |
| `offerIds` | string[] | não |  |
| `pageIds` | string[] | não |  |
| `funnelIds` | string[] | não |  |
| `productIds` | string (uuid)[] | não |  |
| `tagIds` | string (uuid)[] | não |  |
| `messageIds` | string[] | não |  |
| `pipelineIds` | string (uuid)[] | não |  |
| `flowIds` | string (uuid)[] | não |  |
| `leadId` | string (uuid) | não |  |
| `page` | integer | não |  |
| `perPage` | integer | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventName": {
      "maxItems": 400,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 120
      }
    },
    "startDate": {
      "type": "string",
      "maxLength": 40
    },
    "endDate": {
      "type": "string",
      "maxLength": 40
    },
    "offerIds": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "pageIds": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "funnelIds": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "productIds": {
      "maxItems": 200,
      "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)$"
      }
    },
    "tagIds": {
      "maxItems": 200,
      "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)$"
      }
    },
    "messageIds": {
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "pipelineIds": {
      "maxItems": 200,
      "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)$"
      }
    },
    "flowIds": {
      "maxItems": 200,
      "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)$"
      }
    },
    "leadId": {
      "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)$"
    },
    "page": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10000
    },
    "perPage": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/activities.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"startDate":"2026-10-01","eventName":["crm.tag.lead.apply.v1"],"page":1,"perPage":50}'
```

CLI:

```bash
node cli/atomiks.mjs activities.list --json '{"startDate":"2026-10-01","eventName":["crm.tag.lead.apply.v1"],"page":1,"perPage":50}'
```

MCP: ferramenta `activities_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": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "eventName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "leadId": {
            "type": [
              "string",
              "null"
            ]
          },
          "leadName": {
            "type": [
              "string",
              "null"
            ]
          },
          "opportunityId": {
            "type": [
              "string",
              "null"
            ]
          },
          "leadTaskId": {
            "type": [
              "string",
              "null"
            ]
          },
          "objectRecordId": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "aggregateId": {
            "type": [
              "string",
              "null"
            ]
          },
          "actorType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "user",
                  "flow",
                  "automation",
                  "ai",
                  "api",
                  "system"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "actorId": {
            "type": [
              "string",
              "null"
            ]
          },
          "actorName": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "eventName",
          "name",
          "category",
          "createdAt",
          "leadId",
          "leadName",
          "opportunityId",
          "leadTaskId",
          "objectRecordId",
          "messageId",
          "aggregateId",
          "actorType",
          "actorId",
          "actorName",
          "meta"
        ],
        "additionalProperties": false
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "page": {
          "type": "number"
        },
        "perPage": {
          "type": "number"
        },
        "countItens": {
          "type": "number"
        },
        "countPages": {
          "type": "number"
        }
      },
      "required": [
        "page",
        "perPage",
        "countItens",
        "countPages"
      ],
      "additionalProperties": false
    },
    "timezone": {
      "type": "string"
    }
  },
  "required": [
    "data",
    "meta",
    "timezone"
  ],
  "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).
