Generate a compressed CSV report of all of the events data for a notification.

Overview

This API provides the same data exportable from within the dashboard Audience Activity section when clicking a message report. The CSV provides different data depending on the channel.

For details on each type of data, see:


How to use this API

You will need to know the "id" of the message you want to export data from. This is the same as the "id" provided in the response when using the Create message or View Messages APIs.

After you make this request, you will likely get a 200 OK response with a csv_file_url.

{
    "csv_file_url": "https://onesignal-data.onesignal.com/csv_exports/YOUR_APP_ID/events_audience-activity-YOUR_MESSAGE_ID-push-2024-10-21T06-49-23PMUTC.csv.gz"
}

Depending on how large the file is, the URL may 404 with the following error:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
</Error>

On average, the file is generated at a rate of 2,000 records per second. You will need to setup a period retries depending on the file size.

After the file is generated, it can be accessible via the URL for 3 days. The filename includes random v4 uuid as part of the resource name to be unguessable.

📘

404 error response

You can check if the file is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many records are being pulled. If the file is not ready, a 404 error will be returned. In which case, you set setup a retry to pull again after some time has passed. Otherwise the file itself will be returned.


📘

Concurrent Exports

Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app.


CSV data

The CSV will contain the following data.

  • external_user_id = maps to the External ID. See Users.
  • subscription_id = maps to the Subscription ID. See Subscriptions.
  • device_type = the platform the subscription is for.
  • sent = the date and time the message was sent from OneSignal.
  • delivered = the date and time the message was confirmed delivered. See Confirmed Delivery.
  • clicked = the date and time the message was clicked.
  • onesignal_id = maps to the OneSignal ID. See Users.
  • failed = the date and time the message failed to send.
  • unsubscribed = the date and time the Subscription was marked as unsubscribed.
  • failure_message = the reason for the failed status.
Language