List segments

GET/api/v1/segments
Requires anorganization API keywith the scopecontacts:read

Request

GET/api/v1/segments
curl -X GET 'https://app.mailyte.com/api/v1/segments' \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataarray<object>
    • objectstringsegment
    • idstring

      Unique identifier for the segment.

    • namestring
    • descriptionstring

      Your note on what the segment is for. Null when none was written. It does not affect the rules.

    • matchstringall | any

      How the rules combine: all of them must hold, or any one.

    • rulesarray<object>

      The segment's rules, as you wrote them.

      • fieldstring

        What the rule tests: email, name or status; opened, clicked or emailed (from email activity); or any key in the contact's fields. status is the stored status, not the contact's state.

      • opstringequals | not_equals | contains | not_contains | is_set | is_not_set | starts_with | ends_with | greater_than | less_than | before | after | within_days | not_within_days

        How the rule compares. - within_days, not_within_days: only with opened, clicked or emailed. not_within_days includes contacts never emailed. - greater_than, less_than: compare as numbers. - before, after: compare as dates. - starts_with, ends_with: match the start or end of the value, not anywhere in it. A value that cannot be read as the right type matches nothing.

      • valuestring

        What to compare with. Null for is_set and is_not_set; a number of days from 1 to 365 for the activity operators.

    • contact_countinteger

      LIVE. A segment is a query, so this is what the rules match now, not what they matched when it was saved. Always an integer.

    • created_atstring
    • updated_atstring

Returned inside the standard envelope.

Errors

StatusWhen
401The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist.
403The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys.
404No such resource in this organization.
422The request was understood but the values were not acceptable.
429Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait.

Every status, with what causes it and what to do, is on the error reference.