Skip to content
API docsOpen the app
ContentsQuick start

Quick start

Wagent's API lets your code read a WhatsApp number's chats, send through the owner's rules, handle approvals and receive signed webhooks. Every call goes to one base URL with one key.

Base URL#

Every path in these docs starts at https://mcp.wagent.sh/v1. Requests and answers are JSON. The API reference is generated from the same code that serves the API, so it is always current.

Make your first call#

Create a key on the Developers screen in the app (owners and admins). Try it in the sandbox first: nothing there reaches real people. Then read your profile:

curl https://mcp.wagent.sh/v1/me \
  -H "Authorization: Bearer wg_live_…"

The answer names the key's workspace, agent, key kind and granted scopes. A 401 means the key is missing, revoked or for the other environment.

Send a message#

Every write needs an Idempotency-Key header. When you reply to an event, use its event id, so a retry sends once. The message goes through the owner's rules, so it may be sent, wait for the owner's approval, or be held.

curl https://mcp.wagent.sh/v1/messages \
  -H "Authorization: Bearer wg_live_…" \
  -H "Idempotency-Key: <event id or a unique id>" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":"…","text":"Thanks, on its way"}'

Next steps#