Authentication

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

Every call carries one credential in the Authorization header. Which one depends on who you are building for: your own workspace, an app other ChatSa customers connect, or a partner platform that creates ChatSa accounts. This page lists each credential, what it may call and how to keep it safe.

API keys (your own workspace)#

Create them in Dashboard → Developers → API keys and send them as a bearer token:

Authorization: Bearer csa_9f2c…

When you create a key you choose:

  • A name, so you can tell keys apart later (for example "CRM sync").
  • Scopes: what the key may do. A key with no scopes is the original read-only key for the older read endpoints.
  • Chatbots: the chatbots the key may use. None ticked means every chatbot of the workspace. A key limited to exactly one chatbot may leave chatbot_id out of WhatsApp calls.
ScopeAllows
whatsapp:readNumber status, templates, threads, media links, display name, voice settings and trained voices
whatsapp:sendSend messages, mark read and show typing, take a conversation over from the AI
whatsapp:manageCreate and delete message templates, change who answers (AI or Team only), voice-reply settings and the default voice, request and apply a display-name change
whatsapp:voiceVoice previews, trained voices for voice-note replies
sms:readSMS credentials status, numbers, message history, consent
sms:sendSend texts, record consent
sms:manageSave and remove Twilio credentials, connect and disconnect numbers, send a test text
voice:callStart a call from a connected number
voice:readCall history (with fresh recording links), number settings
voice:manageForwarding, voicemail, missed-call text and AI answering per number

The key is shown once, when it is created. ChatSa keeps only its hash. Revoke stops it at once; make a new key to replace a lost one.

Connect tokens (apps your users connect)#

An app registered in Dashboard → Developers → Apps gets a client id and a client secret. Existing ChatSa customers connect a chatbot to your app with "Connect with ChatSa"; you exchange the resulting code for an access token (csa_…), limited to that one chatbot and to the scopes the customer approved. Send it as a bearer token. It does not expire; it stops working when the customer disconnects your app or you call DELETE /connect. See Connect with ChatSa.

Partner credentials (account-creation tier)#

A partner platform holds three kinds of credential, from the same app:

CredentialHow you get itSent asUsed for
Client credentialsYour app's client id and secretAuthorization: Basic base64(client_id:client_secret)Creating, reading, updating, suspending and deleting accounts (/partner/accounts/*), and /partner/capabilities
Account keyReturned once when an account is created (or rotated)Authorization: Bearer csa_…Everything for one account: WhatsApp and Facebook signup windows, its numbers, its webhook, erasures, SMS and calls, and the WhatsApp API for any of its chatbots (chatbot_id required) with the WhatsApp scopes your app may use
Chatbot keyReturned once by a connected WhatsApp signupAuthorization: Bearer csa_…One number: the WhatsApp API and the Connect setup calls, exactly like a Connect token

Client credentials only work once your app has the account-creation tier (otherwise 403 provisioning_not_allowed). See the partner API.

Which credential works where#

CallsAPI keyConnect token / chatbot keyAccount keyClient credentials
/whatsapp/*yes, by scope and chatbotyes, its chatbotyes, chatbot_id requiredno
/sms/*, /voice/*yes, by scopenoyesno
/connect, /connect/webhook, /connect/contextno (403 app_token_required)yesno (403 app_token_required)no
/connect/tokennononoyes, in the request body
/partner/accounts/*, /partner/capabilitiesnononoyes
/partner/whatsapp/*, /partner/facebook/*, /partner/webhookno (403 account_key_required)no (403 account_key_required)yesno
/partner/erasuresno (403 app_key_required)yes, its chatbotyes, the whole accountno
/conversations, /contacts, /analyticsyes; a key limited to chatbots reads only theirs, and not /contacts (403 workspace_key_required)use the WhatsApp API's threads insteaduse the WhatsApp API's threads insteadno

A missing, wrong or revoked key answers 401 unauthorized. A valid key without the needed scope or chatbot answers 403 forbidden.

Keeping credentials safe#

  • Use them only from your server. Never put a key or client secret in a browser, a mobile app or a URL.
  • Store them encrypted, one per environment. ChatSa can't show them again, so keep them where your deploys read them.
  • Give each key only the scopes and chatbots it needs.
  • Rotate when someone who saw a secret leaves or a secret may have leaked:
    • API key: create a new key, deploy it, revoke the old one.
    • Client secret: Rotate secret on your app's page. The old secret stops working at once, so deploy the new one right away.
    • Account key: PUT /partner/accounts/{external_ref}?rotate=1 returns a new key and revokes the old one. The account's webhook and numbers are kept.
    • Webhook signing secret: every PUT of a Connect or partner webhook returns a new one; for dashboard endpoints, add a new endpoint and delete the old.
  • Treat 401 on a Connect token or chatbot key as "disconnected" and offer to connect again.