View segment
View segment
Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.
GET
View segment
Documentation Index
Fetch the complete documentation index at: https://documentation.onesignal.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Retrieve details for a single segment by its ID. By default, this endpoint returns only the subscriber count. Use the optionalinclude-segment-detail parameter to also retrieve segment metadata and filters.
The
segment_id can be found using the View segments API or in the URL of the segment when viewing it in the dashboard.How to use this API
Basic usage
By default, this endpoint returns only the subscriber count for the segment:Include segment details
To retrieve full segment details including metadata and filters, setinclude-segment-detail=true:
payload object containing segment details:
Filters format
Thefilters array uses the same format as the Create segment API. This means you can:
- Read filters from this endpoint
- Modify them as needed
- Use them directly with the Update segment or Create segment APIs
| Field | Type | Description |
|---|---|---|
field | string | The filter type: tag, last_session, first_session, session_count, session_time, language, app_version, location, country, email |
relation | string | The comparison operator: >, <, =, !=, exists, not_exists, time_elapsed_gt, time_elapsed_lt |
value | string | The filter value (for most filter types) |
key | string | The filter key (required for tag filters) |
hours_ago | string | Hours ago value (for last_session/first_session filters) |
radius, lat, long | string | Location parameters (for location filters) |
unsupported_in_api | boolean | If true, this filter cannot be used with Create/Update segment APIs (see note below) |
| Field | Type | Description |
|---|---|---|
operator | string | Either AND or OR. Filters connected with AND have higher priority than OR. |
Payload fields
| Field | Type | Description |
|---|---|---|
id | string | The unique identifier for the segment (UUID v4). |
name | string | The segment name (max 128 characters). |
description | string | null | Human-readable description for the segment (max 255 characters). null when unset. |
created_at | integer | Unix timestamp when the segment was created. |
source | string | The source of the segment: default, custom, or quickstart. |
filters | array | Array of filter and operator objects that define the segment criteria. |
Headers
Your App API key with prefix Key. See Keys & IDs.
Path Parameters
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
The segment's unique identifier. Can be found using the View segments API or in the dashboard URL.
Query Parameters
Set to true to include segment metadata and filters in the response.