Partner API

Base URL: https://chatsa.co/api/v1

The partner API is for platforms that run ChatSa for their own customers. Your customers never register on or sign in to ChatSa: you create one ChatSa account per customer with your app's credentials, then open a signup window ChatSa hosts, where WhatsApp's own signup connects the customer's number. The new number's key then works with the WhatsApp messaging API and the Connect setup calls, exactly like a "Connect with ChatSa" token.

The partner API needs the account-creation tier on your app. Apply on your app's page in Dashboard → Developers → Apps: see Partner tiers. Until it is approved, these calls answer 403 provisioning_not_allowed.

Paths below are under https://chatsa.co/api/v1/. Successes are { "data": … }; errors are { "code", "message" } with the HTTP status.

Client credentials#

The account calls and the capabilities check authenticate with your app's client credentials:

Authorization: Basic base64(<client_id>:<client_secret>)

Missing, wrong or unknown credentials answer 401 invalid_client (with WWW-Authenticate: Basic); an app without the account-creation tier 403 provisioning_not_allowed. 60 calls a minute per app.

What ChatSa offers right now#

GET /api/v1/partner/capabilities → { "data": { "whatsapp_signup": true, "lead_ads": false, "messenger": true, "instagram": true } }.

Show a button only when its feature is on. A few minutes' cache is enough.

Accounts#

{external_ref} is your id for your customer: 1–128 letters, digits, ., _, : or -, starting with a letter or digit. Each app has its own namespace: the same external_ref under two apps is two accounts, and one app never reaches another's.

Create or update an account#

PUT /api/v1/partner/accounts/acme-plumbing-001
Authorization: Basic …

{ "name": "Acme Plumbing", "locale": "en", "time_zone": "America/Los_Angeles", "country": "US" }

name (up to 200 characters) is required; the others are optional. country is a two-letter code. A bad external_ref or body answers 400 invalid_request.

{ "data": { "account_id": "1d2e…", "status": "active", "created": true, "key": "csa_…" } }
  • The first call creates the account (a ChatSa workspace on the partner plan, ready to use, with no ChatSa login anyone signs in to) and returns its account key, once (created: true).
  • Later calls find the same account (created: false, key: null) and update its name, locale, time zone and country. A PUT never resumes a suspended account.
  • ?rotate=1 revokes the account key and returns a new one. Use it if you lost the key. Two rotations at the same time: one answers 409 conflict; retry it.
  • Two first calls at the same time: the second answers 409 in_progress; retry it. A first call that failed part-way leaves nothing behind, so retrying is safe.

The account key is a bearer key for everything inside that one account (below), plus the WhatsApp messaging API for any of the account's chatbots (with chatbot_id) and SMS and calls. It is not a Connect token: /connect/* refuses it (403 app_token_required).

Suspend or resume#

PATCH /api/v1/partner/accounts/acme-plumbing-001

{ "status": "suspended" }

{ "status"?: "active" | "suspended", "name"?: "…" }, at least one of them → { "data": { "account_id", "status" } }. A suspended account can't send WhatsApp messages (403 forbidden, "This workspace is not active.") and can't open a signup window (403 account_suspended). On a Team only number, inbound messages are still kept and delivered. It takes effect at once.

Delete#

DELETE /api/v1/partner/accounts/{external_ref} deletes the whole account: its chatbots, conversations, contacts and keys, and each number's subscription at WhatsApp. { "data": { "account_id", "deleted": true } }; 404 not_found when there is no such account.

Read#

GET /api/v1/partner/accounts/{external_ref} (404 not_found when there is no such account) lists up to 50 chatbots with their numbers, and this period's usage:

{
  "data": {
    "account_id": "1d2e…",
    "external_ref": "acme-plumbing-001",
    "status": "active",
    "name": "Acme Plumbing",
    "created_at": "2026-11-30T10:00:00Z",
    "chatbots": [{ "id": "6f1c…", "name": "Acme Plumbing", "phone_number": "14155550123", "connected": true, "coexistence": false }],
    "usage": { "period_start": "…", "resets_at": "…", "messages": 12, "message_limit": 4000, "voice_seconds": 0 },
    "safety": { "state": "ok", "reasons": [], "since": null, "set_by": null, "daily_cap": 250, "sent_today": 12, "resets_at": "…" }
  }
}

Connecting a WhatsApp number#

