OnyxMetric
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/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.

Path Parameters

Prop

Type

Response

Returns an array of segments, sorted by name.

Prop

Type

Request
curl -X GET "https://app.onyxmetric.com/api/sites/1/segments" \
  -H "Authorization: Bearer your_api_key_here"
Request
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();
Request
import requests

response = requests.get(
    'https://app.onyxmetric.com/api/sites/1/segments',
    headers={'Authorization': 'Bearer your_api_key_here'}
)

data = response.json()
Response
[
  {
    "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"
  }
]