Skip to navigation

Create a segment

Creates a named set of customers, such as key accounts or EMEA. key must be unique in the account, archived segments included, and cannot change. An account has at most 500 segments, archived ones included. Put a customer in it with segments when creating the customer, or addSegments when updating one.

Authentication

AuthorizationBearer
API Key authentication using Bearer token

Headers

Paid-BetaenumRequired

This endpoint is in the segments=v1 beta. Send this header to use it.

Allowed values:

Request

Body
keystringRequiredformat: "^[a-z0-9_]{1,64}$"

Your stable name for the segment, 1 to 64 lowercase letters, digits and _. Unique on your account, archived segments included. Immutable. Accepted wherever a segment is named.

namestringRequired1-255 characters
Display name, shown in the dashboard. Customers never see it.
descriptionstring or nullOptional<=500 characters
What the segment is for, up to 500 characters, or null.
metadatamap from strings to stringsOptional

String key-value pairs of your own, up to 500 characters per value. Always updatable.

Response

201
idstring
The segment's ID.
objectenum

The type of object. Always segment.

Allowed values:
createdAtdatetime
When the object was created.
archivedAtdatetime or null

When the segment was archived, or null. An archived segment stays readable, is removed from every customer, and keeps its key reserved.

descriptionstring or null<=500 characters
What the segment is for, up to 500 characters, or null.
keystringformat: "^[a-z0-9_]{1,64}$"

Your stable name for the segment, 1 to 64 lowercase letters, digits and _. Unique on your account, archived segments included. Immutable. Accepted wherever a segment is named.

livemodeboolean

true for an object on a live account, false on a test account.

metadatamap from strings to strings

String key-value pairs of your own, up to 500 characters per value. Always updatable.

namestring1-255 characters
Display name, shown in the dashboard. Customers never see it.
updatedAtdatetime
When the object was last changed.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error