---
title: "Export messaging analytics data"
method: POST
path: "/v1/analytics/export"
tags: ["Analytics"]
---

# Export messaging analytics data

`POST /v1/analytics/export`

## Request

- Base URL: `https://api.samva.dev`
- URL: `https://api.samva.dev/v1/analytics/export`
- Auth: API key in header `x-api-key`

Exports one record per outbound message accepted in the given date range as CSV or JSON and returns the file content inline. CSV follows RFC 4180: fields containing a quote, comma, or line break are quoted with embedded quotes doubled, and records are separated by CRLF. At most 10,000 records are returned, newest first.

## Request body

- object
  - `after` string, required
  - `before` string, required
  - `format` 'csv' | 'json', nullable
  - `includeChannels` string[], nullable

## Response `200`

Success

- object
  - `content` string, required
  - `mimeType` string, required
  - `filename` string, required

## Other responses

- `400`: AnalyticsQueryError
- `401`: UnauthorizedError
- `403`: ForbiddenError
- `422`: ValidationError
- `500`: InternalError
- `504`: GatewayTimeoutError

---

[API](https://skmtc.dev/samva/apis/samva-api.md) · [All operations](https://skmtc.dev/samva/apis/samva-api/llms.txt) · [OpenAPI document](https://skmtc.dev/samva/apis/samva-api/revisions/a99408542cc3?raw)
