# pipelines.people_stats

Atendentes de um pipeline com contagem de oportunidades. Atendentes do pipeline (`isMember`) e, fora dele, os que têm oportunidades nele, cada um com `openCards`, `wonCards`, `lostCards` e `totalCards` neste pipeline, e os tipos de atendente. Com `includeAll`, devolve também os atendentes sem vínculo e sem oportunidades (para escolher quem entra no pipeline). Sem a migration de atendentes, ninguém é membro.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `pipelineId` | string (uuid) | sim |  |
| `includeAll` | boolean | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "pipelineId": {
      "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)$"
    },
    "includeAll": {
      "type": "boolean"
    }
  },
  "required": [
    "pipelineId"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/pipelines.people_stats \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pipelineId":"00000000-0000-0000-0000-000000000000"}'
```

CLI:

```bash
node cli/atomiks.mjs pipelines.people_stats --json '{"pipelineId":"00000000-0000-0000-0000-000000000000"}'
```

MCP: ferramenta `pipelines_people_stats` 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": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "isMember": {
            "type": "boolean"
          },
          "openCards": {
            "type": "number"
          },
          "wonCards": {
            "type": "number"
          },
          "lostCards": {
            "type": "number"
          },
          "totalCards": {
            "type": "number"
          },
          "types": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "id",
                "name"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "name",
          "avatarUrl",
          "isMember",
          "openCards",
          "wonCards",
          "lostCards",
          "totalCards",
          "types"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "items"
  ],
  "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).
