Get segments

Retrieve a list of available data source logins (authentications) and their segments.

GET https://api.supermetrics.com/enterprise/v2/query/segments
  • api_key string
    Conditional. API key when not using an authorization header. See authentication for more.
  • ds_id string
    Required. Data source ID. See data sources for more.
  • ds_users string | string[]
    Optional. List of data source login usernames to target. Case-insensitive.
  • cache_minutes integer
    Optional. Maximum allowed age of cache in minutes. Defaults to none for last fetched information. Value range of 60 minutes and 1440 minutes is enforced. Minimum and maximum values are subject to license restrictions.
Request
GET https://api.supermetrics.com/enterprise/v2/query/segments?json={
    "api_key": "<api key>",
    "ds_id": "GA",
    "ds_users": "info@supermetrics.com"
}
Response
PropertyTypeDescription
meta > request_idstring API request ID
meta > query > cache_minutesinteger Requested maximum age of cache in minutes with minimum and maximum value enforced. Defaults to null.
data > * > ds_userstring Data source login username. Can be used as optional ds_user parameter in queries.
data > * > display_namestring Display name for login
data > * > cache_timestring ISO 8601 datetime for the last time the login data was fetched and cached. Defaults to null when no cache was used.
data > * > segments > * > segment_idstring Segment ID
data > * > segments > * > segment_idstring Segment name
HTTP 200 OK
{
    "meta": {
        "request_id": "CLg60nHFw2LCOmM7mMfgVgpuURpr00iY",
        "query": {
            "cache_minutes": null
        }
    },
    "data": [
        {
            "ds_user": "35168435154",
            "display_name": "info@supermetrics.com (ID: 35168435154)",
            "cache_time": "2020-09-05T13:30:52+00:00",
            "segments": [
                {
                    "segment_id": "-1",
                    "segment_name": "All Users"
                },
                {
                    "segment_id": "-2",
                    "segment_name": "New Users"
                },
                {
                    "segment_id": "-3",
                    "segment_name": "Returning Users"
                },
                {
                    "segment_id": "-4",
                    "segment_name": "Paid Traffic"
                },
                {
                    "segment_id": "-5",
                    "segment_name": "Organic Traffic"
                },
                {
                    "segment_id": "-6",
                    "segment_name": "Search Traffic"
                },
                {
                    "segment_id": "-7",
                    "segment_name": "Direct Traffic"
                }
            ]
        }
    ]
}
Last updated 2022-06-22 UTC.