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.

Header
Authorization: Bearer YOUR_API_KEY

Keep 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.

Success
{
  "data": { … }
}
Error
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Enter a phone number with a country code.",
    "details": { "to": "Missing country code" }
  }
}
StatusCodeWhat it means
400VALIDATION_ERRORA field is missing or malformed. details names each field.
401UNAUTHENTICATEDThe API key is missing or wrong.
403SUBSCRIPTION_REQUIREDThe account has no active plan or trial.
403PLAN_LIMIT_REACHEDThe plan's daily message or instance limit is used up.
404NOT_FOUNDThe message, group or resource does not exist.
409NOT_CONNECTEDThe number is not linked or is reconnecting. Retry shortly.
409INSTANCE_BANNEDWhatsApp has restricted the number. See ban on the instance.
422NOT_ON_WHATSAPPThe recipient has no WhatsApp account.
429RATE_LIMITEDSlow 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.

Request
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.

Request
curl https://your-domain/v1/instance \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "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

to string required
A phone number with country code, or a group id ending in @g.us.
type string required
text, image, video, audio, document, location or reaction.
text string
The message, for type text.
media object
For media types: url (public HTTPS link), optional caption and file_name.
location object
For type location: latitude, longitude and an optional name.
reaction object
For type reaction: the message_id to react to and an emoji.
reply_to string
Quote an earlier message by its id.
Response
{
  "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.

Request
curl https://your-domain/v1/messages/0d9b7a52-6c1f-4f0e-9a51-2b7f6a3f0c11 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "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_number string required
The number to look up, with country code.
Request
curl -X POST https://your-domain/v1/numbers/check \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone_number": "+254712345678"}'
Response
{
  "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/groups lists groups.
  • POST/v1/groups creates one from name and participants.
  • GET/v1/groups/:id returns one group.
  • POST/v1/groups/:id/participants takes an action of add, remove, promote or demote and a list of participants.

To message a group, use its id as to when sending.

Request
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"]}'
Response
{
  "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.

Webhook request
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

EventSent when
message.receivedA contact or group member sent a message
message.sentWhatsApp accepted a message you sent
message.deliveredIt reached the recipient's phone
message.readThe recipient opened it
message.failedA send could not be completed
instance.connectedThe number is linked and online
instance.disconnectedThe connection dropped
instance.logged_outThe phone removed this linked device
instance.bannedWhatsApp restricted the number
group.participantsMembers 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.