# CSV exports

> Download the same CSV files as the Export buttons in the app.

## GET /api/v2/exports/{dataset}

Returns one of the app's CSV downloads as a file. The columns, values and filters are the same as the matching **Export** button in the app, because the app's buttons download from this endpoint too. Money is in dollars with a Currency column, and dates are days in your organization's time zone. Over MCP the same files come from the [`export_csv` tool](https://www.trackagoat.com/docs/agents/mcp.md#exporting-csvs).

Requires the `read` scope. Each call counts as one API request.

### Datasets

| `dataset` | In the app | Filters |
|-----------|------------|---------|
| `creators` | Creators page | `search`, `compliance`, `disabled_only`, `include_compliance`, `campaign_id`, `platform` |
| `videos` | Videos page | `status`, `creator_id`, `campaign_id`, `platform`, `from`, `to`, `search`, `sort_by`, `sort_dir` |
| `campaigns` | Campaigns page | none |
| `goals` | Goals page | `period`, `reference_date`, `campaign_id` |
| `campaign_leaderboard` | Campaign Insights leaderboard | `from`, `to`, `campaign_id`, `platform` |
| `payout_tracker` | Payouts, **Tracker summary CSV** | `creator_ids`, `structure_id`, `campaign_id`, `from`, `to`, `outstanding_only`, `include_removed` |
| `payout_payments` | Payouts and a creator's Payouts tab, **Payments CSV** | `creator_ids`, `campaign_id`, `from`, `to` |
| `payout_accruals` | Payouts and a creator's Payouts tab, **Accruals CSV** | `creator_ids`, `structure_id`, `campaign_id`, `from`, `to`, `outstanding_only`, `include_removed` |
| `analytics` | Insights charts, **Download CSV** | The parameters of [`GET /api/v2/analytics`](https://www.trackagoat.com/docs/api-reference/analytics.md) except `format` |

Every dataset except `analytics` needs `project_id`. A filter the dataset doesn't take is rejected with `400 invalid_params`, so a typo never silently exports the whole project.

### Filters

| Parameter | Datasets | Description |
|-----------|----------|-------------|
| `project_id` | all but `analytics` | The project to export. |
| `campaign_id` | most | Only the campaign's creators, videos or payouts. Sub-campaigns are included. |
| `creator_id` | `videos` | Only this creator's videos. |
| `creator_ids` | `payout_*` | Comma-separated creator ids. |
| `platform` | `creators`, `videos`, `campaign_leaderboard` | `tiktok` or `instagram`. |
| `from`, `to` | `videos`, `campaign_leaderboard`, `payout_*` | `YYYY-MM-DD`, days in your org's time zone, both inclusive. `videos` filters on the posted date. `campaign_leaderboard` defaults to the last 30 days. |
| `status` | `videos` | A tracking status (`auto_tracked`, `direct_add`, `included`, `excluded`, `pending_review`) or `tracking_disabled`, `tracking_exempted`, `plan_limit_paused`, `expiring_soon`. Default: every status except `pending_review`. |
| `search` | `creators`, `videos` | Creators: name or handle contains. Videos: title contains. |
| `sort_by`, `sort_dir` | `videos` | Sort column (`posted_at`, `view_count`, `like_count`, `comment_count`, `share_count`, `save_count`, `duration_seconds`) and `asc` or `desc`. Default `posted_at`, `desc`. |
| `compliance` | `creators` | Only creators whose worst goal status this period is `completed`, `on_track`, `behind_pace`, `at_risk`, `missed` or `no_goals`. |
| `disabled_only` | `creators` | `true`: only auto-disabled creators. |
| `include_compliance` | `creators` | `true`: fill the Compliance column without filtering on it. |
| `period`, `reference_date` | `goals` | `daily`, `weekly` (default) or `monthly`, and any day in the period to export (default today). |
| `structure_id` | `payout_tracker`, `payout_accruals` | Only this payout structure. |
| `outstanding_only` | `payout_tracker`, `payout_accruals` | `true`: only creators still owed, or only unpaid accruals. Default `false`. |
| `include_removed` | `payout_tracker`, `payout_accruals` | `true`: include removed creators. Default `false`. |

### Large exports

Exports are complete: they're never cut off at a row limit. The whole file comes back by default. To get it in pages, pass `limit` (rows) and/or `max_bytes`, then call again with `offset` set to the `X-Next-Offset` header until that header is missing. Every page starts with the header row, and rows are never split.

| Response header | Meaning |
|-----------------|---------|
| `Content-Disposition` | `attachment` with the suggested file name, e.g. `videos-<projectId>-2026-10-11.csv` |
| `X-Total-Rows` | Rows matching the filters |
| `X-Row-Count` | Rows in this response |
| `X-Offset` | The first row in this response |
| `X-Next-Offset` | Where the next page starts. Only present when more rows remain. |
| `X-Columns` | Number of columns |

### Request

```bash
curl -o sep-payouts.csv \
  -H "Authorization: Bearer tga_..." \
  "https://www.trackagoat.com/api/v2/exports/payout_tracker?project_id=<uuid>&from=2026-09-01&to=2026-09-30"
```

### Response

`200` with `Content-Type: text/csv; charset=utf-8`:

```csv
Handle,Display Name,Total Earned,Total Paid,Outstanding,Currency,Last Paid At,Outstanding Accruals,Active Structures,Is Removed,Outstanding Supplementals,Adjustments,Adjustment Reasons
creator_one,Creator One,250.00,200.00,50.00,USD,2026-09-30T17:02:11.000Z,1,2,false,0,0.00,
```

The creators, videos, campaigns and payouts files start with a UTF-8 byte-order mark and use CRLF line endings so they open correctly in Excel and Numbers. The goals, leaderboard and analytics files have neither, as they always have.

Errors use the usual JSON envelope, for example `404 unknown_dataset` (with the valid datasets in `meta.datasets`), `400 invalid_params`, `403 insufficient_scope`, or `404` when the project or campaign isn't in your organization.

---
Source: https://www.trackagoat.com/docs/api-reference/exports
