# visitors.live

Ações ao vivo. Ações dos visitantes nas últimas 24 horas (até 100, mais recentes primeiro) e a contagem da última hora (`lastHourCountCapped` quando passa do teto). Sem rastreio no Atomiks, vazio.

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

## Entrada

Sem campos: envie `{}`.

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {}
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/visitors.live \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

CLI:

```bash
node cli/atomiks.mjs visitors.live --json '{}'
```

MCP: ferramenta `visitors_live` 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": {
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "visitorId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string"
          },
          "channel": {
            "type": "string",
            "enum": [
              "google",
              "facebook",
              "instagram",
              "tiktok",
              "youtube",
              "linkedin",
              "whatsapp",
              "email",
              "referral",
              "direct",
              "other"
            ]
          },
          "leadName": {
            "type": [
              "string",
              "null"
            ]
          },
          "pageName": {
            "type": [
              "string",
              "null"
            ]
          },
          "hostname": {
            "type": [
              "string",
              "null"
            ]
          },
          "pathname": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "visitorId",
          "eventType",
          "occurredAt",
          "channel",
          "leadName",
          "pageName",
          "hostname",
          "pathname"
        ],
        "additionalProperties": false
      }
    },
    "lastHourCount": {
      "type": "number"
    },
    "lastHourCountCapped": {
      "type": "boolean"
    }
  },
  "required": [
    "events",
    "lastHourCount",
    "lastHourCountCapped"
  ],
  "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).
