> For the complete documentation index, see [llms.txt](https://docs.fortics.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortics.com.br/campanha-api-reference/exportacoes-v2.md). Agents can also search and read this documentation through its [MCP server](https://docs.fortics.com.br/~gitbook/mcp).

# Exportações (v2)

## Exportar a base de contatos

> Sem ids, exporta a base inteira. Os filtros de GET /contacts (tag\_id, opt\_in etc.) ainda não são aceitos aqui — ver GET /exports/:id para status.

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/api/campaign/v2/exports/contacts":{"post":{"description":"Sem ids, exporta a base inteira. Os filtros de GET /contacts (tag_id, opt_in etc.) ainda não são aceitos aqui — ver GET /exports/:id para status.","operationId":"ContactsExportV2Controller_exportContacts_v2","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"description":"IDs dos contatos a exportar. Omitido exporta a base inteira (filtros de GET /contacts ainda não suportados aqui).","type":"array","items":{"type":"string"}}},"description":"Corpo para exportar contatos em CSV"}}}},"responses":{"201":{"description":""}},"summary":"Exportar a base de contatos","tags":["Exportações (v2)"]}}}}
```

## GET /api/campaign/v2/exports

> Listar exportações

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"ExportReportListPresenter":{"type":"object","properties":{"meta":{"$ref":"#/components/schemas/PaginationMetaPresenter"},"items":{"type":"array","items":{"$ref":"#/components/schemas/ExportReportPresenter"}}},"required":["meta","items"]},"PaginationMetaPresenter":{"type":"object","properties":{"totalItems":{"type":"number","description":"Total de itens em todas as páginas"},"itemCount":{"type":"number","description":"Itens na página atual"},"itemsPerPage":{"type":"number","description":"Limite de itens por página"},"totalPages":{"type":"number","description":"Total de páginas"},"currentPage":{"type":"number","description":"Página atual"}},"required":["totalItems","itemCount","itemsPerPage","totalPages","currentPage"]},"ExportReportPresenter":{"type":"object","properties":{"_id":{"type":"string","description":"Identificador da exportação"},"description":{"type":"string","description":"Descrição da exportação"},"model":{"type":"string","description":"Origem dos dados exportados (ex. contacts, batch-delivery)"},"status":{"type":"string","description":"Status do processamento: processing, completed ou failed"},"download_url":{"type":"string","description":"URL de download, disponível quando status é completed","nullable":true},"fail_detail":{"type":"string","description":"Detalhe do erro, quando status é failed","nullable":true},"created_at":{"format":"date-time","type":"string","description":"Data de criação"}},"required":["_id","description","model","status","download_url","fail_detail","created_at"]}}},"paths":{"/api/campaign/v2/exports":{"get":{"operationId":"ExportReportV2Controller_list_v2","parameters":[{"name":"page","required":false,"in":"query","description":"Página atual (base 1)","schema":{"default":1,"description":"Página atual (base 1)","type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","required":false,"in":"query","description":"Itens por página, máximo 100","schema":{"default":10,"description":"Itens por página, máximo 100","type":"integer","minimum":1,"maximum":100}},{"name":"search","required":false,"in":"query","description":"Busca textual livre","schema":{"description":"Busca textual livre","type":"string"}},{"name":"sort","required":false,"in":"query","description":"Ordenação no formato campo:asc|desc","schema":{"description":"Ordenação no formato campo:asc|desc","type":"string","pattern":"^[a-zA-Z0-9_.]+:(asc|desc)$"}}],"responses":{"200":{"description":"Listagem realizada com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportReportListPresenter"}}}}},"summary":"Listar exportações","tags":["Exportações (v2)"]}}}}
```

## Status de uma exportação

> download\_url fica disponível quando status é completed.

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"ExportReportPresenter":{"type":"object","properties":{"_id":{"type":"string","description":"Identificador da exportação"},"description":{"type":"string","description":"Descrição da exportação"},"model":{"type":"string","description":"Origem dos dados exportados (ex. contacts, batch-delivery)"},"status":{"type":"string","description":"Status do processamento: processing, completed ou failed"},"download_url":{"type":"string","description":"URL de download, disponível quando status é completed","nullable":true},"fail_detail":{"type":"string","description":"Detalhe do erro, quando status é failed","nullable":true},"created_at":{"format":"date-time","type":"string","description":"Data de criação"}},"required":["_id","description","model","status","download_url","fail_detail","created_at"]}}},"paths":{"/api/campaign/v2/exports/{id}":{"get":{"description":"download_url fica disponível quando status é completed.","operationId":"ExportReportV2Controller_detail_v2","parameters":[{"name":"id","required":true,"in":"path","description":"Identificador no formato ObjectId (24 caracteres hexadecimais)","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Identificador no formato ObjectId (24 caracteres hexadecimais)"}}],"responses":{"200":{"description":"Exportação encontrada com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportReportPresenter"}}}}},"summary":"Status de uma exportação","tags":["Exportações (v2)"]}}}}
```

## Baixar o arquivo de uma exportação

> Disponível apenas quando status é completed.

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}}},"paths":{"/api/campaign/v2/exports/download/{id}":{"get":{"description":"Disponível apenas quando status é completed.","operationId":"ExportReportV2Controller_download_v2","parameters":[{"name":"id","required":true,"in":"path","description":"Identificador no formato ObjectId (24 caracteres hexadecimais)","schema":{"type":"string","pattern":"^[0-9a-fA-F]{24}$","description":"Identificador no formato ObjectId (24 caracteres hexadecimais)"}}],"responses":{"200":{"description":"Arquivo retornado com sucesso"},"400":{"description":"Exportação ainda não concluída"},"404":{"description":"Exportação não encontrada"}},"summary":"Baixar o arquivo de uma exportação","tags":["Exportações (v2)"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fortics.com.br/campanha-api-reference/exportacoes-v2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
