Segments

List segments

Segments of the site in ascending order of id (order=newest for the latest first), each with its name, conditions and folder. Call it to find a segment by name or to get a segment_id: list_contacts takes segment_id to list the contacts in the segment, and contact statistics (get_contacts_stats) take it to count them. A segment stores no list of contacts: its conditions are applied at the moment it is used. Filters combine: every one given must match.

A page holds up to limit segments; while next_cursor is set, pass it as cursor for the next page.

get/v1/sites/{site_id}/segments

Request

  • Base URL
    https://api.getsitecontrol.com
  • Auth
    HTTP bearer

Path parameters

site_idinteger required

Query parameters

searchstring

Part of the name, without case; % and _ are plain characters. Digits also match the id

folder_idinteger

Only the items of this folder, an id from list_folders; 0 is General

cursorstring

next_cursor of the previous page, sent with the same order; omit for the first

limitinteger

Items per page

fieldsstring

Comma-separated fields to keep in each item, for example id,name; each item then carries only those fields and id. Omit for every field

order'oldest' | 'newest'

Order of a list. oldest: the oldest item first; newest: the newest item first, for the latest items without paging through the history.

Order of the items: oldest first (default) or newest first; asc and desc mean the same

Response

Successful Response

next_cursorstring nullable

Example response

{
  "items": [
    {
      "conditions": {
        "op": "and",
        "args": [
          {
            "op": "and",
            "args": [
              {
                "op": "=",
                "args": [
                  "{{$contact.isSubscribed}}",
                  "S"
                ]
              },
              {
                "op": "ina",
                "args": [
                  "{{$contact.tags}}",
                  [
                    12,
                    15
                  ]
                ]
              }
            ]
          },
          {
            "op": "or",
            "args": [
              {
                "op": ">",
                "args": [
                  "{{$contact.date}}",
                  "2026-01-01"
                ]
              },
              {
                "op": "in",
                "args": [
                  "{{$contact.email}}",
                  "@example.com"
                ]
              }
            ]
          }
        ]
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.