Bulk Add Users to a Custom Segment
This API allows you to add users in bulk to a custom segment by uploading a CSV file that contains a list of users and their details. The uploaded file must be a CSV file.
The CSV file will have two columns: "user_id" and "email". The "user_id" column contains all user IDs that need to be added to the custom segment. Either email or user ID should be passed in the CSV file. If both email and user ID values are provided in the CSV file, the look-up process for adding user IDs to the custom segment will use both the "email" and "user_id" fields to identify the guests to be added.
Once the uploaded CSV file is processed, you will receive a response file on the registered email ID with details of success/failure against each entry, along with validation errors if applicable.
The changes you request through this API call may not take effect immediately. Instead, they are queued up and processed in the order they were received, depending on the availability of resources to process the requests. All changes made via this API are reflected in the audit logs.
This API can be triggered only in limited time slots defined by Punchh. The time slot designated by Punchh for this operation is from 9:30 PM EST to 5:30 AM EST. Requests triggered outside of the defined time slot will be rejected.
Permission required: Admin account with Business Manager permission. Accounts without required permission will receive a 302 error response.
- Type: stringAcceptrequired
Advertises which content types the client is able to understand
- Type: stringAuthorizationrequired
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".
The request for this API endpoint is passed using form data, as shown in the following example.
curl --request POST \
--url https://server_name_goes_here.punchh.com/api2/dashboard/custom_segments/members/bulk_add \
--header 'Accept: application/json' \
--header 'Authorization: Bearer BUSINESS_ADMIN_KEY_GOES_HERE' \
--header 'Content-Type: application/json' \
—form 'name="custom_seg_perf1"' \
—form 'custom_segment_id=110443' \
—form 'bulk_guest_activity_file=@"CSV_FILE_PATH_GOES_HERE"'
- Type: stringbulk
_guest _activity _file requiredLocal path to the CSV file. The CSV will include the user IDs that will be added to the specified custom segment. Only CSV file format is supported, and the maximum supported file size is 15 MB.
- Type: integercustom
_segment _id requiredUnique ID of the custom segment to which users will be added
- Type: stringnamerequired
Unique name assigned to this bulk user addition activity
- 200
OK
- application/json
curl https://SERVER_NAME_GOES_HERE.punchh.com/api2/dashboard/custom_segments/members/bulk_add \
--request POST \
--header 'Accept: application/json' \
--header 'Authorization: Bearer BUSINESS_ADMIN_KEY_GOES_HERE' \
--header 'Content-Type: application/json' \
--data '{
"name": "custom_seg_perf1",
"custom_segment_id": 110443,
"bulk_guest_activity_file": "CSV_FILE_PATH_GOES_HERE"
}'