Everything from here on uses the account key: Authorization: Bearer <account key>. Without a key, or with a rotated account key: 401 unauthorized; a chatbot key or a dashboard key: 403 account_key_required. 30 calls a minute per key.

Open a signup window#

POST /api/v1/partner/whatsapp/signups
Authorization: Bearer <account key>

{ "return_url": "https://app.example.com/chatsa/whatsapp/done", "state": "<random, up to 500 characters>", "locale": "en" }

201 with:

{ "data": { "id": "9b7a…", "url": "https://chatsa.co/partner/whatsapp-signup/9b7a…", "expires_at": "2026-11-30T10:30:00Z" } }
  • return_url must be exactly one of your app's registered redirect URIs, or the path /api/v1/chatsa/whatsapp/callback on the origin of one of them (an https origin, or http://localhost / http://127.0.0.1). Anything else: 400 invalid_return_url.
  • state is required (1–500 characters); a missing field is 400 invalid_request.
  • url is on the ChatSa domain you called (chatsa.co or chat.sa).
  • A window is single use and lasts 30 minutes. A suspended account: 403 account_suspended.

The window#

Open url in a popup. It has no ChatSa sign-in and no ChatSa branding: it shows your app's product name and a Connect WhatsApp button that opens WhatsApp's own signup, where the business chooses or adds its number. The window is in Arabic, with your app's Arabic name, when locale starts with ar; otherwise in English.

Above the button, a box "Keep using the WhatsApp Business app on this number" (off by default) connects a number the business already uses in the WhatsApp Business app, which keeps working there (see below).

