Segments
A segment is a named set of customers, such as “Key accounts” or “EMEA”. Sales teams manage classes of customers rather than one at a time, and finance reports by the same classes. Segments give those classes a home in billing: one named class, kept in one place, and usage reports that split by it, without metadata conventions that reports can’t read.
Use a segment to:
- Report by class, filtering or grouping usage summaries by segment.
- Find a class of customers, by listing customers in a segment.
Segments are in the segments=v1 private beta: send Paid-Beta: segments=v1 with each request.
How segments work
- You create a segment with a
key, such askey_accounts, which is how code and reports name it. - You put customers in it with
segmentswhen you create a customer, andaddSegmentsandremoveSegmentswhen you update one. A customer can be in up to 20 segments, and draft customers can be members. - Reports read membership when you query them.
Segments, parents and units answer different questions:
Create a segment
Trey Research tracks its 50 largest accounts as a class, and reviews the list each quarter:
API
Dashboard
Create a segment with a key and a name:
Anywhere the API asks for a segment, pass its key or its seg_ ID. Responses name segments by key.
An account can have up to 500 segments, archived ones included. Creating another returns 400 segment_limit_reached. Archiving a segment doesn’t free a place, so reuse one where you can.
Add customers to a segment
Membership is set on the customer. Update the customer with the segments to add and the segments to remove:
API
Dashboard
Only the segments you name change, so two systems can add segments to the same customer at once without losing each other’s. Adding a segment the customer is already in, or removing one it isn’t in (an archived one included), is skipped, and a call that changes nothing returns the customer as it is. A segment that doesn’t exist, adding an archived segment, or naming one segment in both lists rejects the whole call, and nothing changes. The response’s segments is the customer’s full list, by key.
You can also set the starting segments when you create a customer. To see a segment’s members, list customers with the segment filter:
Report by segment
Usage summaries filter by segment, or split by it with groupBy:
A customer in two segments appears in both groups, so the groups can add up to more than the overall total. Customers in no segment are grouped under null. segment can’t be sent with customer.
Reports read membership when you query them, and there’s no membership history, so moving a customer between segments also changes how its past usage appears in segment reports.
Change or archive a segment
Update a segment to change its name, description or metadata. Its key can’t change.
Archive a segment when the class no longer exists. It’s removed from every customer’s segments, can’t be given to a customer, and stays readable with its key reserved.