Create and Update Contacts
Create a contact
POST /v1/organization/contactsRequest body
| Field | Type | Required | Description |
|---|---|---|---|
number | string | ✓ | Contact phone number |
first_name | string | — | First name |
middle_name | string | — | Middle name |
last_name | string | — | Last name |
full_name | string | — | Full name |
email | string | — | |
tags | string[] | — | Contact tags |
segment_ids | string[] | — | Segments to add (max 20) |
attributes | object | — | Custom attributes key/value map |
cURL
curl -X POST https://api.bahasha.app/v1/organization/contacts \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Jane Doe",
"number": "+254700000000",
"email": "[email protected]",
"tags": ["vip", "newsletter"],
"segment_ids": ["67f12bb3882d745f33f3d300"],
"attributes": {
"city": "Nairobi",
"customer_tier": "Gold"
}
}'Update a contact
PATCH /v1/organization/contacts/:idSend only the fields you want to update.
curl -X PATCH https://api.bahasha.app/v1/organization/contacts/68011f5f8f7f109de8f62f5e \
-H "Authorization: Bearer bh_live_xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"merge_attributes": true,
"tags": ["vip", "new_segment"],
"attributes": {
"city": "Mombasa",
"customer_tier": "Platinum"
}
}'Set "merge_attributes": true to merge supplied custom attributes without
erasing unrelated attributes already on the contact. Send
"segment_ids": [] to remove the contact from every segment.