API reference
The Jensia WhatsApp API is JSON over HTTPS. Each linked number, called an instance, has its own API key. Link a number in the dashboard, then send your first message.
- Base URL
https://your-domain/v1- Format
- JSON request and response bodies, UTF-8
- Timestamps
- ISO 8601 in UTC, for example
2026-12-02T09:30:12Z
curl -X POST https://your-domain/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+254712345678",
"type": "text",
"text": "Hello from Jensia WhatsApp"
}'Authentication
Send the instance's API key as a bearer token on every request. You see the full key once, when the instance is created or the key is rotated; after that the dashboard shows only its prefix.
Authorization: Bearer YOUR_API_KEYKeep keys on your server. Rotating a key in the dashboard revokes the old one immediately.
Responses and errors
A successful response wraps its result in data. A failed one returns an HTTP status of 400 or
above and an error object with a stable code you can branch on.
{
"data": { … }
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "Enter a phone number with a country code.",
"details": { "to": "Missing country code" }
}
}| Status | Code | What it means |
|---|---|---|
| 400 | VALIDATION_ERROR | A field is missing or malformed. details names each field. |
| 401 | UNAUTHENTICATED | The API key is missing or wrong. |
| 403 | SUBSCRIPTION_REQUIRED | The account has no active plan or trial. |
| 403 | PLAN_LIMIT_REACHED | The plan's daily message or instance limit is used up. |
| 404 | NOT_FOUND | The message, group or resource does not exist. |
| 409 | NOT_CONNECTED | The number is not linked or is reconnecting. Retry shortly. |
| 409 | INSTANCE_BANNED | WhatsApp has restricted the number. See ban on the instance. |
| 422 | NOT_ON_WHATSAPP | The recipient has no WhatsApp account. |
| 429 | RATE_LIMITED | Slow down and retry after the Retry-After header. |
Statuses of 500 and above are safe to retry with backoff.
Safe retries
A network timeout does not tell you whether a message went out. Add an Idempotency-Key header
with a unique value per message, such as your own order or notification id. If you repeat a request with the
same key, you get the original message back and nothing is sent twice.
curl -X POST https://your-domain/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: order-2291-shipped" \
-H "Content-Type: application/json" \
-d '{"to": "+254712345678", "type": "text", "text": "Your order has shipped."}'Get the instance
GET/v1/instance
Returns the number this key belongs to and whether it can send right now. status is one of created, qr, pairing, connecting, connected, disconnected, logged_out or banned.
When WhatsApp restricts a number, ban holds a reason and an expires_at time, or null when no end is known.
curl https://your-domain/v1/instance \
-H "Authorization: Bearer YOUR_API_KEY"{
"data": {
"id": "3f6c1c1e-2a0b-4c58-9d0f-1e7b8a6c4d20",
"name": "Support line",
"status": "connected",
"phone_number": "+254712345678",
"ban": null
}
}Send a message
POST/v1/messages
Queues a message and answers 201 with the message record. Track its progress with the id, or
subscribe to the message.* webhook events.
{
"to": "+254712345678",
"type": "text",
"text": "Hello from Jensia WhatsApp"
}Body
tostring required- A phone number with country code, or a group id ending in @g.us.
typestring required- text, image, video, audio, document, location or reaction.
textstring- The message, for type text.
mediaobject- For media types: url (public HTTPS link), optional caption and file_name.
locationobject- For type location: latitude, longitude and an optional name.
reactionobject- For type reaction: the message_id to react to and an emoji.
reply_tostring- Quote an earlier message by its id.
{
"data": {
"id": "0d9b7a52-6c1f-4f0e-9a51-2b7f6a3f0c11",
"direction": "outbound",
"chat": "254712345678",
"to": "+254712345678",
"from": null,
"sender_name": null,
"type": "text",
"text": "Hello from Jensia WhatsApp",
"status": "queued",
"error_code": null,
"is_group": false,
"created_at": "2026-12-02T09:30:12Z"
}
}Get a message
GET/v1/messages/:id
Returns one message. An outbound message moves through queued, sent, delivered and read, or ends at failed with an error_code. Read receipts depend on the recipient's privacy settings.
curl https://your-domain/v1/messages/0d9b7a52-6c1f-4f0e-9a51-2b7f6a3f0c11 \
-H "Authorization: Bearer YOUR_API_KEY"{
"data": {
"id": "0d9b7a52-6c1f-4f0e-9a51-2b7f6a3f0c11",
"direction": "outbound",
"chat": "254712345678",
"to": "+254712345678",
"from": null,
"sender_name": null,
"type": "text",
"text": "Hello from Jensia WhatsApp",
"status": "delivered",
"error_code": null,
"is_group": false,
"created_at": "2026-12-02T09:30:12Z"
}
}Check a number
POST/v1/numbers/check
Tells you whether a number has a WhatsApp account, so you can clean a list before sending.
Body
phone_numberstring required- The number to look up, with country code.
curl -X POST https://your-domain/v1/numbers/check \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone_number": "+254712345678"}'{
"data": {
"phone_number": "+254712345678",
"on_whatsapp": true
}
}Groups
GET/v1/groups
List the groups the number belongs to, create one, or change its members.
- GET
/v1/groupslists groups. - POST
/v1/groupscreates one fromnameandparticipants. - GET
/v1/groups/:idreturns one group. - POST
/v1/groups/:id/participantstakes anactionofadd,remove,promoteordemoteand a list ofparticipants.
To message a group, use its id as to when sending.
curl -X POST https://your-domain/v1/groups/[email protected]/participants \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action": "add", "participants": ["+254712345678"]}'{
"data": {
"id": "[email protected]",
"name": "Order updates",
"participants": [
{ "phone_number": "+254712345678", "admin": false }
]
}
}Receiving events
Set a webhook URL on an instance and choose the events you want. We send each event as a JSON POST. Answer with any 2xx status within 10 seconds; do slow work after you respond.
POST https://your-app.example/webhooks/whatsapp
X-Jensia-Event: message.received
X-Jensia-Delivery: 7c1d2f0a-93b4-4e55-8f0e-5a1b7d9c2e44
X-Jensia-Signature: t=1796203812,v1=5f8d…c2a1
{
"id": "7c1d2f0a-93b4-4e55-8f0e-5a1b7d9c2e44",
"event": "message.received",
"instance_id": "3f6c1c1e-2a0b-4c58-9d0f-1e7b8a6c4d20",
"created_at": "2026-12-02T09:30:12Z",
"data": {
"id": "b1f0c9d2-7a3e-4a65-8c11-9d2e4f6a7b80",
"direction": "inbound",
"chat": "254712345678",
"from": "+254712345678",
"sender_name": "Amina",
"type": "text",
"text": "Is my order on the way?",
"status": "received",
"is_group": false,
"created_at": "2026-12-02T09:30:11Z"
}
}X-Jensia-Delivery is unique per event and repeats on retries. Store it and skip any id you have
already processed.
Event types
| Event | Sent when |
|---|---|
message.received | A contact or group member sent a message |
message.sent | WhatsApp accepted a message you sent |
message.delivered | It reached the recipient's phone |
message.read | The recipient opened it |
message.failed | A send could not be completed |
instance.connected | The number is linked and online |
instance.disconnected | The connection dropped |
instance.logged_out | The phone removed this linked device |
instance.banned | WhatsApp restricted the number |
group.participants | Members added, removed, promoted or demoted |
For message.* events, data is the message record. For instance.* events it is the instance, including the ban reason where relevant.
Verify the signature
Every request carries X-Jensia-Signature: t=<unix time>,v1=<signature>. The
signature is the hex HMAC-SHA256 of <t>.<raw body>, keyed with the instance's
webhook secret. Compute it over the raw bytes you received, compare in constant time, and reject requests
whose timestamp is more than five minutes old.
import crypto from "node:crypto";
// rawBody must be the exact bytes of the request, before any JSON parsing.
export function verify(rawBody, signatureHeader, secret) {
const parts = Object.fromEntries(
signatureHeader.split(",").map((part) => part.split("="))
);
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
const valid =
expected.length === parts.v1.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
return fresh && valid;
}Retries
If your endpoint times out or answers with an error, we retry with increasing delays for up to 24 hours. The dashboard's delivery log shows each attempt with the status your server returned, and lets you resend an event by hand.