# activities_board.export

Exportar atividades em CSV. CSV (UTF-8 com BOM) das atividades que passam nos filtros, até 5 mil: tipo, título, prazo (fuso da conta), situação, contato, e-mail, telefone, pipeline, oportunidade e atendente. Devolve o texto em `csv`.

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

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `types` | "call" \| "whatsapp" \| "meeting" \| "task" \| "appointment"[] | não |  |
| `pipelineIds` | string (uuid)[] | não |  |
| `overdue` | boolean | não |  |
| `overdueBefore` | string (date-time) | não |  |
| `allDayStart` | string (date-time) | não |  |
| `conditions` | object[] | não |  |
| `search` | string | não |  |
| `startDate` | string (date-time) | não |  |
| `endDate` | string (date-time) | não |  |
| `withoutDeadline` | boolean | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "types": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "call",
          "whatsapp",
          "meeting",
          "task",
          "appointment"
        ]
      }
    },
    "pipelineIds": {
      "maxItems": 50,
      "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)$"
      }
    },
    "overdue": {
      "type": "boolean"
    },
    "overdueBefore": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "allDayStart": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "conditions": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "matcher": {
            "type": "string",
            "enum": [
              "all",
              "any"
            ]
          },
          "connector": {
            "type": "string",
            "enum": [
              "and",
              "or"
            ]
          },
          "conditions": {
            "maxItems": 30,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string",
                  "maxLength": 40
                },
                "operator": {
                  "type": "string",
                  "maxLength": 30
                },
                "value": {
                  "maxItems": 100,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              },
              "required": [
                "field",
                "operator",
                "value"
              ]
            }
          }
        },
        "required": [
          "matcher",
          "conditions"
        ]
      }
    },
    "search": {
      "type": "string",
      "maxLength": 120
    },
    "startDate": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "endDate": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    },
    "withoutDeadline": {
      "type": "boolean"
    }
  }
}
```

</details>

## Exemplo

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

CLI:

```bash
node cli/atomiks.mjs activities_board.export --json '{}'
```

MCP: ferramenta `activities_board_export` 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": {
    "filename": {
      "type": "string"
    },
    "csv": {
      "type": "string"
    },
    "count": {
      "type": "number"
    }
  },
  "required": [
    "filename",
    "csv",
    "count"
  ],
  "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).
