Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 242 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,147 @@ paths:
- rest_api_key: []
summary: Delete Segment
x-accepts: application/json
get:
description: "Retrieve details for a single segment by its ID, including subscriber\
\ count and optionally segment metadata and filters."
operationId: get_segment
parameters:
- description: The OneSignal App ID for your app. Available in Keys & IDs.
explode: false
in: path
name: app_id
required: true
schema:
example: YOUR_APP_ID
type: string
style: simple
- description: The segment's unique identifier. Can be found using the View
Segments API or in the URL of the segment when viewing it in the dashboard.
explode: false
in: path
name: segment_id
required: true
schema:
example: d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e
type: string
style: simple
- description: Set to true to include segment metadata and filters in the response.
explode: true
in: query
name: include-segment-detail
required: false
schema:
example: true
type: boolean
style: form
responses:
default:
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Unexpected error
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/GetSegmentSuccessResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Bad Request
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Not Found
"429":
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
description: Rate Limit Exceeded
security:
- rest_api_key: []
summary: View Segment
x-accepts: application/json
patch:
description: "Update an existing segment's name and/or filters. The name parameter\
\ is always required. When filters are provided, all existing filters are\
\ replaced with the new ones."
operationId: update_segment
parameters:
- description: The OneSignal App ID for your app. Available in Keys & IDs.
explode: false
in: path
name: app_id
required: true
schema:
example: YOUR_APP_ID
type: string
style: simple
- description: The segment's unique identifier. Can be found using the View
Segments API or in the URL of the segment when viewing it in the dashboard.
explode: false
in: path
name: segment_id
required: true
schema:
example: d6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSegmentRequest'
required: false
responses:
default:
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Unexpected error
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateSegmentSuccessResponse'
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Bad Request
"403":
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Forbidden
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/GenericError'
description: Not Found
"429":
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
description: Rate Limit Exceeded
security:
- rest_api_key: []
summary: Update Segment
x-content-type: application/json
x-accepts: application/json
/apps/{app_id}/outcomes:
get:
description: "View the details of all the outcomes associated with your app\n\
Expand Down Expand Up @@ -3574,6 +3715,107 @@ components:
$ref: '#/components/schemas/SegmentData'
type: array
type: object
SegmentDetails:
description: Segment details. Only included when the include-segment-detail
query parameter is set to true.
example:
name: name
description: description
created_at: 6
id: id
source: default
filters:
- null
- null
properties:
id:
description: The unique identifier for the segment (UUID v4).
type: string
name:
description: The segment name.
type: string
description:
description: Human-readable description for the segment. `null` when unset.
Maximum 255 characters.
nullable: true
type: string
created_at:
description: Unix timestamp when the segment was created.
type: integer
source:
description: The source of the segment.
enum:
- default
- custom
- quickstart
type: string
filters:
description: "Array of filter and operator objects defining the segment\
\ criteria. Uses the same format as the Create Segment API, so filters\
\ can be directly used to recreate or update the segment."
items:
$ref: '#/components/schemas/FilterExpression'
type: array
type: object
GetSegmentSuccessResponse:
example:
payload:
name: name
description: description
created_at: 6
id: id
source: default
filters:
- null
- null
subscriber_count: 0
properties:
subscriber_count:
description: The number of subscribers matching this segment.
type: integer
payload:
$ref: '#/components/schemas/SegmentDetails'
type: object
UpdateSegmentRequest:
example:
name: name
description: description
filters:
- null
- null
properties:
name:
description: Required. The segment name. Maximum 128 characters.
maxLength: 128
type: string
description:
description: Optional human-readable description for the segment. Maximum
255 characters. Pass an empty string to clear; omit to leave unchanged.
maxLength: 255
type: string
filters:
description: "Optional. When provided, replaces all existing filters. Filters\
\ define the segment based on user properties like tags, activity, or\
\ location using flexible AND/OR logic. Limited to 200 total entries,\
\ including fields and OR operators."
items:
$ref: '#/components/schemas/FilterExpression'
type: array
required:
- name
type: object
UpdateSegmentSuccessResponse:
example:
success: true
id: id
properties:
success:
description: "true if the segment was updated successfully, false otherwise."
type: boolean
id:
description: UUID of the updated segment.
type: string
type: object
UpdateLiveActivityRequest:
example:
event_updates: "{}"
Expand Down
Loading