Browse the docs

API

Getting started

The gdwa api lets your own systems (a CRM, a website, a billing tool) send WhatsApp messages and templates through your business, hear about replies, and build automations. Requests and answers are JSON and use your business's own ids, never WhatsApp's.

The api is part of some plans only. When your plan does not include it, every request is refused with a 402 that says so.

Make an api key

Only admins can make keys.

  1. In the sidebar, open Settings.
  2. In the Api panel, click Keys and webhook.
  3. Under Api keys, type what the key is for (such as "CRM" or "website") and click Make a key.
  4. The dialog Your new key shows the key once. Click Copy, keep it somewhere safe, then click Done. After this only its start is shown.

Give each system its own key, so you can stop one without touching the others. To stop a key, click the bin beside it and then Revoke. It stops working at once. The list also shows when each key was made and Last used.

Every key of a business can do everything the api offers. Your plan may limit how many keys you can have.

Send the key

Send the key on every request in the Authorization header:

Authorization: Bearer lms_your_key

A missing, wrong or revoked key gets a 401. A sign-in from the app is not accepted here, and a key works only on the api.

Every address in these pages starts with https://gdwaapi.grapedawn.tech/api/v1. Send bodies as JSON with Content-Type: application/json.

Limits

  • At most 120 requests a minute per key. Over that you get a 429: wait a moment and try again.
  • Your plan may also set how many requests a minute your whole business can make. Over that you get a 429 with a Retry-After header giving the seconds to wait.
  • Messages sent through the api count toward your plan's monthly message allowance, and a new number you message counts toward its contacts.
  • When a business is suspended, every request gets a 403. When its plan has ended, reading still works but anything that changes data gets a 403.

Read an error

Any refused request comes back with a 4xx status and a JSON body with a message you can show or log:

{
  "statusCode": 422,
  "message": "Send either text or a template.",
  "error": "Unprocessable Entity"
}

When a field is the wrong shape, the status is 400 and message is a list:

{
  "statusCode": 400,
  "message": ["to must be a phone number, such as +919800000001"],
  "error": "Bad Request"
}

Fields the route does not know are refused the same way. A plan refusal is a 402 with a message and a code (PLAN_FEATURE or PLAN_LIMIT). When WhatsApp itself refuses a message, the status is 400 with the reason in message; when WhatsApp cannot be reached, it is 424.

StatusMeans
400A field is missing or the wrong shape
401No valid key
402Your plan does not allow it
403The business is suspended, or its plan has ended
404No such message, template, contact or automation
422The request is understood but cannot be done, with the reason
429Too many requests

Your first request

List the templates you can send. It is a safe way to check your key works:

curl https://gdwaapi.grapedawn.tech/api/v1/templates \
  -H "Authorization: Bearer lms_your_key"

Then send one:

curl https://gdwaapi.grapedawn.tech/api/v1/messages \
  -H "Authorization: Bearer lms_your_key" \
  -H "Content-Type: application/json" \
  -d '{"to": "+919800000001", "template": {"name": "order_update", "language": "en", "variables": {"1": "Asha", "2": "#1234"}}}'

See Inbox for sending and reading messages, Templates for filling in a template, and Webhook to hear about replies as they happen.