BOOKBEYWhatsApp API

REST API & Postman

Overview

Prefer raw HTTP or a non-PHP/Node/Python stack? The REST API is a single JSON endpoint. A ready-to-import Postman collection is provided so you can try every call in seconds.

Download the collection

Get it from Client area → Downloads → REST API + Postman. It contains BOOKBEY-WhatsApp.postman_collection.json and REST-API.md.

Import & configure

In Postman: Import → drop the .json file → open the collection → Variables and set apiBase = https://bookbey.com/public/api, apiKey = your key, to = a test number. The collection uses Bearer auth from {{apiKey}}.

Authentication

Every request must carry your API key. Both header forms are accepted — use either one:

Authorization: Bearer YOUR_API_KEY
# or
X-API-Key: YOUR_API_KEY

Keys are issued per client in Client area → API Keys, are scoped to your account, and are stored only as hashes. Your API base URL is https://bookbey.com/public/api.

Send a message

PUT https://bookbey.com/public/api/send.php (POST is also accepted) with a JSON body.

curl -X PUT https://bookbey.com/public/api/send.php \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"9198XXXXXXXX","type":"text","text":"Hello!"}'

Payload types

The type field selects the message kind:

text:     {"to":"...","type":"text","text":"Hi"}
image:    {"to":"...","type":"image","media":"https://.../pic.jpg","caption":"Hi"}
document: {"to":"...","type":"document","media":"https://.../inv.pdf","filename":"inv.pdf","caption":"Your invoice"}
document (base64): {"to":"...","type":"document","data":"BASE64","filename":"inv.pdf"}
template: {"to":"...","type":"template","template":"invoice_due","lang":"en_US","params":["John","INV-1001","500"]}

Phone number format

Phone numbers are digits only, in international format without a leading + or spaces — country code followed by the number, e.g. 9198XXXXXXXX for India. Modules that take orders will prefix a configurable default country code to any local number that is missing one.

Responses

200 {"ok":true,"id":"wamid...","status":"sent","remaining":1999}
4xx {"ok":false,"error":"quota_exceeded","message":"..."}

Status & quota

Check your plan and remaining quota at any time:

curl https://bookbey.com/public/api/status.php -H "X-API-Key: YOUR_API_KEY"
=> {"ok":true,"plan":"Basic","limit":2000,"used":3,"remaining":1997}

Error codes

Errors are returned as JSON with ok:false, a machine-readable error code and a human message. The HTTP status reflects the error class.

HTTPerror codeMeaning & fix
401unauthorized / invalid_api_keyKey missing, wrong, or revoked. Re-copy it from API Keys.
402no_active_planNo active plan on the account. Buy or renew a plan.
403account_suspendedAccount suspended. Contact support / clear dues.
422invalid_jsonBody was not valid JSON. Check Content-Type and payload.
422invalid_numberDestination number malformed. Use country code + number, digits only.
429quota_exceeded / rate_limitedMonthly quota used up, or sending too fast. Check status.php; retry with backoff.
500server_errorTransient server error. Retry; if it persists, contact support.

Troubleshooting

  • 405 method_not_allowed: use PUT or POST, not GET, on send.php.
  • 422 invalid_json: send Content-Type: application/json and a well-formed body.
  • 401: the Authorization/X-API-Key header is missing or wrong.

Need help? Open a ticket from Client area → Support. Your API base URL is https://bookbey.com/public/api.