WAHooks
API Reference

API Overview

WAHooks REST API reference

Base URL: https://api.wahooks.com/api

Authentication

All endpoints (except health check) require authentication via the Authorization header:

Authorization: Bearer wh_your_api_token

Both API tokens (wh_...) and Supabase JWTs are accepted. See API Tokens for details.

Response format

All responses are JSON. Successful responses return the resource directly. Errors return:

{
  "message": "Connection not found",
  "error": "Not Found",
  "statusCode": 404
}

Status codes

CodeMeaning
200Success
201Created (POST requests)
401Invalid or missing authentication
403Forbidden (resource belongs to another user)
404Resource not found
503Service unavailable (worker still booting)

Rate limiting

Limits are per API token and per endpoint, counted over a rolling minute:

  • 60 requests a minute per connection. Each connection has its own allowance, so a busy connection never uses up another's.
  • 1,000 requests a minute per token across all its connections.

A request over either limit gets a 429 response. Wait a minute before retrying that endpoint for that connection.

Connections

MethodEndpointDescription
GET/connectionsList all connections
POST/connectionsCreate a new connection
POST/connections/get-or-createGet a scannable connection (reuses idle or creates new)
GET/connections/:idGet connection details
PATCH/connections/:idUpdate connection (e.g. rename)
DELETE/connections/:idDelete a connection
POST/connections/:id/restartRestart a connection
GET/connections/:id/qrGet QR code for linking
GET/connections/:id/chatsList chats (enriched: name, picture, isGroup, lastMessage, unread)
GET/connections/:id/meGet WhatsApp profile info
GET/connections/:id/media/:filenameProxy a media file from the WAHA worker (streams the file)

Message history & contacts (read)

MethodEndpointDescription
GET/connections/:id/chatsList chats — ?limit=&offset=&unread_only=true. Each item: id, name, picture, isGroup, lastMessage {body,timestamp,fromMe}, unread. 502 if a connected connection's chats can't be loaded
GET/connections/:id/chats/:chatId/messagesPage of messages, newest-first — ?limit=&before=<cursor>
GET/connections/:id/messages/:messageId?chatId=A single message by id (chatId required)
GET/connections/:id/messages/:messageId/media?chatId=Stream that message's media (chatId required)
GET/connections/:id/contactsList contacts — ?limit=&offset=. Each item: jid, name, phoneNumber, isGroup

Message shape (returned by the message endpoints):

{
  "id": "true_111@g.us_ABC",
  "chatId": "111@g.us",
  "timestamp": 1782419739,
  "fromMe": false,
  "senderJid": "918383880642@s.whatsapp.net",
  "senderPushName": "Alice",
  "type": "text",
  "text": "hello",
  "quotedMessageId": null,
  "media": null
}

type is one of text, image, video, audio, document, location, contact. When media is present, media.url is a WAHooks media-proxy URL you fetch with the same Authorization: Bearer header.

Pagination. GET /chats/:chatId/messages returns:

{ "messages": [ /* newest-first */ ], "nextBefore": "MTA0", "historyStartsAt": null }

Pass the returned nextBefore as ?before= to fetch the next (older) page. When nextBefore is null you've reached the end, and historyStartsAt is set to the oldest message's timestamp — use it to distinguish "no messages" from "history doesn't reach further".

These endpoints proxy WAHA's live NOWEB store. Media can return 404 for older messages — WhatsApp media keys expire and blobs live on the worker's local disk (no durable store in this phase). History reaches back only as far as WhatsApp's sync at pairing time. Server-side message search is not available.

Messaging

MethodEndpointDescription
POST/connections/:id/sendSend a text message
POST/connections/:id/send-imageSend an image (URL or base64)
POST/connections/:id/send-documentSend a document/file
POST/connections/:id/send-videoSend a video
POST/connections/:id/send-audioSend audio/voice
POST/connections/:id/send-locationSend a location pin
POST/connections/:id/send-contactSend a contact card
POST/connections/:id/reactReact to a message with an emoji
PUT/connections/:id/messages/:messageIdEdit a sent message's text ({ chatId, text })

The send endpoint accepts an optional replyTo field (message ID) to quote a specific message.

Editing is subject to WhatsApp's rules: you can only edit your own messages, within ~15 minutes of sending. Later edits return 400. The send endpoints return the new message's id, which you pass to the edit endpoint.

All send endpoints include human-like presence by default: a read receipt, then the typing indicator for 1–3 s plus 50 ms per character (at most 5 s), then the message. Pass skipPresence: true in the request body to disable this when handling presence yourself.

Presence

