GET
/
apps
/
{app_id}
/
segments
View segments
curl --request GET \
  --url https://api.onesignal.com/apps/{app_id}/segments \
  --header 'Authorization: <authorization>'
"{\n    \"total_count\": 1,\n    \"offset\": 0,\n    \"limit\": 300,\n    \"segments\": [\n        {\n            \"id\": \"4414c404-56a3-11ed-9b6a-0242ac120002\",\n            \"name\": \"Subscribed Users\",\n            \"created_at\": \"2022-07-23T13:44:10.324Z\",\n            \"updated_at\": \"2022-09-18T11:33:02.451Z\",\n            \"app_id\": \"65c10914-56a3-11ed-9b6a-0242ac120002\",\n            \"read_only\": false,\n            \"is_active\": true\n        }\n    ]\n}"

Overview

Retrieve a list of segments associated with a specific OneSignal app. This is helpful when you want to access segment metadata programmatically instead of using the OneSignal Dashboard UI.

This endpoint only retrieves existing segment metadata. It does not provide the segment filters or user data.


Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

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

Path Parameters

app_id
string
default:YOUR_APP_ID
required

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

Query Parameters

offset
integer
default:0

The index to start returning segments from. Defaults to 0. Segments are sorted by their creation date (created_at) in ascending order.

limit
integer
default:300

The maximum number of segments to return. Default/Max: 300. Ideal for controlling data volume in large-scale applications.

Response

200
application/json

200

The response is of type object.