# Reports

An Excel or CSV file for one campaign, built on the server and downloaded through a link.

## Create a report

`GET /v1/campaigns/{id}/report`

Requires the `content:read` scope. The server builds the full file for one campaign, then answers with a download link. The contents are not in the response, which suits campaigns with thousands of pieces of content and AI assistants.

| Parameter | Type | Contents |
| --- | --- | --- |
| `format` | string | `xlsx` or `csv`, default `xlsx` |
| `status` | string | `approved`, `pending_review`, `rejected`, or `all`, default `approved` |

| Field | Contents |
| --- | --- |
| `url` | Download link, valid for 24 hours |
| `expires_at` | When the link expires |
| `rows` | Number of pieces of content in the file |
| `truncated` | `true` when content exceeds 20,000 rows, the file then holds those with the most views |
| `reused` | `true` when a file made less than 60 minutes ago was reused |

```bash
curl "https://api.wefluence.app/v1/campaigns/abc123/report?format=xlsx" \
  -H "Authorization: Bearer $WEFLUENCE_API_KEY"
```
```python
report = requests.get(
    f"{API}/campaigns/abc123/report",
    headers=HEADERS,
    params={"format": "xlsx"},
).json()

file = requests.get(report["url"])
open(report["file_name"], "wb").write(file.content)
```
```javascript
const report = await (await fetch(`${API}/campaigns/abc123/report?format=xlsx`, { headers })).json();
const file = await fetch(report.url);
```
```json
{
  "object": "report",
  "campaign_id": "abc123",
  "format": "xlsx",
  "status": "approved",
  "rows": 1248,
  "truncated": false,
  "file_name": "october-campaign.xlsx",
  "url": "https://api.wefluence.app/v1/reports/rpt_Zk3v...",
  "expires_at": "2026-11-04T09:00:00.000Z",
  "reused": false
}
```
## Download the file

`GET /v1/reports/{token}`

No key needed, so the link opens directly in a browser or can be handed to you by an AI assistant. Treat the link like the file itself: anyone who holds it can download until `expires_at`. The link stops working early if the key that created it is revoked.

## Excel file contents

The sheets inside the file are named in Indonesian.

| Sheet | Contents | Available to |
| --- | --- | --- |
| Ringkasan (Summary) | Total views, interactions, engagement rate, creator count, platform breakdown | Any key |
| Konten teratas (Top content) | Every piece of content with views, likes, comments, shares, scan time, status, and link | Any key |
| Performa kreator (Creator performance) | Views, interactions, engagement, content count, and each creator's contribution | Any key |
| Performa kampanye (Campaign performance) | Budget, remaining budget, status, and deadline | `finance:read` |

With `finance:read`, the Summary sheet also shows budget, paid to creators, remaining budget, and cost per 1,000 views, and Creator performance shows each creator's earnings.

## CSV file contents

One row per piece of content, in UTF-8. Column names match the API so they are easy to map:

`id`, `creator_name`, `creator_ref`, `platform`, `url`, `status`, `views`, `views_flagged`, `likes`, `comments`, `shares`, `scanned_at`, `submitted_at`, `reviewed_at`

## Limits

One key can create 30 reports per day. The same request within 60 minutes reuses the existing file and is not counted again.
