openapi: 3.0.0
info:
contact:
email: devrel@onesignal.com
name: OneSignal DevRel
url: https://onesignal.com
description: A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
termsOfService: https://onesignal.com/tos
title: OneSignal Players API
version: 5.5.0
servers:
- url: https://api.onesignal.com
tags:
- name: Players
paths:
/players/csv_export?app_id={app_id}:
post:
description: "Generate a compressed CSV export of all of your current user data\nThis 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.\nThe file will be compressed using GZip.\nThe file may take several minutes to generate depending on the number of users in your app.\nThe URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable.\n🚧\n403 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.\n🚧\nRequires Authentication Key\nRequires your OneSignal App's REST API Key, available in Keys & IDs.\n🚧\nConcurrent Exports\nOnly one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app.\nCSV File Format:\n- Default Columns:\n | Field | Details |\n | --- | --- |\n | id | OneSignal Player Id |\n | identifier | Push Token |\n | session_count | Number of times they visited the app or site\n | language | Device language code |\n | timezone | Number of seconds away from UTC. Example: -28800 |\n | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. |\n | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 |\n | device_type | Device Operating System Type |\n | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` |\n | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. |\n | tags | Current OneSignal Data Tags on the device. |\n | last_active | Date and time the user last opened the mobile app or visited the site. |\n | playtime | Total amount of time in seconds the user had the mobile app open. |\n | amount_spent | \tMobile only - amount spent in USD on In-App Purchases. | \n | created_at | Date 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. |\n | invalid_identifier | t = unsubscribed, f = subscibed |\n | badge_count | Current number of badges on the device |\n- Extra Columns:\n | Field | Details |\n | --- | --- |\n | external_user_id | Your User Id set on the device |\n | notification_types | Notification types |\n | location | Location points (Latitude and Longitude) set on the device. |\n | country | Country code |\n | rooted | Android device rooted or not |\n | ip | IP Address of the device if being tracked. See Handling Personal Data. |\n | web_auth | Web Only authorization key. |\n | web_p256 | Web Only p256 key. |\n"
operationId: export_subscriptions
parameters:
- description: The app ID that you want to export devices from
explode: false
in: path
name: app_id
required: true
schema:
type: string
style: simple
requestBody:
$ref: '#/components/requestBodies/export_subscriptions_request_body'
content:
application/json:
schema:
properties:
extra_fields:
description: Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256.
items:
type: string
type: array
last_active_since:
description: Export all devices with a last_active timestamp greater than this time. Unixtime in seconds.
type: string
segment_name:
description: Export all devices belonging to the segment.
type: string
title: export_subscriptions_request_body
type: object
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExportSubscriptionsSuccessResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Bad Request
'429':
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
description: Rate Limit Exceeded
security:
- rest_api_key: []
summary: Export CSV of Subscriptions
tags:
- Players
components:
schemas:
GenericError:
properties:
errors: {}
success:
type: boolean
reference: {}
type: object
export_subscriptions_request_body:
properties:
extra_fields:
description: Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256.
items:
type: string
type: array
last_active_since:
description: Export all devices with a last_active timestamp greater than this time. Unixtime in seconds.
type: string
segment_name:
description: Export all devices belonging to the segment.
type: string
title: export_subscriptions_request_body
type: object
ExportSubscriptionsSuccessResponse:
example:
csv_file_url: csv_file_url
properties:
csv_file_url:
type: string
type: object
RateLimitError:
properties:
errors:
items:
type: string
type: array
limit:
type: string
type: object
requestBodies:
export_subscriptions_request_body:
content:
application/json:
schema:
$ref: '#/components/schemas/export_subscriptions_request_body'
securitySchemes:
rest_api_key:
scheme: bearer
type: http
organization_api_key:
scheme: bearer
type: http