> For the complete documentation index, see [llms.txt](https://publer.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://publer.com/docs/analytics/export.md).

# Export

Generate a downloadable CSV or PDF of your analytics for a workspace or a single account. Exports run asynchronously and are retrieved through the Job Status endpoint.

#### Requirements

* **Authentication**: Bearer API token
* **Scope**: `analytics`
* **Headers**:
  * `Authorization: Bearer-API YOUR_API_KEY`
  * `Publer-Workspace-Id: YOUR_WORKSPACE_ID`

### **Export Analytics**

Create an analytics export job.

```http
PUT /api/v1/analytics/export
```

{% hint style="warning" %}
The output format is specified using the **nested** `format` parameter, not a top-level `format` parameter. Any value other than `csv` produces a PDF.
{% endhint %}

**Query Parameters**

<table><thead><tr><th width="184.140625">Parameter</th><th width="96">Type</th><th width="86">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>format</code></td><td>string</td><td>No</td><td><code>csv</code> or <code>pdf</code>. Defaults to <code>pdf</code>.</td></tr><tr><td><code>account_id</code></td><td>string</td><td>No</td><td>Limit the export to one account. When omitted, the export covers all accounts in the workspace.</td></tr><tr><td><code>from</code></td><td>string</td><td>No</td><td>Start of the reporting period (ISO date)</td></tr><tr><td><code>to</code></td><td>string</td><td>No</td><td>End of the reporting period (ISO date)</td></tr><tr><td><code>tab</code></td><td>string</td><td>No</td><td>Analytics tab to export</td></tr><tr><td><code>account_type</code></td><td>string</td><td>No</td><td>Filter by account type</td></tr><tr><td><code>postType</code></td><td>string</td><td>No</td><td>Filter by post type</td></tr><tr><td><code>query</code></td><td>string</td><td>No</td><td>Full-text search on post content</td></tr><tr><td><code>member_id</code></td><td>string</td><td>No</td><td>Filter by workspace member</td></tr><tr><td><code>sort_by</code></td><td>string</td><td>No</td><td>Field to sort by</td></tr><tr><td><code>sort_type</code></td><td>string</td><td>No</td><td>Sort direction</td></tr><tr><td><code>labels[]</code></td><td>string[]</td><td>No</td><td>Filter by label IDs</td></tr><tr><td><code>columns[]</code></td><td>string[]</td><td>No</td><td>Columns to include in a CSV export</td></tr></tbody></table>

## Export Analytics

> Generates a CSV or PDF analytics export. Filters are sent as a JSON request body. The export is produced asynchronously; poll the returned job\_id via the Job Status endpoint to retrieve the finished file.

```json
{"openapi":"3.1.1","info":{"title":"Publer API","version":"1.0.0"},"tags":[{"name":"Analytics","description":"Endpoints for retrieving analytics data and charts"}],"servers":[{"url":"https://app.publer.com/api/v1"}],"security":[{"BearerApiAuth":[]}],"components":{"securitySchemes":{"BearerApiAuth":{"type":"apiKey","name":"Authorization","in":"header","description":"API key authentication. Format: \"Bearer-API YOUR_API_KEY\""}},"schemas":{"JobResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the job was created successfully"},"data":{"type":"object","properties":{"job_id":{"type":"string","description":"ID of the created job"}}}}},"401ErrorResponseWithWorkspace":{"type":"object","properties":{"errors":{"type":"array","description":"List of error messages","items":{"type":"string"}}}},"403ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","description":"List of error messages","items":{"type":"string"}}}}}},"paths":{"/analytics/export":{"put":{"summary":"Export Analytics","tags":["Analytics"],"description":"Generates a CSV or PDF analytics export. Filters are sent as a JSON request body. The export is produced asynchronously; poll the returned job_id via the Job Status endpoint to retrieve the finished file.","parameters":[{"schema":{"type":"string"},"name":"Publer-Workspace-Id","in":"header","required":true,"description":"ID of the workspace to export analytics from"}],"responses":{"200":{"description":"Export job created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/401ErrorResponseWithWorkspace"}}}},"403":{"description":"Permission denied or missing required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/403ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["csv","pdf"],"description":"Output format. Anything other than \"csv\" produces a PDF."},"from":{"type":"string","format":"date","description":"Start of the reporting period"},"to":{"type":"string","format":"date","description":"End of the reporting period"},"tab":{"type":"string","description":"Analytics tab to export, for example \"overview\""},"account_id":{"type":"string","description":"Limit the export to one account. When omitted, the export covers all accounts in the workspace."},"account_type":{"type":"string","description":"Filter by account type"},"postType":{"type":"string","description":"Filter by post type. May be null."},"type":{"type":"string","description":"Filter by type"},"query":{"type":"string","description":"Full-text search on post content"},"member_id":{"type":"string","description":"Filter by workspace member"},"sort_by":{"type":"string","description":"Field to sort by"},"sort_type":{"type":"string","description":"Sort direction"},"labels":{"type":"array","items":{"type":"string"},"description":"Filter by label IDs"},"columns":{"type":"array","items":{"type":"string"},"description":"Columns to include in a CSV export"}}}}},"required":true,"description":"Export filters"}}}}}
```

#### Retrieving the export

The endpoint returns immediately with a job ID:

```json
{ "job_id": "6810dec617eae6d55d7a5e5b" }
```

Poll it until the job completes:

```http
GET /api/v1/job_status/6810dec617eae6d55d7a5e5b
```

#### Notes

* Only one export job runs at a time per user. Starting a second while one is still in progress returns an error.
* Omit `account_id` for a workspace-wide export across every connected account.
* `columns[]` applies to CSV exports only.

#### Related Resources

* [Charts](/docs/analytics/charts.md) — Available analytics charts
* [Post Insights](/docs/analytics/post-insights.md) — Per-post performance


---

# 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://publer.com/docs/analytics/export.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.
