Generate a compressed CSV export of all of your current user data

This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint.

The file will be compressed using GZip.

The file may take several minutes to generate depending on the number of users in your app.

The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable.

🚧

403 Error Responses

You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned.

🚧

Requires Authentication Key

Requires your OneSignal App's REST API Key, available in Keys & IDs.

🚧

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.

Query Parameters

ParameterTypeDescription
app_idStringRequired: The app ID that you want to export devices from

Body Parameters - CSV export

ParameterTypeDescription
extra_fieldsArray of StringsAdditional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256.
last_active_sinceUnixtime in SecondsExport all devices with a last_active timestamp greater than this time.
segment_nameStringExport all devices belong to the segment

Example Code - CSV export

curl -X POST -H "Authorization: Basic YOUR_REST_API_KEY" -H "Content-Type: application/json" -d '{
    "extra_fields": ["country","notification_types","external_user_id", "location", "rooted", "ip", "country", "web_auth", "web_p256"],
    "last_active_since": "1469392779",
    "segment_name": "Subscribed Users"
}' "https://onesignal.com/api/v1/players/csv_export?app_id=YOUR_APP_ID"
<?php
  function oneSignalApi() {
    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://onesignal.com/api/v1/players/csv_export?app_id=YOUR_APP_ID",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_HTTPHEADER => array(
        "Authorization: Basic YOUR_REST_API_KEY",
        "Content-Type: application/json"
      ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);
    echo $response;
  }
oneSignalApi() ;
?>

Result Format - CSV export

{ "csv_file_url": "https://onesignal.com/csv_exports/b2f7f966-d8cc-11e4-bed1-df8f05be55ba/users_184948440ec0e334728e87228011ff41_2015-11-10.csv.gz" }
{}
Default ColumnsDetails
idOneSignal Player Id
identifierPush Token
session_countNumber of times they visited the app or site
languageDevice language code
timezoneNumber of seconds away from UTC. Example: -28800
game_versionVersion of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode.
device_osDevice Operating System Version. Example:
80 = Chrome 80, 9 = Android 9
device_typeDevice Operating System Type. See device_type for Integer Value codes. Example:
0 = iOS mobile app, 1 = Android mobile app, 5 = Chrome Web Push
device_modelDevice Hardware String Code.
Example:
Mobile Web Subscribers will have Linux armv
iOS Hardware Strings
ad_idBased on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device.
tagsCurrent OneSignal Data Tags on the device.
last_activeDate and time the user last opened the mobile app or visited the site.
playtimeTotal amount of time in seconds the user had the mobile app open.
amount_spentMobile only - amount spent in USD on In-App Purchases. More details.
created_atDate and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site.
invalid_identifiert = unsubscribed
f = subscibed
badge_countCurrent number of badges on the device

Extra Fields - CSV export

extra_fieldsDetails
external_user_idYour User Id set on the device.
notification_typesCheck this value if invalid_identifier is t (true) to know why the device is unsubscribed.

1 = subscribed
-2 = unsubscribed, via SDK method or REST API
null = default, if invalid_identifier is t (true) and identifier is null then device was never subscribed
0 = permission not granted.
-3 = missing_android_support_library
-4 = missing_google_play_services_library
-5 = outdated_android_support_library
-6 = invalid_google_project_number
-7 = outdated_google_play_services_app
-8 = google_play_services_library_error
-9 = GSM_SERVICE_NOT_AVAILABLE
-10= Web push blocked notifications, cleared all data and workers, Android, iOS, and WP uninstalled app
-11 = google_play_services_library_error # Google Play services returned an IOException error, check logcat
-12 = google_play_services_library_error # Google Play services returned unknown error, check logcat
-13 = iOS missing_push_capability
-14 = iOS apns_delegate_never_fired
-15 = ios_simulator_unsupported
-16 = iOS unknown_apns_error_response
-17 = iOS other_apns_3000_error
-18 = iOS never_prompted
-19 = iOS prompted_but_never_answered
-20 = temp_web_record
-21 = Web, pushsubscriptionchange permission revoked
-22 = Email, unsubscribed via dashboard, manually_unsubscribed
-23 = Web service_worker_403
-24 = Web service_worker_404

The secondary use of this field is for iOS devices (device_type = 0).
For numbers greater than zero for iOS devices this indicates the notification options enabled for your app as bitflags.

bit 0 - badges
bit 1 - sounds
bit 2 - alert
bit 3 - lockscreen
Example: 31 = all the iOS notification settings are on. badges, sounds, banner, etc

See the OneSignal-iOS-SDK Source for more details on these iOS bitflags.
locationLocation points (Latitude and Longitude) set on the device.
countryCountry code
rootedAndroid device rooted or not
ipIP Address of the device if being tracked. See Handling Personal Data.
web_authWeb Only authorization key.
web_p256Web Only p256 key.
Language