Skip to main content
POST
Export users CSV
Exporting users requires user-based segmentation, which is in beta. Functionality may change before general availability. To request access, contact support@onesignal.com.

Overview

Use this endpoint to export your Users as a GZip-compressed CSV file, with one row per user. The response returns a URL where the file is uploaded when the export finishes. To export one row per Subscription instead, use Export subscriptions CSV.

How to use this API

Authenticate with an App API key. Legacy (v1) API keys are rejected with a 400 error that starts with:
See Migrating from legacy API keys to create a replacement key. By default, the export includes every user in the app.

Optional filters

string
Only export users in this segment. Send the segment’s UUID, as returned by View segments. Cannot be sent with segment_name.
string
Only export users in the segment with this name. Cannot be sent with segment_id.
boolean
Set to true to include every user in the segment. Defaults to false when you send a segment, so the export only includes the segment’s subscribed users: users with a subscribed Subscription that matches the segment’s filters. Defaults to true when you do not send a segment, so the export includes every user in the app. Setting it to false without a segment exports only users with at least one subscribed Subscription. See Subscription statuses.
The columns are fixed. Sending extra_fields returns a 400 error. Other Export subscriptions CSV parameters, such as last_active_since, are ignored.

Example request

cURL

Example successful response

200 OK
The file name starts with onesignal_users_.

File readiness

  • The export runs in the background after the API responds. The csv_file_url returns 404 until the file is uploaded.
  • Poll the URL at intervals until the file downloads. Large apps take longer to export.
  • The file remains available for 3 days after generation.
  • Only one export per OneSignal account can run at a time. The limit is shared with Export subscriptions CSV. A request while another export is running returns 429.

CSV data contents

Every export has these columns, in this order. Empty cells mean the value is not set.

Errors

Error responses list messages in errors:
400 Bad Request

FAQ

Why does csv_file_url return 404?

The file is not ready yet. The export runs after the API responds, and the URL returns 404 until the upload finishes. Poll the URL until the file downloads.

Why did I get “This endpoint does not accept legacy (v1) API keys”?

The request used a legacy API key. Create an App API key and send it in the Authorization header as Key YOUR_APP_API_KEY.

How is this different from the subscriptions export?

The users export has one row per user with user-level data. The subscriptions export has one row per Subscription, with fields such as push token, email address, phone number, and device type.

Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key. Legacy (v1) API keys are rejected with a 400 error. See Keys & IDs.

Content-Type
string
default:application/json; charset=utf-8
required

Path Parameters

app_id
string
default:YOUR_APP_ID
required

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

Body

application/json
segment_id
string<uuid>

The ID of a segment to filter the export. Only users in this segment are included. Cannot be sent with segment_name. Omit both fields to export all users in the app.

segment_name
string

The name of a segment to filter the export. Only users in this segment are included. Cannot be sent with segment_id.

include_unsubscribed
boolean

Set to true to include every user in the segment. Defaults to false when a segment is provided, so only users with a subscribed Subscription that matches the segment's filters are exported. Defaults to true when no segment is provided.

Response

200

csv_file_url
string

The URL to download the CSV file. The URL returns 404 until the file is ready. The file is available for 3 days after generation.