Segments
Segments are groups of contacts in Hive. Through the API you can list and create segments, delete them, and read or change the users in static segments. Adding users to a segment can trigger segment-based automations configured in Hive.
Endpoints
The segment object
GET /segments/ returns the brand’s segments in a segments array.
Whether a segment is static or dynamic isn’t exposed by the API. Endpoints that require a static segment return 422 Unprocessable Entity for a dynamic one.
Create a segment
name(required): segment name.description(optional): segment description. Omit it rather than sendingnull.
Segment names must be unique within the brand. If a segment with the same name already exists,
Hive returns 409 Conflict.
Delete a segment
Only static segments can be deleted. If the segment can’t be deleted, Hive returns 422 Unprocessable Entity. If the segment doesn’t exist, Hive returns 404 Not Found. A failure while deleting returns 500 Internal Server Error.
List segment users
GET /segments/{segment_id}/users/ accepts limit (0–500, default 500) and offset (default 0). Users are returned in the order they were added to the segment, oldest first. An out-of-range limit or offset returns 422 Unprocessable Entity, and an unknown segment returns 404 Not Found.
Add or remove users
POST /segments/{segment_id}/users/ adds users and POST /segments/{segment_id}/users/remove/ removes them. Both take the same body:
users(required): 1–50 users per request.- Each user needs an
emailor aphone.emailmust be a valid email address andphonemust not be blank. Omit a field rather than sendingnull. - Users are matched to existing contacts by email or phone only.
Both endpoints are asynchronous and return 202 Accepted. An unknown segment returns 404 Not Found.
Only static segments can be modified through the API. Adding or removing users on a
non-static segment returns 422 Unprocessable Entity.
Errors
Error responses for unknown segments, duplicate names, failed deletes, and non-static segments use the shape {"errors": ["..."]}, for example {"errors": ["Segment not found."]}.