İçeriğe geç

API keys

Creating a key to send messages from your own system, and your first request.

API keys connect your own systems (your online store, CRM or order software) to Broadycast. With a key, a server can send messages and close conversations. A typical use is sending a customer an approved template when they place an order.

Before you start

  • You need to be the organization owner or an admin.
  • API and webhooks must be included in your plan. If it isn’t, the screen says “API and webhooks isn’t in your plan”.
  • The workspace needs a connected channel. Keys belong to a channel: a key only acts on behalf of the selected channel.

Creating a key

  1. Open Settings › API keys. If you have more than one channel, choose the Channel the key will act for at the top.
  2. Select New key.
  3. In Key name, say where it’s used (for example “Shopify sync”). Add a Description if you like.
  4. Choose when it Expires: 30 days, 90 days, 6 months, 1 year or never.
  5. Select Create key.
  6. The full key is shown only now. Copy it into a password manager or your server’s secrets, then select I’ve saved it somewhere safe.

Give each integration its own key. If one leaks, you only revoke that one and your other systems keep working. Keys without an expiry aren’t recommended: a leaked key works until you revoke it.

Your first request

Send the key in the X-API-Key header of every request. The Your first request box on the screen has an example you can copy and try right away with Copy code. It sends a text message to one person:

A POST /api/v1/public/send-message request with destination (the number in international format, e.g. +905551234567), contentType (text) and content (the message text) in the body.

The server address is in the example on screen. Replace $BROADYCAST_KEY with your own key.

What you can do

EndpointWhat it doesCredits
/api/v1/public/send-messageWhat it doesSends text, an image, audio, video or a document into an open WhatsApp conversation. The person must have written to you in the last 24 hours.CreditsFree
/api/v1/public/send-template-messageWhat it doesSends an approved WhatsApp template; no 24-hour window needed. You fill in the template’s variables in the request.CreditsUses credits
/api/v1/public/instagram/send-messageWhat it doesSends a message to someone on Instagram.CreditsUses credits
/api/v1/public/close-sessionWhat it doesCloses a conversation.CreditsFree

For how credits work, see Credits, plans and payment. For the 24-hour rule, see Sending messages and the 24-hour window.

Managing keys

The Keys list shows each key’s first characters, its status (Active, Revoked, Expired), when it was Last used and when it Expires.

  • Revoke: requests with the key are rejected right away. Systems using it will need a new key.
  • Delete: the key leaves the list. This can’t be undone.

To receive incoming messages and message statuses on your own server, use a webhook rather than a key; see Webhooks.

Common errors

Frequently asked

The key may be wrong, revoked or expired. Check its status in the list and create a new one if needed. Make sure you send it in the X-API-Key header.
The person hasn’t written to you in the last 24 hours. Outside the window you can only send an approved template: use the send-template-message endpoint.
The person may have opted out of that template’s category, or you may not have enough credits. Check the explanation in the error message.
Keys belong to a channel. Connect one first; see Connect your WhatsApp number.

Didn’t find what you need?

Write to us; we’ll look into it and update these guides if needed.

Send an email