Welkai

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 (401 wrong_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 401 unauthorized.
  • 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, or all (everything the person may do). Each operation names the scope it needs in x-welkai-scope; always means every key may call it. Some also need x-welkai-scope-also. A key without the scope gets 403 token.not_allowed with the scope to 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_basic is 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 needs api_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-Id on every call about one number (a number, account, Page or mailbox: GET /devices lists 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) or telegram_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) or telegram_account.not_here (account); a session route on such a number answers 400 CHANNEL_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_reached with resource numbers, other_platforms or mailboxes.
  • Facebook and Instagram: the recipient in phone is 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 400 CHANNEL_UNSUPPORTED. Instagram also refuses audio. A refusal by Meta is 502 FACEBOOK_API_ERROR with Meta's words, except 409 meta.token_dead (connect the Page again) and 409 meta.window_closed (the person last wrote more than 24 hours ago).
  • Telegram: phone is 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 in params.link). Other refusals answer in plain words with their code, such as telegram.blocked, telegram.not_on_telegram, telegram.peer_unknown, telegram.file_too_big and telegram.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":...}. Show message to people; act on the code.
  • 401 unauthorized, token.expired, wrong_address; 402 restricted or suspended (the business's account); 403 token.not_allowed, feature_not_in_plan, permission_required (the key's person lacks the permission named in permission); 404 not found; 409 conflicts; 429 limits with a Retry-After header; 503 try_again.

Rate limits:

  • 600 calls a minute per key; past it, 429 token.rate_limited with Retry-After in 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 under webhooks. Each is a POST with a JSON body (event, device_id, timestamp, payload) and the headers X-Welkai-Delivery (the delivery's id), X-Welkai-Attempt, X-Welkai-Timestamp and X-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-After is tried after that time. Deliveries are at least once and in no set order: use X-Welkai-Delivery to drop repeats and timestamp to order.
  • Only same-host redirects are followed. Failed deliveries can be sent again (/webhooks/deliveries).
Servers
Your business's address
https://{address}