Skip to main content
POST
/
v1
/
segments
curl --request POST \
--url https://{cluster}.voucherify.io/v1/segments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Id: <api-key>' \
--header 'X-App-Token: <api-key>' \
--data '{
"name": "Customers in a new Segment",
"type": "static",
"customers": [
"cust_iajsExT2QB4sGWzABY85WRqV",
"cust_sehkNIi8Uq2qQuRqSr7xn4Zi"
]
}'
{
"id": "seg_vC8iOSCqUG02EsPzsHynLv8i",
"name": "Customers in a new Segment",
"created_at": "2022-09-13T08:57:15.801Z",
"type": "static",
"filter": null,
"initial_sync_status": "DONE",
"object": "segment"
}

Authorizations

X-App-Id
string
header
required
X-App-Token
string
header
required
Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

Specify the boundary conditions for the customer segment.

  • Static Customer Segment
  • Dynamic Customer Segment

Request body schema for POST v1/segments. Request body schema for creating a static customer segment in POST v1/segments.

name
string

Segment name.

type
enum<string>
default:static

Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).

Available options:
static
customers
string[]

Array of customer IDs.

Response

200 - application/json

Returns a customer segment object.

Response body schema for POST v1/segments. This is an object representing a customer segment.

id
string

Unique segment ID.

Example:

"seg_1wc52c5z6r1kQ81brO8j9Hk2"

name
string

Segment name.

created_at
string<date-time>

Timestamp representing the date and time when the segment was created. The value is shown in the ISO 8601 format.

Example:

"2022-05-12T13:01:56.896Z"

type
enum<string>

Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).

Available options:
auto-update,
static
filter
object | null

Defines a set of criteria for an auto-update segment type.

initial_sync_status
enum<string>
Available options:
IN_PROGRESS,
DONE
object
enum<string>
default:segment

The type of the object represented by JSON. This object stores information about the customer segment.

Available options:
segment
I