# segmentation.system_tags

Tags do sistema (eventos). Aba "Tags do sistema": cada tipo de atividade que algum contato fez (`eventName`, ex.: crm.tag.lead.apply.v1) com a categoria, os contatos (`count`), as ocorrências, as dos últimos 7 dias e a primeira e a última vez. Vem das fontes do Histórico de atividades (as 2 000 ocorrências mais recentes de cada fonte). `q` filtra pelo nome do evento; `orderBy` (eventName, count, occurrences, occurrencesLast7Days, firstSeenAt, lastSeenAt) e `order` ordenam (padrão última atividade, decrescente).

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `q` | string | não |  |
| `orderBy` | "eventName" \| "count" \| "occurrences" \| "occurrencesLast7Days" \| "firstSeenAt" \| "lastSeenAt" | não |  |
| `order` | "asc" \| "desc" | 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": {
    "q": {
      "type": "string",
      "maxLength": 80
    },
    "orderBy": {
      "type": "string",
      "enum": [
        "eventName",
        "count",
        "occurrences",
        "occurrencesLast7Days",
        "firstSeenAt",
        "lastSeenAt"
      ]
    },
    "order": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "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/segmentation.system_tags \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

CLI:

```bash
node cli/atomiks.mjs segmentation.system_tags --json '{}'
```

MCP: ferramenta `segmentation_system_tags` 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": {
          "eventName": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "count": {
            "type": "number"
          },
          "occurrences": {
            "type": "number"
          },
          "occurrencesLast7Days": {
            "type": "number"
          },
          "firstSeenAt": {
            "type": "string"
          },
          "lastSeenAt": {
            "type": "string"
          }
        },
        "required": [
          "eventName",
          "category",
          "count",
          "occurrences",
          "occurrencesLast7Days",
          "firstSeenAt",
          "lastSeenAt"
        ],
        "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
    }
  },
  "required": [
    "data",
    "meta"
  ],
  "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).
