Public API
The Public API lets your own systems manage contacts and their segments. A change made through the API behaves exactly like one made in the app:
- joining a segment enrolls the contact in running campaigns that have Auto-Enroll on;
- leaving it stops runs in campaigns set to Stop the run;
- every change appears in the execution logs.
Base URL: https://api.botphonic.ai/api. Every path below is relative to it, e.g. GET https://api.botphonic.ai/api/v1/segments.
Endpoints
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /v1/segments | segments:read | List segments |
| GET | /v1/segments/{id} | segments:read | Get one segment |
| POST | /v1/segments/{id}/members | segments:write | Add or remove contacts (bulk) |
| POST | /v1/segments/move | segments:write | Move contacts between segments (bulk) |
| GET | /v1/contacts/lookup | contacts:read | Find a contact and its segments |
| POST | /v1/contacts | contacts:write | Create or update contacts (bulk) |
| PATCH | /v1/contacts/{ref} | contacts:write | Update one contact |
| DELETE | /v1/contacts/{ref} | contacts:write | Delete one contact |
| GET POST PATCH DELETE | /v1/webhooks | webhooks:manage | Manage webhook endpoints |
Send JSON bodies with Content-Type: application/json.
Download the OpenAPI 3.1 specification to import into Postman or Insomnia, or to generate a client library for your language.
Authentication
Send an API key as a bearer token on every request:
Authorization: Bearer bp_live_xxxxxxxx_yyyyyyyy…Each key belongs to one workspace, and every request only reaches that workspace's data. Each endpoint needs the scope listed with it below. Changes (anything except GET) also need an active plan or wallet credit on the account.
Identifying contacts
You never need Botphonic's internal ids. Each contact record identifies a person by any of:
| Field | Notes |
|---|---|
externalId | Your own id for the person (recommended). Unique within the workspace |
email | Email address |
phone | E.164 format, e.g. +14155550101 |
A record can also carry firstName, lastName and tags. Records are matched in this order: externalId, then phone + email, then phone, then email.
An externalId only needs to be unique within one workspace. Other Botphonic customers can use the same ids without clashing. Two workspaces on your own account are also separate: the same externalId in each refers to two different contacts. To keep one person in sync across workspaces, send the update with each workspace's API key.
Bulk results
These three endpoints accept up to 1,000 contact records per call and return an outcome for each one:
| Method | Path |
|---|---|
| POST | /v1/segments/{id}/members |
| POST | /v1/segments/move |
| POST | /v1/contacts |
A bad record never fails the rest of the batch: the request returns 200 and the record is reported as invalid. Example response from POST /v1/segments/{id}/members:
{
"status": 200,
"statusState": "success",
"message": "Contacts added to segment",
"data": {
"summary": { "matched": 998, "created": 1, "invalid": 1 },
"results": [
{ "index": 0, "status": "matched", "contactId": "6abb8f145d5c0515687d34be" },
{ "index": 1, "status": "created", "contactId": "6abb8f145d5c0515687d34bf" },
{ "index": 2, "status": "invalid", "error": "phone must be a valid E.164 number, e.g. +14155552671" }
]
}
}| Status | Meaning |
|---|---|
matched | An existing contact was found and changed |
created | A new contact was created (only where the endpoint allows it) |
not_found | No contact matched and none was created |
invalid | The record failed validation. See error |
ambiguous | More than one contact matched. Send externalId, or both phone and email |
index is the record's position in the contacts array you sent.
Segments
List segments
https://api.botphonic.ai/api/v1/segmentsScope segments:read| Query | Default | Notes |
|---|---|---|
page | 1 | |
perPage | 25 | Max 100 |
search | Filter by name |
{
"data": {
"records": [
{
"id": "6abb8f14…",
"name": "Trial users",
"rule": { "allContacts": false, "tags": ["trial"] },
"memberCount": 1842,
"createdAt": "2026-09-01T10:00:00.000Z",
"updatedAt": "2026-09-20T08:12:00.000Z"
}
],
"page": 1, "perPage": 25, "total": 7
}
}memberCount can lag by up to a minute after a large change.
Get a segment
https://api.botphonic.ai/api/v1/segments/{id}Scope segments:readAdd or remove contacts
https://api.botphonic.ai/api/v1/segments/{id}/membersScope segments:write| Body field | Required | Notes |
|---|---|---|
action | Yes | add or remove |
contacts | Yes | 1–1,000 contact records |
createMissing | No | add only. Create unmatched records that include phone, firstName and lastName |
curl -X POST https://api.botphonic.ai/api/v1/segments/<segmentId>/members \
-H "Authorization: Bearer $BOTPHONIC_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: signup-user_42" \
-d '{
"action": "add",
"createMissing": true,
"contacts": [
{ "externalId": "user_42", "email": "ann@example.com",
"phone": "+14155550101", "firstName": "Ann", "lastName": "Lee" }
]
}'Removing a contact from a tag-based or all-contacts segment keeps it out even though its tags still match. Adding it back includes it again.
Move contacts between segments
https://api.botphonic.ai/api/v1/segments/moveScope segments:writeRemoves the contacts from every from segment and adds them to every to segment as one change. A campaign that targets both sides sees no exit and no re-entry, so the contact's run isn't interrupted.
{
"from": ["<trialSegmentId>"],
"to": ["<paidSegmentId>"],
"contacts": [{ "externalId": "user_42" }]
}from and to each take 1–50 segment ids. Contacts are not created by this endpoint.
Contacts
Look up a contact
https://api.botphonic.ai/api/v1/contacts/lookup?externalId=user_42Scope contacts:readPass one of externalId, email or phone. Returns 404 if nothing matches, and 409 if more than one contact matches.
{
"data": {
"id": "6abb8f145d5c0515687d34be",
"externalId": "user_42",
"firstName": "Ann",
"lastName": "Lee",
"email": "ann@example.com",
"phone": "+14155550101",
"tags": ["trial"],
"segments": [
{ "id": "6abb8f14…", "name": "Trial users", "via": "tag" },
{ "id": "6abb8f15…", "name": "Newsletter", "via": "static" }
],
"createdAt": "…", "updatedAt": "…"
}
}via says why the contact is in the segment: static (added directly), tag (matches the segment's tags) or all (segment includes all contacts).
Create or update contacts
https://api.botphonic.ai/api/v1/contactsScope contacts:write{ "contacts": [ { "externalId": "user_42", "firstName": "Ann", "tags": ["paid"] } ] }- Unmatched records are created. They need
phone,firstNameandlastName. - Matched records get the
firstName,lastNameandtagsyou send.tagsreplaces the contact's tags, which moves it into or out of tag-based segments. externalIdandemailare only filled in when the contact doesn't have one yet. A matched contact with a differentexternalIdis reported asinvalid, never overwritten.
Update a contact
https://api.botphonic.ai/api/v1/contacts/{ref}Scope contacts:write{ref} is a contact id or ext:<externalId> (e.g. ext:user_42). Send any of externalId, email, phone, firstName, lastName, tags. The response is the contact with its current segments.
Delete a contact
https://api.botphonic.ai/api/v1/contacts/{ref}Scope contacts:writeThe contact leaves every segment. Campaigns set to Stop the run cancel its active runs.
Webhook endpoints
https://api.botphonic.ai/api/v1/webhooksScope webhooks:managehttps://api.botphonic.ai/api/v1/webhooksScope webhooks:managehttps://api.botphonic.ai/api/v1/webhooks/{id}Scope webhooks:managehttps://api.botphonic.ai/api/v1/webhooks/{id}Scope webhooks:manageManage the same endpoints as the Developers → Webhooks page. See Webhooks.
Limits and retries
| Limit | Value |
|---|---|
| Requests per key | 600 per minute |
Bulk requests (/members, /move, POST /contacts) | 60 per minute |
| Records per bulk request | 1,000 |
Over the limit, the API returns 429 with a Retry-After header (seconds). Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset.
Idempotency
Send Idempotency-Key: <unique string> (up to 128 characters) on writes. If the same key is used again within 24 hours, the first response is returned with Idempotent-Replayed: true, and nothing is applied twice. This makes it safe to retry after a timeout. A request that failed can be retried with the same key.
Errors
Errors use the same envelope, with statusState: "error" and a message.
| Status | Meaning |
|---|---|
401 | Missing, malformed, revoked or expired API key |
402 | No active plan or wallet credit (changes only) |
403 | The key is missing a required scope |
404 | Segment or contact not found in this workspace |
409 | Conflict, e.g. an ambiguous lookup, or the same Idempotency-Key still in progress |
422 | Validation failed. message lists the problems |
429 | Rate limit exceeded. Wait Retry-After seconds |
Membership changes are applied as soon as the request returns. The workflow side effects (enrolling or stopping runs, sending webhooks) run in the background, usually within seconds.