Skip to content

Developers

REST API reference (v1)

Send messages, upsert contacts, track events and list templates with an API key.

The API base URL is https://wap-production-ce44.up.railway.app/api/v1. Create keys in Settings → Developer; a key is shown once. Send it as Authorization: Bearer lfg_live_… (or the X-API-Key header). Each key allows 300 requests per minute.

Phone numbers can include a country code (919876543210) or be local if your workspace has a default country code set in Settings.

Send a message

curl -X POST https://wap-production-ce44.up.railway.app/api/v1/messages \
  -H "Authorization: Bearer lfg_live_XXXX" -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "type": "template",
    "template": { "name": "order_update", "language": "en", "body": ["Asha", "#1042"] },
    "callback_data": "order-1042"
  }'

type is template (default) or text. Text messages are only delivered inside the 24-hour customer service window; otherwise the API returns 409. A successful call returns 201 with { "result": true, "id": "…", "wamid": "…", "status": "…" }.

Upsert a contact

curl -X POST https://wap-production-ce44.up.railway.app/api/v1/contacts \
  -H "Authorization: Bearer lfg_live_XXXX" -H "Content-Type: application/json" \
  -d '{ "phone": "919876543210", "name": "Asha Rao", "email": "asha@example.com", "tags": ["vip"], "traits": { "city": "Pune" } }'

Tags are added, never removed; traits are merged. Returns { "result": true, "id": "…", "created": true }.

Track an event

curl -X POST https://wap-production-ce44.up.railway.app/api/v1/events \
  -H "Authorization: Bearer lfg_live_XXXX" -H "Content-Type: application/json" \
  -d '{ "phone": "919876543210", "event": "order_placed", "properties": { "order_id": "1042", "total": "1499" } }'

Starts any published flow whose trigger listens for that event name and returns 202.

List contacts and templates

  • GET /v1/contacts?limit=50&offset=0 — paginated, with has_next_page
  • GET /v1/templates — approved templates with their variable counts

Errors

StatusMeaning
401Missing, invalid or revoked API key
402A plan limit was reached (for example contacts)
404No approved template with that name and language
409No connected number, or the message can't be sent now (for example outside the 24-hour window)
422Validation error — the message explains what to fix
429Rate limit exceeded; retry after the Retry-After seconds

Something missing or unclear? Tell us and we'll improve this page.