MethodEndpointDescription
POST/connections/:id/mark-readSend read receipt (blue ticks)
POST/connections/:id/typingStart typing indicator
POST/connections/:id/typing/stopStop typing indicator

All three accept { "chatId": "..." } in the request body, and target the same chat a send to that chatId would.

Typing while you work. Typing you start with /typing counts toward the next send's presence delay. Start it as soon as a message arrives (for example while an AI agent writes its reply) and the reply goes out almost at once, with the contact having seen "typing…" the whole time:

  • The indicator is kept alive (re-sent every 10 s) for up to 2 minutes, or until you send or call /typing/stop. Call /typing again to extend it.
  • The send marks the chat read, waits for whatever part of the delay your typing hasn't covered, then sends.
  • It only applies in a conversation: a chat that hasn't messaged the connection in the last 24 hours gets the full delay. Use the chat ID from the incoming message for both typing and the reply.
  • Any send ends the typing, including one with skipPresence: true. Call /typing/stop if you decide not to reply.

Groups

MethodEndpointDescription
POST/connections/:id/groupsCreate a group ({ name, participants }); returns the group and notAdded
GET/connections/:id/groups/:groupIdGroup name, description, members (id, phone, lid, name, role, isMe)
PATCH/connections/:id/groups/:groupIdRename ({ name })
POST/connections/:id/groups/:groupId/participants/addAdd people; one result per person
POST/connections/:id/groups/:groupId/participants/removeRemove people; one result per person
POST/connections/:id/groups/:groupId/leaveLeave the group
GET/connections/:id/groups/:groupId/invite-linkThe group's invite link (POST …/invite-link/revoke replaces it)

Webhooks

MethodEndpointDescription
GET/connections/:cid/webhooksList webhooks for a connection
POST/connections/:cid/webhooksCreate a webhook
PUT/webhooks/:idUpdate a webhook
DELETE/webhooks/:idDelete a webhook
GET/webhooks/:id/logsGet delivery logs
POST/webhooks/:id/testSend a test event

API Tokens

MethodEndpointDescription
GET/tokensList active tokens
POST/tokensCreate a new token
DELETE/tokens/:idRevoke a token

Real-time Events

MethodEndpointDescription
WebSocket/ws?token=wh_...Real-time event stream. Receives all WAHA events for your connections. Auto-scoped to the authenticated user.

Connect with any WebSocket client. Events arrive as JSON:

{
  "event": "message",
  "connectionId": "c1a2b3c4-...",
  "payload": {
    "from": "1234567890@c.us",
    "body": "Hello"
  },
  "timestamp": "2026-03-27T12:00:00.000Z"
}

When a message includes media (image, video, document, audio), the payload contains hasMedia: true and a media object with a proxied URL you can fetch directly:

{
  "event": "message",
  "connectionId": "c1a2b3c4-...",
  "payload": {
    "from": "1234567890@c.us",
    "body": "Check this photo",
    "hasMedia": true,
    "media": {
      "url": "https://api.wahooks.com/api/connections/c1a2b3c4-.../media/photo.jpeg",
      "mimetype": "image/jpeg"
    }
  },
  "timestamp": "2026-03-27T12:00:00.000Z"
}

The media.url points to the media proxy endpoint (/connections/:id/media/:filename), which streams the file from the internal WAHA worker. The URL requires authentication (same Authorization header as other endpoints).

See the TypeScript SDK or Python SDK for client libraries.

Billing

MethodEndpointDescription
GET/billing/statusSubscription and slot status
GET/billing/can-createCheck if a new connection can be created
PUT/billing/slotsSet number of connection slots (charges immediately)
POST/billing/checkoutCreate Stripe checkout session (first-time setup)
POST/billing/portalOpen Stripe customer portal

Programmatic slot management

After completing checkout once (to add a payment method), you can scale slots entirely from code:

# Set to 10 slots — charges prorated difference immediately
curl -X PUT https://api.wahooks.com/api/billing/slots \
  -H "Authorization: Bearer wh_..." \
  -H "Content-Type: application/json" \
  -d '{"quantity": 10}'

Response:

{
  "slots": 10,
  "status": "upgraded",
  "proratedAmount": 2.25,
  "currency": "usd"
}
  • status: "upgraded", "downgraded", or "unchanged"
  • proratedAmount: the amount charged (positive) or credited (negative) immediately
  • Maximum 100 slots per account by default. Contact support for higher limits.
  • If payment fails, the request returns 400 and the subscription remains unchanged.

Other

MethodEndpointDescription
GET/Health check (no auth required)

On this page