Bulk Add Users to a Custom List Segment

Adds users in bulk to a custom list segment using their email addresses and IDs. This API supports both sync and async modes. It validates the provided email addresses and IDs, returning a list of invalid identifiers that are neither valid integer IDs nor valid email addresses.

Async Mode
Async, or asynchronous, mode is the preferred method for using this API. In this mode, the API processes the users' email addresses and IDs provided in the request in the background. You can specify up to 1,000 user identifiers (email addresses and IDs) per API call.

Sync Mode
Sync, or synchronous, mode is an alternative method for using this API. In this mode, the API processes the users' email addresses and IDs provided in the request and immediately attaches them to the segment. This mode is slower and subject to rate limits to ensure system stability and prevent overload. You can include up to 100 user identifiers (email addresses and IDs) per API call.

Headers
  • Accept
    Type: string
    required

    Advertises which content types the client is able to understand

  • Authorization
    Type: string
    required

    Bearer token for admin authorization, who is making a call on behalf of the customer. Send the API key in the following format: "Authorization: Bearer BUSINESS_ADMIN_KEY_GOES_HERE".

Body
application/json
  • custom_segment_id
    Type: integer
    required

    Unique ID of the custom list segment to which users will be added

  • user_identifiers
    Type: array string[]
    required

    Email addresses and/or IDs of users to be added to the specified custom list segment. You can specify up to 1,000 users per API call in asynchronous mode and up to 100 users per API call in synchronous mode. If both an email address and an ID are provided as identifiers for a single user, they are treated as two separate entries for the purpose of the limit, reducing the maximum count by 2. However, only one user will be added to the segment in the system.

  • bulk_method
    Type: string

    Method to use for adding users in bulk. Possible values: sync, async. Specify 'sync' for synchronous processing, where users are created one by one in sequence, or 'async' for asynchronous processing, where user creation tasks are handled concurrently to improve efficiency. If no value is specified, 'async' mode is used by default.

Responses
  • application/json
  • application/json
Request Example for post/api2/dashboard/custom_segments/members/add_users
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/dashboard/custom_segments/members/add_users \
  --request POST \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer BUSINESS_ADMIN_KEY_GOES_HERE' \
  --header 'Content-Type: application/json' \
  --data '{
  "bulk_method": "sync",
  "custom_segment_id": 120966,
  "user_identifiers": [
    "test@example.com",
    "76563563",
    "test1@example.com",
    "76563564"
  ]
}'
{
  "invalid_identifiers": [
    "efsfsef",
    "78439fer"
  ]
}