Segments
Segments are named lists. A contact can belong to up to 20 segments at
once, and membership is additive: adding a contact to a segment never removes
it from another one. Use Tags for lightweight, cross-cutting labels.
Segment names are unique per organization, case-insensitively: “VIP Customers” and “vip customers” cannot both exist.
List segments
GET /v1/organization/contacts/segmentsOnly active segments are returned.
curl https://api.bahasha.app/v1/organization/contacts/segments \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx"Response
{
"data": [
{
"id": "67f12bb3882d745f33f3d300",
"name": "Returning Customers",
"description": "Customers with repeat purchases",
"contact_count": 128,
"created_at": "2026-04-18T09:10:22.000Z",
"updated_at": "2026-04-24T10:11:02.000Z"
}
]
}Create a segment
POST /v1/organization/contacts/segmentscurl -X POST https://api.bahasha.app/v1/organization/contacts/segments \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Returning Customers",
"description": "Customers with repeat purchases"
}'A duplicate name (case-insensitive) returns 409 Conflict.
Add or remove memberships
PATCH /v1/organization/contacts/segments/contacts/membershipsUse exactly one operation per request:
| Field | Type | Effect |
|---|---|---|
add | string[] | Adds memberships, keeps existing ones |
remove | string[] | Removes only the listed memberships |
replace | string[] | Replaces every membership |
curl -X PATCH https://api.bahasha.app/v1/organization/contacts/segments/contacts/memberships \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"68011f5f8f7f109de8f62f5e",
"68011f5f8f7f109de8f62f5f"
],
"add": ["67f12bb3882d745f33f3d300"]
}'Response
{
"data": {
"updated_count": 2,
"added_count": 1,
"removed_count": 0,
"replaced": false
}
}Move contacts between segments
PATCH /v1/organization/contacts/segments/contactsThis is the replace operation, kept for existing integrations: the supplied
segment_ids become the contact’s complete membership set.
curl -X PATCH https://api.bahasha.app/v1/organization/contacts/segments/contacts \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"contact_ids": [
"68011f5f8f7f109de8f62f5e",
"68011f5f8f7f109de8f62f5f"
],
"segment_ids": [
"67f12bb3882d745f33f3d300",
"67f12bb3882d745f33f3d301"
]
}'Send "segment_ids": [] to remove every membership.
Delete a segment
DELETE /v1/organization/contacts/segments/:idcurl -X DELETE https://api.bahasha.app/v1/organization/contacts/segments/67f12bb3882d745f33f3d300 \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx"Deleting a segment detaches its members and keeps every contact. Contacts are never deleted with a segment, and the segment name becomes available again.