List segments

Segments of the shop from Messaging > Segments, with their Segment Size.

GET https://cotlet.dev/api/v1/postscript/segments

read

Returns the segments on the Segments page, including the default ones such as All Customers and Subscribers (INTL Included). size is the Segment Size Postscript shows; it refreshes daily for segments used in a campaign in the last 30 days and is otherwise as of the last manual refresh. Unsubscribed people are never counted. Use segment names as include_segments and exclude_segments of create_campaign.

Parameters

Parameters: list_segments
NameTypeDescription
search string string Only segments whose name contains this text.

Request

cURL
curl https://cotlet.dev/api/v1/postscript/segments \
  -H "Authorization: Bearer $COTLET_API_KEY"
Python
result = client.call("postscript", "list_segments")
Node.js
const result = await cotlet.call('postscript', 'list_segments');
CLI
cotlet call postscript list_segments

Example response

JSON

{
  "segments": [
    {
      "segment_id": "41872",
      "name": "All Customers and Subscribers (INTL Included)",
      "size": 18240
    },
    {
      "segment_id": "52310",
      "name": "Subscribers with No Orders",
      "size": 5127
    }
  ]
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.