Dashboard

Preview a customer segment

POST
/api/v1/customers/segment/preview

Materialises a segment filter and reports its size and value, without saving it.

Authorization

HTTPBearer
AuthorizationBearer <token>

JWT access token

In: header

Query Parameters

merchant_id?|

Optional merchant to act on. Must be one you are a member of.

Formatuuid

Header Parameters

X-Merchant-ID?string|null

Request Body

application/json

The filter used to materialise an audience. Validated server-side.

active_dayparts?array<string>
active_within_days?|
Range1 <= value <= 730
dayparts?array<string>
limit?integer
Range1 <= value <= 20000
Default5000
max_orders?|
Range0 <= value
max_recency_days?|
Range0 <= value
min_orders?|
Range0 <= value
min_recency_days?|
Range0 <= value
min_total_spend?|
Range0 <= value
name*string
Lengthlength <= 200
opted_in_only?boolean
Defaulttrue
product_ids?array<>
segments?array<string>

Response Body

application/json

application/json

curl -X POST "https://example.com/api/v1/customers/segment/preview" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "data": {    "avg_order_value": 0,    "definition": {      "active_dayparts": [        "string"      ],      "active_within_days": 1,      "dayparts": [        "string"      ],      "limit": 5000,      "max_orders": 0,      "max_recency_days": 0,      "min_orders": 0,      "min_recency_days": 0,      "min_total_spend": 0,      "name": "string",      "opted_in_only": true,      "product_ids": [        "026d7765-cea5-4b36-a2c4-f616e464c692"      ],      "segments": [        "string"      ]    },    "estimated_revenue_30d": 0,    "sample": [      {        "acquisition_channel": "string",        "avg_order_value": 0,        "external_ref": "string",        "first_order_at": "2019-08-24T14:15:22Z",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "is_opted_in": true,        "last_order_at": "2019-08-24T14:15:22Z",        "masked_phone": "string",        "name": "string",        "preferred_daypart": "string",        "recency_days": 0,        "segment": "string",        "total_orders": 0,        "total_spend": 0      }    ],    "size": 0  },  "meta": {},  "success": true}