Download an event export
Download a finished event export with the wemail API. Returns a short-lived signed URL for the CSV the export job generated from your filters.
Streams the CSV with a Content-Disposition: attachment header — pipe it straight to a file (curl -o events.csv …) or load it into your warehouse. Available once the export status is completed, until it expires (7 days after completion).
GET /v3/events/export/{id}/download
Responses
| Status | Description |
|---|---|
200 | The CSV file (text/csv). |
404 | No such export, not finished yet, or expired (exports are kept for 7 days). |
Code examples
cURL
curl -L -o events.csv \
https://api.wemail.io/v3/events/export/$EXPORT_ID/download \
-H "Authorization: Bearer afn_live_…"Node.js
import { writeFileSync } from "node:fs";
import { WemailClient } from "@wemailio/sdk";
const wemail = new WemailClient(process.env.WEMAIL_API_KEY);
const csv = await wemail.events.downloadEventExport({ id: exportId }); // Blob
writeFileSync("events.csv", Buffer.from(await csv.arrayBuffer()));Python
import os
from wemail import WemailClient
wemail = WemailClient(api_key=os.environ["WEMAIL_API_KEY"])
csv_bytes = wemail.events.download_event_export(export_id)
with open("events.csv", "wb") as f:
f.write(csv_bytes)