Skip to content

Team members

Teams are collaborative — invite users into a Team and assign them a role that scopes what they can do. Both endpoints are API-key authenticated.

Send an invitation to join a Team. The invitee receives an invite link (built from base_url) and, once accepted, is granted the role_id you specify on the Team.

Terminal window
curl -X POST "$PH_BASE_URL/api/v2/account_invites" \
-u "$PH_API_USERNAME:$PH_API_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"organization_id": 9,
"account_id": 63,
"email": "agent@vendor-a.co",
"phone_number": "+254720111222",
"role_id": 3,
"assigned_account_ids": [63],
"base_url": "https://app.acme.co"
}'

POST /api/v2/account_invites

Field Type Required Notes
organization_id integer Yes Organization the Team belongs to.
account_id integer Yes The Team to invite the user into.
email string Yes Invitee’s email — the invite is sent here.
phone_number string No Invitee’s phone in E.164 format.
role_id integer No Role granted on acceptance (scopes the member’s permissions).
assigned_account_ids integer[] No Teams the member is granted access to. Usually [account_id].
base_url string No Base URL used to build the invite link in the email.
200 OK
{ "success": true }

Remove a user from a Team. Identify both the Team and the user via query parameters.

Terminal window
curl -X DELETE "$PH_BASE_URL/api/v2/account_invites?account_id=63&user_id=42" \
-u "$PH_API_USERNAME:$PH_API_PASSWORD"

DELETE /api/v2/account_invites

Query param Type Required Notes
account_id integer Yes The Team to remove from.
user_id integer Yes The user being removed.
200 OK
{ "account_id": 63, "user_id": 42 }