Segments
Get Segment
Returns one saved segment.
GET /api/sites/:site/segments/:segmentIdReturns one saved segment.
Path Parameters
Prop
Type
Response
Returns the segment.
Prop
Type
curl -X GET "https://app.onyxmetric.com/api/sites/1/segments/12" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://app.onyxmetric.com/api/sites/1/segments/12',
{
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/12',
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"
}Get SegmentsGET
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.
Create SegmentPOST
Creates a saved segment. Members create site segments they own; admins and owners can also create organization-wide segments.