Segments
Get Segments
Returns the saved segments available on a site: its own plus organization-wide ones. Callers without site access only see segments shown on the public dashboard.
GET /api/sites/:site/segmentsReturns the saved segments available on a site: its own plus organization-wide ones. Callers without site access only see segments shown on the public dashboard.
Path Parameters
Prop
Type
Response
Returns an array of segments, sorted by name.
Prop
Type
curl -X GET "https://app.onyxmetric.com/api/sites/1/segments" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://app.onyxmetric.com/api/sites/1/segments',
{
method: 'GET',
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://app.onyxmetric.com/api/sites/1/segments',
headers={'Authorization': 'Bearer your_api_key_here'}
)
data = response.json()[
{
"segmentId": 12,
"siteId": 1,
"organizationId": "org_abc123",
"userId": "user_xyz",
"name": "Mobile organic from Germany",
"description": null,
"filters": [
{ "parameter": "device_type", "type": "equals", "value": ["Mobile"] },
{ "parameter": "channel", "type": "equals", "value": ["Organic Search"] },
{ "parameter": "country", "type": "equals", "value": ["DE"] }
],
"isPublic": false,
"type": "segment",
"canEdit": true,
"createdAt": "2026-09-02T10:15:00.000Z",
"updatedAt": "2026-09-02T10:15:00.000Z"
}
]