# segmentation.system_tag_insights

Insights de uma tag do sistema. Painel do evento: `coverage` (contatos que o fizeram / contatos da conta), ocorrências (total, 7 e 30 dias), novos contatos em 30 dias, séries `daily` (30 dias) e `monthly` (6 meses), `weekdays` (domingo a sábado) e `hours` (0 a 23) no fuso da conta, `coOccurring` (outros eventos dos mesmos contatos), `topLeads` (quem mais dispara) e `flows` (automações com gatilho de entrada ou saída neste evento).

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `eventName` | string | sim |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "eventName": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    }
  },
  "required": [
    "eventName"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/segmentation.system_tag_insights \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"eventName":"crm.tag.lead.apply.v1"}'
```

CLI:

```bash
node cli/atomiks.mjs segmentation.system_tag_insights --json '{"eventName":"crm.tag.lead.apply.v1"}'
```

MCP: ferramenta `segmentation_system_tag_insights` 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": {
    "eventName": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "totalLeads": {
      "type": "number"
    },
    "coverage": {
      "type": "number"
    },
    "leadsCount": {
      "type": "number"
    },
    "occurrences": {
      "type": "number"
    },
    "occurrencesLast7Days": {
      "type": "number"
    },
    "occurrencesLast30Days": {
      "type": "number"
    },
    "newLeadsLast30Days": {
      "type": "number"
    },
    "firstSeenAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastSeenAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "hours": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "weekdays": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "daily": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "date",
          "count"
        ],
        "additionalProperties": false
      }
    },
    "monthly": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "month": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "month",
          "count"
        ],
        "additionalProperties": false
      }
    },
    "health": {
      "type": "string",
      "enum": [
        "healthy",
        "attention",
        "unused"
      ]
    },
    "coOccurrenceSample": {
      "type": "number"
    },
    "coOccurring": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "eventName": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "leads": {
            "type": "number"
          },
          "share": {
            "type": "number"
          }
        },
        "required": [
          "eventName",
          "category",
          "leads",
          "share"
        ],
        "additionalProperties": false
      }
    },
    "topLeads": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "leadId": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "telephone": {
            "type": [
              "string",
              "null"
            ]
          },
          "occurrences": {
            "type": "number"
          },
          "lastAt": {
            "type": "string"
          }
        },
        "required": [
          "leadId",
          "name",
          "email",
          "telephone",
          "occurrences",
          "lastAt"
        ],
        "additionalProperties": false
      }
    },
    "flows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "triggerType": {
            "type": "string",
            "enum": [
              "start",
              "exit"
            ]
          },
          "mode": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "triggerType",
          "mode"
        ],
        "additionalProperties": false
      }
    },
    "flowsCount": {
      "type": "number"
    }
  },
  "required": [
    "eventName",
    "category",
    "totalLeads",
    "coverage",
    "leadsCount",
    "occurrences",
    "occurrencesLast7Days",
    "occurrencesLast30Days",
    "newLeadsLast30Days",
    "firstSeenAt",
    "lastSeenAt",
    "hours",
    "weekdays",
    "daily",
    "monthly",
    "health",
    "coOccurrenceSample",
    "coOccurring",
    "topLeads",
    "flows",
    "flowsCount"
  ],
  "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).
