Get all segments
GET <your-unleash-url>/api/admin/segments
Authorization
name: Authorizationtype: apiKeyin: header
Retrieves all segments that exist in this Unleash instance.
Request
Responses
- 200
segmentsSchema
- application/json
- Schema
- Example (from schema)
Schema
segments object[]
{
"segments": [
{
"id": 2,
"name": "ios-users",
"description": "IOS users segment",
"constraints": [
{
"contextName": "appName",
"operator": "IN",
"caseInsensitive": false,
"inverted": false,
"values": [
"my-app",
"my-other-app"
],
"value": "my-app"
}
],
"usedInFeatures": 3,
"usedInProjects": 2,
"project": "red-vista",
"createdBy": "someone@example.com",
"createdAt": "2023-04-12T11:13:31.960Z"
}
]
}
Authorization
name: Authorizationtype: apiKeyin: header
Request
Request
curl / cURL
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
python / requests
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
go / native
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
nodejs / axios
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
ruby / Net::HTTP
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
csharp / RestSharp
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
php / cURL
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
java / OkHttp
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
powershell / RestMethod
curl -L -X GET '<your-unleash-url>/api/admin/segments' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'