Get started

Authentication

Your API key, how to send it, and what each scope allows.

Every request carries an API key in a header:

curl https://v3.ghala.io/v1/messages?limit=1 \
  -H "Authorization: Bearer $GHALA_KEY"

X-API-Key: <key> works too. A key in the query string is never read: those end up in proxy logs, browser history and support tickets, so the answer is 401.

What a key looks like

ghala_live_k3x9m2q7w4z5n8b6_Qm9sZWN0aW9uIG9mIDMyIHJhbmRvbSBieXRlcyBoZXJl
│     │    │                └─ secret, 43 characters. Shown once, never stored.
│     │    └─ key id, 16 characters
│     └─ live or test
└─ the same for every channel

The first three parts are the key's prefix. It is safe to show and to log, and it is how the dashboard lists your keys. Only a hash of the secret is kept, so a lost key is replaced, not recovered.

Keys made before the ghala_ marker start gsms_. They keep working until you revoke them.

The workspace is the key's

Nothing under /v1 takes a workspace id. A key acts in the workspace that made it, so it can never reach another.

Scopes

A key can do only what its scopes allow. A key with no scopes can do nothing.

ScopeAllows
messages:sendsend a message; launch, resume or retry a campaign
messages:readmessage history and the overview
contacts:readcontacts, groups and suppressions
contacts:writecreate, import and delete contacts; manage groups and suppressions
campaigns:readcampaigns, their runs and stats
campaigns:writecreate, edit, schedule, pause and cancel campaigns
sender_ids:readyour sender IDs
wallet:readthe balance and the ledger
templates:reada WhatsApp number's templates
numbers:readthe WhatsApp numbers the workspace has connected
otp:sendsend and resend one-time codes, and nothing else
otp:verifycheck a one-time code; spends nothing
products:readthe shop, its products, variants and stock
products:writecreate and change the shop, products, variants, images and files, and move stock
orders:readthe shop's orders and sales
orders:writetake an order and move it along its statuses
payments:writecharge an order through the shop's payment link
ai:readthe AI's uses and its takeover window
  • Launching a campaign needs messages:send, not campaigns:write: a key that may draft a campaign is not one that may message a hundred thousand people.
  • otp:send does not give messages:send. A key for your sign-in page can send codes and nothing else.
  • No key can create keys, start a top-up, connect a channel or change webhooks. Those are for signed-in owners and admins only.

When it fails

StatuscodeWhen
401unauthorizedno key, a malformed or unknown key, a wrong secret, a revoked or expired key, or the key's workspace is not active
403insufficient_scopethe key is valid but lacks the scope. Retrying with the same key will never help

Every 401 for a key looks the same, on purpose: telling a caller that the prefix was right but the secret wrong would say which half to keep guessing.

{
  "code": "insufficient_scope",
  "message": "this api key does not have the messages:send scope",
  "error": {
    "type": "forbidden",
    "code": "insufficient_scope",
    "reason": "this api key does not have the messages:send scope",
    "retryable": false,
    "request_id": "8efbea679d6cf36ccc35d998ab29aec0"
  }
}

On this page