Skip to main content
POST
/
notifications
/
{message_id}
/
export_events
Export audience activity CSV
curl --request POST \
  --url https://api.onesignal.com/notifications/{message_id}/export_events \
  --header 'Authorization: <authorization>'
{
  "csv_file_url": "<string>"
}

Overview

Get a CSV of per-recipient audience activity events (sends, clicks, failures, etc.) for a push, email, or SMS message. This endpoint mirrors the Export button in the dashboard’s Audience Activity section on each message report: The CSV schema varies by channel. See each channel’s message reports page for column definitions.

How to use this API

Get the message id from the Sending messages API or the View messages API. A successful request returns 200 OK with a csv_file_url:
200 OK
{
    "csv_file_url": "https://onesignal-data.onesignal.com/csv_exports/YOUR_APP_ID/events_audience-activity-YOUR_MESSAGE_ID-push-YYYY-MM-DDTHH-MM-SSTZ.csv.gz"
}
The generated file name follows the pattern events_audience-activity-{message_id}-{channel}-{timestamp}.csv.gz. The file is generated at ~2,000 records per second. For large audiences, generation can take several minutes, and the URL may return 404 until the file is ready:
404 Not Found
<Error>
  <Code>NoSuchKey</Code>
  <Message>The specified key does not exist.</Message>
</Error>
Poll the csv_file_url with GET and implement retries with exponential backoff. When the file is ready, the GET request downloads the .csv.gz file.
  • The CSV download URL is valid for 3 days after creation.
  • File names include a random UUID to prevent guessing.
Only one concurrent export is allowed per OneSignal account. Download the .csv.gz file before starting another export, or the new request fails.

Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key . See Keys & IDs.

Path Parameters

message_id
string
default:YOUR_NOTIFICATION_ID
required

The identifier of the message in UUID v4 format. Get this id in the response of your Create Message API request, the View Messages API, and in your OneSignal dashboard Message Reports.

Query Parameters

app_id
string
default:YOUR_APP_ID
required

Your OneSignal App ID in UUID v4 format. See Keys & IDs.

Response

200

csv_file_url
string

The URL to download the CSV file. The file is available for 3 days after generation.