View Categories

Contacts, channels & templates API

2 min read

Alongside sending messages, the API lets you push contacts into Baat and look up the channels and templates you’ll reference when sending. All three endpoints authenticate with the X-API-KEY header.

A note on field casing: the send-message endpoint uses snake_case, while the contacts, channels and templates endpoints below use camelCase. The examples reflect this.

Create a contact #

POST https://api.baat.ai/v1/remote/contacts?ignore-duplicate=true

Requires the contacts:write scope. The optional ignore-duplicate query parameter (default true) controls behaviour when a contact with the same phone number already exists — set it to false to receive a 409 Conflict instead of silently skipping.

curl -X POST "https://api.baat.ai/v1/remote/contacts" 
  -H "X-API-KEY: bk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
  -H "Content-Type: application/json" 
  -d '{
    "name": "Aarav Sharma",
    "phone": { "countryCode": "91", "number": "9876543210" },
    "email": "aarav@example.com",
    "tags": [{ "name": "vip" }],
    "marketingOptIn": true,
    "acquisitionSource": "shopify-import"
  }'
Field Type Description
name string Contact’s display name.
phone object Phone object: countryCode (e.g. "91") and number.
email string Optional email address.
tags array Tags to apply, each an object with a name.
customFields object Map of custom field values.
marketingOptIn boolean Whether the contact has opted in to marketing.
acquisitionSource string Where the contact came from.
preferredLanguage string Preferred language code.

Returns 201 Created with the created contact (including its generated id). A duplicate phone number with ignore-duplicate=false returns 409 Conflict.

List channels #

GET https://api.baat.ai/v1/remote/account/channels

Requires read access to channels. Returns the WhatsApp Cloud API channels connected to your organization. Use a channel’s numeric id as channel_id when sending messages.

[
  {
    "id": 123,
    "type": "WAC_API",
    "phoneNumber": "+91 80 1234 5678",
    "status": "ACTIVE",
    "organizationId": 4567
  }
]

List templates for a channel #

GET https://api.baat.ai/v1/remote/account/channels/{channelId}/whatsapp-templates

Requires the templates:read scope. Returns the approved templates on a channel, paginated with a cursor.

Query param Default Description
limit 50 Maximum templates to return.
after Pagination cursor; pass the cursor from the previous response to fetch the next page.
{
  "cursor": "QVFIU…",
  "data": [
    { "name": "order_shipped_v2", "language": "en", "status": "APPROVED" }
  ]
}
The usual flow is: list channels → pick a channel_idlist templates on that channel → pick a template → send via POST /m1/whatsapp/messages.

Scopes & errors #

Each endpoint returns 401 Unauthorized for a missing/invalid key and 403 Forbidden if the key lacks the required scope (contacts:write, channels:read, or templates:read respectively).