Public API
Segments

On this page
- GET /api/v1/public/apps/{app}/environments/{environment}/segments
- POST /api/v1/public/apps/{app}/environments/{environment}/segments
- POST /api/v1/public/apps/{app}/environments/{environment}/segments/bulk
- POST /api/v1/public/apps/{app}/environments/{environment}/segments/preview
- DELETE /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
- GET /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
- PATCH /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
Audiences for one app and environment.
These routes are the public API. Send Authorization: Bearer with a workspace server API key. The key can act on every app in the workspace. A route that names an app uses that app id. environment is development or production.
GET /api/v1/public/apps/{app}/environments/{environment}/segments
The segments were listed.
Path
app— App id in this workspace.environment—developmentorproduction.
Responses
200SEGMENTS_LISTED— The segments were listed.401INVALID_API_KEY— The API key is invalid.404APP_NOT_FOUND— The app could not be found.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
POST /api/v1/public/apps/{app}/environments/{environment}/segments
The segment was created.
Path
app— App id in this workspace.environment—developmentorproduction.
Body
name(string, required)
Responses
201SEGMENT_CREATED— The segment was created.401INVALID_API_KEY— The API key is invalid.404APP_NOT_FOUND— The app could not be found.422VALIDATION_FAILED— The request contains invalid fields.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
POST /api/v1/public/apps/{app}/environments/{environment}/segments/bulk
The segments were deleted.
Path
app— App id in this workspace.environment—developmentorproduction.
Body
ids(array of string, required)
Responses
200SEGMENTS_DELETED— The segments were deleted.401INVALID_API_KEY— The API key is invalid.404APP_NOT_FOUND— The app could not be found.422VALIDATION_FAILED— The request contains invalid fields.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
POST /api/v1/public/apps/{app}/environments/{environment}/segments/preview
The audience was counted.
Path
app— App id in this workspace.environment—developmentorproduction.
Responses
200SEGMENT_PREVIEWED— The audience was counted.count(integer, required)
401INVALID_API_KEY— The API key is invalid.404APP_NOT_FOUND— The app could not be found.422VALIDATION_FAILED— The request contains invalid fields.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
DELETE /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
The segment was deleted.
Path
app— App id in this workspace.environment—developmentorproduction.segment— Segment id or automatic audience id.
Responses
200SEGMENT_DELETED— The segment was deleted.id(string, required)
401INVALID_API_KEY— The API key is invalid.404APP_NOT_FOUND— The app could not be found.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
GET /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
The segment was found.
Path
app— App id in this workspace.environment—developmentorproduction.segment— Segment id or automatic audience id.
Responses
200SEGMENT_FETCHED— The segment was found.401INVALID_API_KEY— The API key is invalid.404SEGMENT_NOT_FOUND— The segment could not be found.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
PATCH /api/v1/public/apps/{app}/environments/{environment}/segments/{segment}
The segment was updated.
Path
app— App id in this workspace.environment—developmentorproduction.segment— Custom segment id.
Body
name(string, required)
Responses
200SEGMENT_UPDATED— The segment was updated.401INVALID_API_KEY— The API key is invalid.404SEGMENT_NOT_FOUND— The segment could not be found.422VALIDATION_FAILED— The request contains invalid fields.429RATE_LIMIT_EXCEEDED— Too many requests. Please try again later.500SERVER_ERROR— Something went wrong. Please try again.
