API reference

The Jensia Connect 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 Connect"
  }'

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.
409SENDING_PAUSEDSending is paused for this number. Resume it in the dashboard.
409NO_ACTIVE_CONVERSATIONTyping can only be shown to a contact who wrote in the last 24 hours.
422NOT_ON_WHATSAPPThe recipient has no WhatsApp account.
422RECIPIENT_OPTED_OUTThe contact opted out. See opt-outs.
429NEW_CONTACT_LIMIT_REACHEDToday's cap on new contacts is used. Retry-After points to the daily reset.
429DUPLICATE_LIMIT_REACHEDThe same content already went to too many recipients in 24 hours.
429DAILY_LIMIT_REACHEDThe daily cap for number checks, new groups or group adds is used. See Retry-After.
429QUEUE_FULL10,000 messages are already waiting to be sent from this number.
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."}'

Protecting your number

WhatsApp bans numbers that message many strangers, get blocked or reported, or send the same message to many people. Every number on Jensia Connect has the safeguards below. They lower the risk of a ban; nothing can make a number unbannable. Sending bulk messages to people who did not ask for them is against our terms, and WhatsApp's.

A steady pace
Each number has its own queue, sent in order at a fixed number of messages a minute, never in bursts. That is why sending answers 202 with status: "queued". A message still waiting after 24 hours, for example while sending is paused, fails with EXPIRED.
A daily cap on new contacts
A new contact is a chat the number has never exchanged a message with. Starting too many in a day returns 429 NEW_CONTACT_LIMIT_REACHED. Replies and people you already talk to are never capped. Days reset at midnight in Nairobi (UTC+3).
Warm-up for new numbers
A newly linked number starts at 20% of the new-contact cap and rises evenly to the full cap over its warm-up period. A temporary ban from WhatsApp restarts the warm-up.
Repeated content slows down
The same text or media sent to many recipients within 24 hours is spaced out to one every 30 seconds past a threshold, and refused with 429 DUPLICATE_LIMIT_REACHED past a higher one. Write messages for the person receiving them.
Opt-outs are honoured
When a contact sends exactly STOP or UNSUBSCRIBE (you can change the words), sends to them are refused with 422 RECIPIENT_OPTED_OUT until they send START or you remove them. See Opt-outs.
A health score, and auto-pause
Every 5 minutes each number is scored from 0 to 100 on failed sends, numbers not on WhatsApp and how few new contacts ever reply: 80 and above is good, 50 to 79 fair, below 50 poor. Below 50, with auto-pause on, sending pauses: queued messages are held, new sends get 409 SENDING_PAUSED and you receive instance.paused. You can resume from the dashboard; auto-pause then stays off for 6 hours.
Daily caps on other actions
Number checks, groups created and people added to groups each have a daily cap. Past it, those calls return 429 DAILY_LIMIT_REACHED with a Retry-After header.

Limits depend on your plan, and the dashboard's Protection tab shows each number's score, today's usage and its queue. What protects a number most is simple: message people who expect to hear from you, make it easy to opt out, and let their replies lead the conversation.

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

Checks the message, adds it to this number's send queue and answers 202 Accepted with status: "queued". The queue is sent in order at a steady pace, so a message usually leaves within seconds, or later when many are waiting. Follow it with Get a message or the message.* webhook events.

Signatures are set per number in the dashboard (Settings → Signatures). The line is added below text messages and media captions, in italics by default; reactions, locations and voice notes are never signed. The message record keeps the signature in signature and the sender in sender_name. Signatures do not count toward the duplicate-message limit: the same text signed by different people is still one repeated message.

Before it is queued, the message is checked against the number's protection limits:

  • 409 SENDING_PAUSED sending is paused for this number.
  • 422 RECIPIENT_OPTED_OUT the contact opted out.
  • 429 NEW_CONTACT_LIMIT_REACHED today's new-contact cap is used. Retry-After points to the daily reset; replies to people who wrote to you still go through.
  • 429 DUPLICATE_LIMIT_REACHED the same content already went to too many recipients today.
  • 429 QUEUE_FULL 10,000 messages are already waiting.
{
  "to": "+254712345678",
  "type": "text",
  "text": "Hello from Jensia Connect"
}

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.
typing boolean | integer
Show “typing…” before the message: true, or a number of seconds from 1 to 10. Only shown when the contact wrote in the last 24 hours; otherwise the message goes out without it.
signature string | false
The key of one of the number’s saved signatures, or false to send without one. Leave it out to use the default signature, if one is set.
sender string
Who is sending, up to 60 characters. Fills {sender} in the signature, e.g. “— {sender}, Support” becomes “— Wanjiru, Support”. With no signature set, adds “— Wanjiru”.
Response
HTTP/1.1 202 Accepted

