Retrieve the guests in a target segment
This API retrieves the guests in a target segment that match the segment's rule criteria.
Before you begin
- You need a valid API key or access token. See Set up API authentication.
Permission: Target Segment access (View, Add, Edit, Delete, Email Guests List, View Guests List, or Export Guests List) on the security role associated with your API key, in addition to a valid API key/access token.
Endpoint
GET /v1/marketing/target_segments/{target_segment_id}/guests
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| center_id | string | Yes | — | Center identifier for evaluating the rules. A missing or empty value returns 400 Bad Request. |
| view_id | string | Yes | — | View identifier to scope fields and presentation. A missing or empty value returns 400 Bad Request. |
| view_mode | integer (int32) | No | — | Specifies the mode in which the view is displayed. |
| version | string | No | — | Rules engine version for evaluation. |
| display_transactional_data | boolean | No | — | Include transactional data in results for UI display. |
| pii_export_request_id | string | No | — | Required when requires_pii_approval_flow=true for export flow. |
| requires_pii_approval_flow | boolean | No | — | Indicates request is for export and needs approval routing. |
Response
Success (200 OK)
{
"guests": [
{
"...": "..."
}
],
"error": {}
}
Response fields
| Field | Type | Description |
|---|---|---|
| guests | object[] | |
| guests[].id | string | |
| guests[].name | string | |
| guests[].first_name | object | |
| guests[].last_name | object | |
| guests[].code | object | |
| guests[].base_center | string | |
| guests[].gender | string | |
| guests[].type | string | |
| guests[].spent | integer | |
| guests[].email | string | |
| guests[].mobile_phone | object | |
| guests[].home_phone | object | |
| guests[].address1 | string | |
| guests[].address2 | string | |
| guests[].city | string | |
| guests[].zipcode | string | |
| guests[].state | string | |
| guests[].country | string | |
| guests[].nationality | object | |
| guests[].dob | object | |
| guests[].anniversary_date | object | |
| guests[].visits | integer | |
| guests[].first_visit | object | |
| guests[].last_visit | object | |
| guests[].referral_source | object | |
| guests[].receive_marketing_email | boolean | |
| guests[].receive_marketing_sms | boolean | |
| guests[].receive_marketing_whatsapp | boolean | |
| guests[].relationship_manager | object | |
| guests[].relationship_manager_id | object | |
| guests[].target_segment_center | string | |
| guests[].creation_date | string | |
| error | object |
Example
curl --request GET \
--url 'https://api.zenoti.com/v1/marketing/target_segments/{target_segment_id}/guests' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/marketing/target_segments/{target_segment_id}/guests', {
method: 'GET',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.get(
'https://api.zenoti.com/v1/marketing/target_segments/{target_segment_id}/guests',
headers={
'Authorization': 'bearer {{access_token}}',
},
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var response = await client.GetAsync(
"https://api.zenoti.com/v1/marketing/target_segments/{target_segment_id}/guests");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/marketing/target_segments/{target_segment_id}/guests')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
response = http.request(request)
data = JSON.parse(response.body)
Error codes
| Status | Description |
|---|---|
| 400 | 400 |
| 401 | Unauthorized -- invalid or expired access token |
| 429 | Too many requests -- rate limit exceeded |