Welkai API (1.0.0)
The Welkai API: send and read messages on every channel your business has connected, keep contacts in step with your CRM, start flows, run campaigns and appointments, and receive webhooks when something happens.
Address:
- Call your business's own address (
https://<name>.welkai.net, or your own domain once it is active). The same key does not work at another business's address (401wrong_address).
API keys:
- Make a key in the dashboard (API and webhooks, Tokens) and send it on every call as
Authorization: Bearer <key>. Keep it secret: it acts as the person who made it, never as the Owner, and never does more than that person may. - A key may end on a date you pick: after it, calls answer 401
token.expired. A deleted or unknown key answers 401unauthorized. - Each key has scopes:
read(see chats, contacts, reports and settings),send(reply in chats, schedule messages, send templates),contacts,flows(flows, auto-replies, AI knowledge),campaigns(broadcasts, email campaigns, festival wishes, templates),appointments,numbers(number settings and webhooks),settings, orall(everything the person may do). Each operation names the scope it needs inx-welkai-scope;alwaysmeans every key may call it. Some also needx-welkai-scope-also. A key without the scope gets 403token.not_allowedwith thescopeto tick. - Some things are never done with a key, whatever its scopes: money and billing, the team and roles, sign-in and security settings, keys themselves, the business's address and domains, outside credentials and wiping data. They are not in this file and answer 403
token.not_allowed. - A key may be limited to some numbers. Another number answers 404
DEVICE_NOT_FOUND, as if it did not exist.
Plans:
- Each operation names the plan feature it needs in
x-welkai-plan.api_basicis the basic API: sending (POST /send/*), contacts (list, read, add, edit, fields and tags), the CRM id lookup, starting a flow, the email templates to send, your numbers and who the key is (GET /auth/me). Everything else needsapi_mcp. - Without it: 403
{"error":"feature_not_in_plan","feature":"api_basic"|"api_mcp","message":<what to do>,"upgrade_url":"/billing"}. Keys are kept on a downgrade and work again after an upgrade.
Numbers and channels:
- Send
X-Device-Idon every call about one number (a number, account, Page or mailbox:GET /deviceslists the ones the key may use). With only one, it may be left out. - Every number has a
channel:whatsapp(a number linked by QR),whatsapp_api(an official WhatsApp Business API number),facebook,instagram,email(a Welkai mailbox or your own),telegram(a Telegram bot) ortelegram_account(a Telegram account). Official numbers, mailboxes, Pages and bots are connected from the dashboard; once connected they use the same routes as every number. - A route a channel has no equivalent for answers 404 with its own code:
meta.not_on_page(Facebook, Instagram),waapi.not_on_api(official number),email.not_on_email(mailbox),telegram.not_here(bot) ortelegram_account.not_here(account); a session route on such a number answers 400CHANNEL_UNSUPPORTED. - A number that is disconnected or not paired answers 409
DEVICE_NOT_READY. - Plan limits: past your plan's numbers, platforms or mailboxes, adding one answers 409
limit_reachedwithresourcenumbers,other_platformsormailboxes. - Facebook and Instagram: the recipient in
phoneis the person's id on that platform, passed through untouched. Message, link and typing work; image, video, audio and file need a public*_url(Meta fetches it); sticker, contact, location, poll and presence answer 400CHANNEL_UNSUPPORTED. Instagram also refuses audio. A refusal by Meta is 502FACEBOOK_API_ERRORwith Meta's words, except 409meta.token_dead(connect the Page again) and 409meta.window_closed(the person last wrote more than 24 hours ago). - Telegram:
phoneis a chat id (<user id>@tg,<chat id>@tg-group), a user id or an @username; a Telegram account also takes a phone number with its country code. Message ids are<chat id>:<message id>. Text is split at 4,096 characters; photos up to 10 MB, other files up to 50 MB. A bot cannot write first (telegram.not_started, with the bot's link inparams.link). Other refusals answer in plain words with their code, such astelegram.blocked,telegram.not_on_telegram,telegram.peer_unknown,telegram.file_too_bigandtelegram.rate_limited.
Errors:
- Refusals before your call reaches the route (sign-in, key rules, plan) are
{"error":<code>,"message":<plain words>}plus fields named with the code. Refusals from the route itself are{"code":<code>,"message":<plain words>,"results":...,"params":...}. Showmessageto people; act on the code. - 401
unauthorized,token.expired,wrong_address; 402restrictedorsuspended(the business's account); 403token.not_allowed,feature_not_in_plan,permission_required(the key's person lacks the permission named inpermission); 404 not found; 409 conflicts; 429 limits with aRetry-Afterheader; 503try_again.
Rate limits:
- 600 calls a minute per key; past it, 429
token.rate_limitedwithRetry-Afterin seconds. Refused calls count. Sends have their own safety limits (see the send tag).
Webhooks:
- Set a webhook address and secret per number (
PATCH /devices/{device_id}/webhook). The events are listed underwebhooks. Each is a POST with a JSON body (event,device_id,timestamp,payload) and the headersX-Welkai-Delivery(the delivery's id),X-Welkai-Attempt,X-Welkai-TimestampandX-Welkai-Signature(v1=and the hex HMAC-SHA256 of<timestamp>.<body>with your secret). - Answer 2xx within 10 seconds. Anything else is tried again: 10 tries over about 3 days (after 1, 5 and 15 minutes, 1, 3, 6, 12 and 24 hours, and 24 hours), then the delivery is marked failed; a 429 or 503 with
Retry-Afteris tried after that time. Deliveries are at least once and in no set order: useX-Welkai-Deliveryto drop repeats andtimestampto order. - Only same-host redirects are followed. Failed deliveries can be sent again (
/webhooks/deliveries).
Servers
Your business's address
https://{address}