Get Segment List

Pulls a list of segments available and/or defined on Punchh, allowing for browsing/selecting of Punchh segments natively in an external platform. Segment search is on a business level, and the request can:

  • Set search limits and order by desc search
  • Search based on name or segment type filter
  • Filter based on name or description

For more information, see Headless Offers Management - Distribution

Adding Users to a Segment

You can add a user to the segment using either email or user_id. See Add User to a Custom Segment.

You can also add users in bulk to a custom segment by uploading a CSV file that contains a list of users and their details. See Bulk Add Users to a Custom Segment.

See Custom Segment APIs quickstart topic for the complete list of APIs for managing custom segments and users.

The users you add must exist in Punchh. If a user does not exist, then the Add User to a Custom Segment API returns an error. When using the Bulk Add Users to a Custom Segment API, the users who do not exist in Punchh are skipped. You can use the Get User Information API to check whether a user exists in Punchh.

Headers
  • Content-Type
    Type: string
    required

    The media type of the request body. Must be application/json.

  • Accept
    Type: string
    required

    The media type the client expects in the response. Must be application/json.

  • Authorization
    Type: string
    required

    Bearer token for admin authorization. Send the API key in the following format: "Authorization: Bearer BUSINESS_ADMIN_KEY_GOES_HERE".

Body
application/json
  • page
    Type: integer

    Number of pages

  • per_page
    Type: integer

    Number of records per page

  • query
    Type: string

    Define the search string on the segment name

Responses
  • application/json
  • application/json
  • application/json
Request Example for get/api2/dashboard/segments
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/dashboard/segments \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: ' \
  --data '{
  "user_id": 1234,
  "start_time": "2021-05-18 11:34:46",
  "plan_id": 12,
  "end_time": "2021-05-28 11:34:46",
  "purchase_price": 20,
  "auto_renewal": false,
  "migration": false,
  "lifetime_debits": 30,
  "lifetime_savings": 50,
  "initial_debits": 10,
  "initial_savings": 20,
  "source_subscription_id": "null"
}'
[
  {
    "segment_id": 1306904,
    "name": "test 1",
    "description": "",
    "segment_type": "GuestProfileSegmentDefinition",
    "user_type": "loyalty_user",
    "membership_level": null
  }
]