When the business finishes, ChatSa creates a chatbot in the account named after the business (the number's WhatsApp name, or else the account's name), in Team only mode (every inbound message is saved and sent to your webhook; ChatSa's AI never answers), and connects the chosen number. A number that already has a two-step verification PIN is asked for it in the window; a new PIN ChatSa sets is shown once in the window.

Then the window goes to return_url with these query parameters:

statusWhenAlso
connectedThe number is connectedsignup, state
cancelledThe business pressed Cancelsignup, state
errorThe number is used by another chatbot (reason=number_in_use), the account was suspended (account_suspended), it has no room for another number (chatbot_limit), WhatsApp signup is unavailable on ChatSa right now (meta_not_configured), or the number was no longer connected when its PIN was entered (not_connected)signup, state, reason

Check state against the one you sent before anything else. A passing problem (WhatsApp unreachable, the business closed WhatsApp's window) keeps the window open with Try again.

Read the result#

GET /api/v1/partner/whatsapp/signups/{id} (the same account's key; another account's signup is 404 not_found):

{
  "data": {
    "status": "connected",
    "chatbot": { "id": "6f1c…", "name": "Acme Plumbing", "phone_number": "14155550123", "mode": "api", "connected": true, "coexistence": false },
    "key": "csa_…",
    "error": null
  }
}
  • status: pending, connected, cancelled or error. A window not finished within 30 minutes reads as status: "error" with error: "expired".
  • key is the new chatbot's own chatbot key, returned once: the first read of a connected signup creates it; every later read gets null. Store it encrypted.
  • When status is error, error is one of the reasons above, or expired. When it is connected, error is null, or not_registered (WhatsApp hasn't registered the number yet; the chatbot's connected says whether it can carry messages), or chatbot_removed (the chatbot was deleted since: chatbot and key are null).

After the number is connected#

With the chatbot key, set up the number like a Connect connection: PUT /api/v1/connect/webhook for its events, optionally PUT /api/v1/connect/context so ChatSa's AI can ask your system about customers, and GET /api/v1/connect for its state (Connect). Then send and read with the WhatsApp messaging API. To let ChatSa's AI answer instead of Team only, PUT /api/v1/whatsapp/mode with "mode": "ai".

Disconnect a number#

DELETE /api/v1/partner/whatsapp/numbers/{chatbot_id} (account key) disconnects the number (connection.status: disconnected is sent) and revokes your app's chatbot key for it, with the webhook and connected app it set up. The chatbot and its history stay in the account. { "data": { "chatbot_id", "disconnected": true, "keys_revoked": 1 } }; another account's chatbot is 404.

Numbers that keep the WhatsApp Business app#

A number the business already runs in the WhatsApp Business app can be connected and keep working in the app on the phone (WhatsApp calls this coexistence). The business ticks the box in the signup window and confirms on the phone.

  • The number is not re-registered: no PIN step. Chatbot summaries show "coexistence": true, and GET /whatsapp/status reports the import progress (see WhatsApp).
  • Contacts and chat history are imported once. WhatsApp allows each import only once, within 24 hours of connecting. Contacts land on the account's contacts. History (up to six months, when the business chose to share it) is imported into closed conversations, both directions, with source: "history" and imported: true in threads. Imported messages never start an AI reply, never count as usage, send no message.* event and open no reply window. Each chunk sends history.imported (subscribe to it by name); a business that declined to share sends declined: true.
  • Messages typed in the app arrive as message.sent with source: "app" and sender: "business_app" (sender_name: null). On an AI-mode number ChatSa's AI then stays quiet with that customer for 24 hours, as after an inbox reply, and never sends an answer it was still writing when the person replied.
  • An edit or delete in the app (or by the customer) changes ChatSa's copy and sends no event.
  • When the business disconnects ChatSa in the app, you receive connection.status: disconnected.

WhatsApp's own limits for these numbers (show them to your customer): the WhatsApp Business app must be version 2.24.17 or later and opened on the phone at least every two weeks; group chats, broadcast lists, calls, the catalog, labels, quick replies, greeting and away messages, disappearing and view-once messages and live location stay in the app; companion devices are unlinked once when connecting; throughput is 20 messages a second; the blue tick and business verification aren't available; the number can't move to another WhatsApp Business Account; WhatsApp checks eligibility in its own window.

Facebook Pages and lead ads#

The account key also opens a Facebook signup window that connects the business's Pages and delivers their lead ad submissions as lead.received, when lead_ads is on (see above). See Facebook Pages and lead ads.

Messenger and Instagram#

The same Facebook window (features: ["messages"]) connects each Page the business can message from to Messenger, and the Instagram professional account linked to it to Instagram Direct. These conversations are team only: ChatSa's AI never answers them. Every message reaches the account webhook as social.message.received or social.message.sent; you reply with POST /api/v1/social/messages within 24 hours of the person's last message and read a conversation with GET /api/v1/social/threads/{channel}/{to}. A Page already used elsewhere is refused (page_in_use). See Messenger and Instagram.

The account's webhook#

An account key can't call PUT /connect/webhook (that is a chatbot connection's), so the account has its own endpoint for what no chatbot connection receives: events that belong to no chatbot (chatbot_id: null, such as lead.received and the SMS and call events of numbers without a chatbot), and events of chatbots you have no Connect endpoint for.

PUT /api/v1/partner/webhook
Authorization: Bearer <account key>

{ "url": "https://app.example.com/webhooks/chatsa/acme-plumbing-001", "events": ["sms.*", "message.*", "connection.status"] }

→ { "data": { "id", "events", "secret": "whsec_…" } }. One endpoint per app and account: another PUT replaces it (same id) and returns a new signing secret, once. About 3 seconds later ChatSa sends a signed ping (data: { "connection": "ok" }). Events come from the webhook event list; an unknown event is 400 invalid_request, a private URL 400 invalid_url. The endpoint survives an account key rotation.

GET /api/v1/partner/webhook → { "data": { "id", "url", "events", "active" } } (never the secret) or { "data": null }. DELETE /api/v1/partner/webhook → { "data": { "deleted": true } } (false when there was none); its undelivered events go with it.

Which endpoint gets an event, never twice:

The event's chatbotYour app has a Connect endpoint for it that takes this eventGoes to
none (chatbot_id: null)n/athe account endpoint
chatbot XyesX's Connect endpoint only
chatbot Xnothe account endpoint

Other apps' endpoints and the business's own dashboard webhooks are not affected. Another account's events never reach this endpoint.

A person's deletion request#

When a person asks you to delete their data (CCPA and similar laws), pass it on:

POST /api/v1/partner/erasures
Authorization: Bearer <chatbot key or account key>
Idempotency-Key: erase-req-4821

{ "phones": ["+14155550199"], "emails": ["jordan@leedental.com"] }
  • Phones in E.164 with the plus (+14155550199), e-mails in any case (ChatSa lower-cases them), and Messenger or Instagram people as social: [{ "channel": "messenger" | "instagram", "id": "<their id>" }] (the from.id of their messages; use the account key), at most 50 of each, at least one in all. Anything else is 400 invalid_request.
  • A chatbot key erases within its chatbot; an account key across every chatbot of its account. A dashboard key: 403 app_key_required.
  • 200 { "data": { "erased": { "contacts": 1, "conversations": 3, "messages": 41 } } } (messages counts texts too). Unknown people answer 200 with zeros.
  • Idempotency-Key is optional, up to 100 characters. The same Idempotency-Key with the same key answers the same result for 24 hours (409 idempotency_in_progress while it runs). A failure answers 500 erasure_failed: send it again; it is safe to repeat.

What goes: the person's conversations and messages with their files, drafts, ratings and closures; form answers and bookings tied to them; their campaign and takeover records; webhook deliveries carrying their number (and lead deliveries carrying their e-mail); their texts and calls (with recordings); and the contact itself, unless a chatbot outside a chatbot key's reach still has conversations with them (erase those with the account key). Usage counters, which hold no personal data, are kept. Because the contact goes, so does its WhatsApp opt-out: keep your own suppression list. An SMS opt-out stays, as a bare suppression record, so the number stays opted out of texts.

Per-business sending limits#

Every business on ChatSa sends WhatsApp through ChatSa's one WhatsApp app, so one business that sends spam could get WhatsApp restricted for all of them, your other customers included. ChatSa therefore watches each account and pauses the messages a business starts before WhatsApp acts, while its conversations keep working.

  • What is limited: WhatsApp templates (POST /whatsapp/messages with type: "template") and campaigns. Never limited: replies inside the 24-hour window, the inbox, ChatSa's AI replies, inbound messages, webhooks, SMS and calls.
  • States: ok; watch (nothing is refused: the account is close to a limit); paused (every template answers 403 sending_paused and campaigns wait). An account is paused on WhatsApp's own spam and quality signals (for example its spam rate limit, a locked or restricted account, or a red quality rating) or when many people reply STOP to its templates. A pause never lifts by itself: ChatSa reviews it with the business and resumes it.
  • New accounts may send at most 250 templates a UTC day until they have sent 250 templates over 7 days in a row without watch or paused. Over the cap a template answers 429 daily_cap_reached with Retry-After (seconds to the next 00:00 UTC). Accounts are judged as a whole, and each number on its own.
403 { "code": "sending_paused", "message": "ChatSa paused the messages this account starts…", "reasons": [{ "code": "meta_spam_limit", "message": "…" }], "since": "2026-12-01T10:00:00.000Z" }
429 { "code": "daily_cap_reached", "message": "This account has sent its 250 business-initiated messages for today. …", "daily_cap": 250, "sent_today": 250, "resets_at": "2026-12-02T00:00:00.000Z" }

Neither refusal uses up the Idempotency-Key. GET /partner/accounts/{external_ref} carries the account's safety: { state, reasons: [{ code, message, chatbot_id }], since, set_by, daily_cap, sent_today, resets_at } (daily_cap: null means no cap; chatbot_id names the number behind a reason, or null for the whole account). Every change of state or cap sends the account-level account.safety event to your account webhook.

What to do:

  • Before a campaign or a batch of templates, read safety and show the business its state, and its cap and what is left today.
  • On sending_paused, stop: don't retry, and don't move the sends to another number or account. Show the business the message; its inbox and replies keep working. The business contacts ChatSa to review and resume.
  • On daily_cap_reached, wait until resets_at; the cap is per account, not per number.
  • On account.safety, update the account's state on your side and hold your own queued sends while it is paused.
  • Send templates only to people who asked to hear from the business, and honour STOP (contact.opted_out tells you who to take off your lists).

Rate limits#

CredentialLimit
Client credentials (accounts, capabilities)60 calls a minute per app
Account key (partner calls)30 calls a minute per key
Chatbot key (Connect setup calls, erasures)30 calls a minute per key
Any key on /whatsapp/*, /sms/*, /voice/*60 writes and 600 reads a minute per key

Past a limit: 429 rate_limited with Retry-After.

Security notes#

  • Client secrets and keys are stored only as hashes. A chatbot key is created when you first read the connected signup, so it is never stored in readable form.
  • A signup id is random: whoever holds the window's URL can connect a number to that one account, once, for 30 minutes. Open it only for the signed-in customer it belongs to.
  • An account key reaches only its own account's chatbots, signups and events.