Authentication & Device Selection
Authenticate requests using API keys and route operations to specific WhatsApp sessions.
The Wayits WhatsApp Gateway uses Bearer token authentication. Every request to a protected endpoint must include a valid API key.
Creating an API Key
- Log in to your Wayits dashboard.
- Select any WhatsApp session from the session switcher.
- Open API Management in the sidebar.
- Click Create key, enter a descriptive name, and copy the full key (
way-sk-...).
The full secret key is displayed only once upon creation. Store it securely in your environment variables or password manager.
Authorization Header
Include your API key in the Authorization HTTP header with the Bearer prefix:
Authorization: Bearer way-sk-0f76becc35ee71a6eed42a82999037720dde8686c0810a61Example Request
curl -X GET "https://your-domain.com/api/gateway/devices" \
-H "Authorization: Bearer $WAYITS_API_KEY"Selecting a WhatsApp Session (X-Device-Id)
A single Wayits account can connect multiple WhatsApp phone numbers (sessions). When calling an operation that acts on a device—such as sending a message—you must specify which device should execute the request.
You can specify the session using either an HTTP header or a query parameter:
- Header (Recommended):
X-Device-Id: 01a1c306-90c3-7284-b7a6-1fa5a72df9b1 - Query Parameter:
POST /api/gateway/send/message?device_id=01a1c306-90c3-7284-b7a6-1fa5a72df9b1
Device Selection Rules
- Single Device: If your account has exactly one connected WhatsApp session,
X-Device-Idis optional and will be inferred automatically. - Multiple Devices: If your account has more than one session,
X-Device-Idordevice_idis required. - Paths with
{device_id}: Endpoints that already contain the device ID in the path (e.g./devices/{device_id}/status) do not require the header. - Conflict Prevention: If both the header and query parameter are sent, their values must match, otherwise the server returns
400 Bad Request.