{
  "data": {
    "id": "0d9b7a52-6c1f-4f0e-9a51-2b7f6a3f0c11",
    "direction": "outbound",
    "chat": "254712345678",
    "to": "+254712345678",
    "from": null,
    "sender_name": null,
    "type": "text",
    "text": "Hello from Jensia Connect",
    "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, sending, sent, delivered and read, or ends at failed with an error_code. Read receipts depend on the recipient's privacy settings.

  • EXPIRED it was still queued after 24 hours.
  • MEDIA_DOWNLOAD_FAILED the media URL could not be downloaded.
  • SEND_FAILED WhatsApp did not accept the send.
  • SEND_INTERRUPTED the connection dropped while it was being sent.
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 Connect",
    "status": "delivered",
    "error_code": null,
    "is_group": false,
    "created_at": "2026-12-02T09:30:12Z"
  }
}

Show typing

POST/v1/typing

Shows “typing…” in a chat while your bot works on a reply, so the contact knows an answer is coming. It only works in an active conversation, where the contact wrote to this number in the last 24 hours; otherwise you get 409 NO_ACTIVE_CONVERSATION.

It makes a conversation feel natural. It does not change delivery and does not lower the risk of a ban.

Body

to string required
The contact, with country code.
state string
typing (the default), recording for “recording audio…”, or stop to clear it.
seconds integer
How long to show it, from 1 to 25. Defaults to 5.
Request
curl -X POST https://your-domain/v1/typing \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+254712345678", "seconds": 8}'
Response
{
  "data": {
    "to": "+254712345678",
    "state": "typing",
    "until": "2026-12-02T09:30:20Z"
  }
}

Check a number

POST/v1/numbers/check

Tells you whether a number has a WhatsApp account, so you can clean a list before sending.

Checks count towards a daily cap. Past it you get 429 DAILY_LIMIT_REACHED, with a Retry-After header that points to the daily reset.

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.

Creating groups and adding people to them each count towards a daily cap. Past it you get 429 DAILY_LIMIT_REACHED with a Retry-After header.

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 }
    ]
  }
}

Opt-outs

GET/v1/opt-outs

Contacts who sent one of the number's opt-out words, or whom you added. Sending to them fails with 422 RECIPIENT_OPTED_OUT until they send an opt-in word or you remove them.

  • GET/v1/opt-outs lists them.
  • POST/v1/opt-outs adds a phone_number, for someone who asked you to stop another way.
  • DELETE/v1/opt-outs/:phone removes one, so they can be messaged again.

source is keyword when the contact opted out by message (then keyword holds the word they sent), manual when added in the dashboard, or api. The words default to STOP and UNSUBSCRIBE to opt out and START to opt back in, and can be changed per number in the dashboard.

Request
curl -X POST https://your-domain/v1/opt-outs \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone_number": "+254712345678"}'
Response
{
  "data": {
    "phone": "+254712345678",
    "keyword": null,
    "source": "api",
    "created_at": "2026-12-02T09:30:12Z"
  }
}

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 sent you a message in a direct chat
group.message.receivedSomeone posted in a group. Only sent when group messages are set to "Log and send to webhook"
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
instance.pausedOutbound sending stopped, usually because the health score fell below 50. Queued messages are held
instance.resumedSending started again and held messages are going out
contact.opted_outA contact sent an opt-out word such as STOP. Sends to them are refused
contact.opted_inA contact sent an opt-in word such as START and can be messaged again
group.participantsMembers added, removed, promoted or demoted

For message.* events, data is the message record. For the connection events, instance.connected, disconnected, logged_out and banned, it is the instance, including the ban reason where relevant.

instance.paused carries the reason and the health score at the time. contact.opted_out and contact.opted_in carry the contact's phone and the keyword they sent.

Messages posted in groups are kept apart from direct chats. They are ignored unless the instance's group setting is Log and send to webhook; then each one arrives as group.message.received, with data.group holding the group's id and name, and data.message.from the member who posted it.

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.