← chatflow.biz
ChatFlow API v1

Connect your own system to ChatFlow

One API for all of ChatFlow: chats and messages on WhatsApp, Instagram, Messenger, Telegram and TikTok, contacts, deals, publishing, and webhooks that tell your system the moment something happens. The channel is a field on the data, so a WhatsApp-only integration simply ignores the rest.

Quick start

  1. In ChatFlow, the organization owner opens Settings → API and MCP and creates an API key (it is shown once).
  2. To send messages or publish, the owner also turns on Allow agents to send messages / …publish posts on the same page.
  3. Call the API with the key as a Bearer token:
curl https://chatflow.biz/api/v1/channels \
  -H "Authorization: Bearer cfk_…"
curl -X POST https://chatflow.biz/api/v1/conversations/CONVERSATION_ID/messages \
  -H "Authorization: Bearer cfk_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 9b2f…" \
  -d '{"text":"Your order is ready"}'

Keys, plans and limits

  • Base URL: https://chatflow.biz/api/v1. JSON in and out, ISO 8601 dates.
  • Auth: Authorization: Bearer cfk_…. The same keys work for AI agents (MCP). A key belongs to one organization.
  • Plans: the API and webhooks are on every paid plan (Starter, Pro, Max). Sending counts toward the plan's monthly message limit, exactly as in the app.
  • Requests: 60 per minute per key on Starter, 300 on Pro and Max. Over that you get 429 with Retry-After.
  • Read-only keys can read everything but change nothing (403 read_only_key).

Errors

Every error has the same shape: {"error": {"code": "…", "message": "…"}}. The message is written for people — show it to your user.

400invalid_request, request_failed: bad input, or the channel refused (the message says why)
401unauthorized: missing, invalid, expired or revoked key
402API_LOCKED, MESSAGE_CAP…: the plan does not include this, or a plan limit is reached
403read_only_key, sending_disabled: see keys above
404not_found: no such record in your organization
429rate_limited: retry after a minute

Lists and paging

Lists take ?limit= (1–100, default 25) and ?cursor=, and return {"data": [...], "nextCursor": "…" | null}. Pass nextCursor back as cursor until it is null. With a channel filter a page may hold fewer items than limit — keep going until nextCursor is null.

Channels

GET /channelsConnected accounts: id, channel (whatsapp, instagram, messenger, telegram, tiktok, threads, x), label, capabilities
GET /channels/{id}/templatesApproved WhatsApp templates (official WhatsApp connection only). ?status=all lists every template with its review status

WhatsApp templates: create, edit, delete

Your customers create message templates inside your product, without Meta's WhatsApp Manager. ChatFlow sends each one to Meta for review (usually minutes, at most 24 hours) and tells your webhook the verdict with template.status_changed. Official WhatsApp (Cloud API) only;{id} in the path is the channel id from GET /channels.

POST /channels/{id}/templatesCreate and send for review. Answers 201 with the template, status usually PENDING
GET /channels/{id}/templates/{templateId}One template with its status and, when rejected, Meta's reason
PATCH /channels/{id}/templates/{templateId}Change texts and buttons (fields left out stay). Meta reviews it again. Approved, rejected or paused only; an approved one once a day, 10 times in 30 days, category locked
DELETE /channels/{id}/templates/{templateId}Delete this language of the template. The name of an approved one is blocked for 30 days
POST /v1/channels/CHANNEL_ID/templates
{
  "name": "order_ready",                 // a-z, 0-9 and _ ; cannot change later
  "language": "ru",                      // ru, kk, en_US, en_GB, uz, ky_KG, tr, uk, az, ka, de, fr, es, it, pt_BR, ar, ko, id, zh_CN
  "category": "UTILITY",                 // UTILITY (orders, bookings, payments) or MARKETING
  "headerText": "Order update",          // optional, up to 60, no variables
  "body": "Hello {{1}}! Order {{2}} is ready.",   // up to 1024; {{1}}..{{n}} in a row
  "bodyExamples": ["Aigerim", "#1042"],  // one example per variable — Meta requires them
  "footer": "ChatFlow Shop",             // optional, up to 60
  "buttons": [                           // optional, up to 10: 2 URL, 1 PHONE_NUMBER
    { "type": "QUICK_REPLY", "text": "Thanks" },
    { "type": "URL", "text": "Track", "url": "https://shop.example/track" },
    { "type": "PHONE_NUMBER", "text": "Call us", "phone": "+77011234567" }
  ]
}

Template object:

{
  "id": "1689556908129832", "name": "order_ready", "language": "ru", "category": "UTILITY",
  "status": "PENDING" | "APPROVED" | "REJECTED" | "PAUSED" | "DISABLED" | "IN_APPEAL",
  "rejectedReason": "INVALID_FORMAT" | null, "rejectionDetail": "Meta's words, when given" | null,
  "headerText": "Order update", "body": "Hello {{1}}! …", "bodyExamples": ["Aigerim", "#1042"],
  "footer": "ChatFlow Shop", "buttons": [ … ], "paramCount": 2, "headerMedia": null,
  "editable": true
}
  • Our checks run before Meta's: a variable at the very start or end of the body, two variables side by side, a missing example — 400 invalid_template with the reason, at once.
  • When Meta itself refuses (a duplicate name, a template limit), you get 400 meta_refused with Meta's words. Show them to your customer.
  • Media headers (picture, video, document) are not created over the API yet. editable: false marks templates made in WhatsApp Manager with parts the API cannot keep.
  • Once APPROVED, send it: { "template": { "name", "language", "params" } } to POST /conversations/{id}/messages or POST /messages.

Contacts

GET /contactsAll contacts, newest first. ?channel=, or ?query= to search by name or phone
GET /contacts/{id}One contact with its conversationIds
POST /contacts{phone, name?, channelId?} — a WhatsApp contact. channelId is required when several WhatsApp numbers are connected

Chats and messages

GET /conversationsChats, most recently active first. ?channel=, ?status=open|closed|archived, ?updatedSince=<ISO date>
GET /conversations/{id}One chat
PATCH /conversations/{id}{assignedTo?, labelIds?, contactName?, notes?}
GET /conversations/{id}/messagesMessages, newest first, with media links
POST /conversations/{id}/messagesReply in the chat — the chat's own channel is used
POST /messages{to, channelId?, name?, …} — first message to a new WhatsApp number
POST /media{contentType} — get an upload URL for a file to send or publish

A send body is one of:

{ "text": "Hello!" }
{ "mediaUrl": "<mediaUrl from POST /v1/media>", "caption": "Invoice", "fileName": "invoice.pdf" }
{ "template": { "name": "order_ready", "language": "ru", "params": ["Aigerim", "#1042"] } }
  • Send an Idempotency-Key header with text and media: a retry with the same key is never sent twice.
  • Only WhatsApp lets a business write first. Instagram, Messenger, Telegram and TikTok allow replies only; Messenger replies only within 24 hours of the customer's last message.
  • Official WhatsApp: 24 hours after the customer's last message Meta accepts templates only. Templates exist only on the official connection, not on QR-linked numbers.
  • Media can be sent on WhatsApp; other channels take text.

Message object:

{
  "id": "…", "conversationId": "…", "direction": "inbound" | "outbound",
  "text": "…", "status": "queued" | "sent" | "delivered" | "read" | "failed",
  "sentBy": "customer" | "employee" | "ai" | "system",
  "media": { "type": "image", "mime": "image/jpeg", "fileName": null, "url": "https://…" } | null,
  "createdAt": "2026-10-30T09:12:00.000Z"
}

Deals

GET /pipelinesPipelines and stages (columnId is the stageId below)
GET /deals?query=, ?archived=true
GET /deals/{id}One deal
POST /deals{phone, title, stageId, name?, value?, assignedTo?} — finds or creates the client by phone
PATCH /deals/{id}{stageId?, title?, notes?, value?, assignedTo?, archived?}
GET /teamEmployees and labels — ids for assignedTo and labelIds

Instagram comments

GET /instagram/comments?mediaId=, ?unrepliedOnly=true
POST /instagram/comments/{id}/reply{text}
POST /instagram/comments/{id}/hide{hidden: true|false}
GET /instagram/insightsAccount and post statistics. ?account=, ?postLimit=

Publishing

POST /posts with channel, kind and the fields for that kind. account picks the account when several are connected. Files are public URLs or mediaUrls from POST /media.

threadskind text: text
xkind text: text, imageUrls? (Pro and Max)
instagramkind photo / reel / carousel / story: imageUrl / videoUrl / items / mediaUrl + type, caption?
tiktokkind video / video_draft / photo_draft: videoUrl / photoUrls, caption?
GET /threads/insightsThreads account and post statistics. ?account=, ?postLimit=
GET /tiktok/postsPosts published to TikTok. ?limit=
GET /usageMessages used and limits for this organization

Webhooks

ChatFlow POSTs events to your HTTPS address as they happen. Add one in Settings → Webhooks (with a delivery log and a test button) or over the API:

GET /webhooksYour webhooks
POST /webhooks{url, events?, channels?, description?} — the response has a secret, shown only once
DELETE /webhooks/{id}Remove
channel.connectedA channel was connected through a connect link; channel says which
message.receivedA customer wrote (any channel)
message.sentAn outbound message was created — by an employee, the AI, the API or a campaign
message.status_changedAn outbound message became sent, delivered, read or failed: {message, previousStatus, error}; for failed, error is {code, detail} from Meta (e.g. 131042)
conversation.createdA new chat appeared
deal.createdA new deal
deal.updatedA deal changed; changed lists what (stage, title, value, assignedTo, notes, archived, …)
template.status_changedMeta approved, rejected or paused a WhatsApp template: {template, previousStatus}; previousStatus is null when Meta decided at once, in its answer to the create call

Leave events empty for all of them; channels: ["whatsapp"] sends only WhatsApp events.

POST https://your-system.example/chatflow
X-ChatFlow-Event: message.received
X-ChatFlow-Delivery: <unique id, for de-duplication>
X-ChatFlow-Signature: t=1761815520,v1=<hex>

{
  "id": "evt_…", "type": "message.received", "createdAt": "2026-10-30T09:12:00.000Z",
  "data": {
    "message": { …message object… },
    "conversation": { "id": "…", "channel": "whatsapp", "channelId": "…" },
    "contact": { "id": "…", "name": "Aigerim", "phone": "77010001122" }
  }
}

Check the signature — HMAC-SHA256 of <t>.<raw body> with your secret must equal v1:

import crypto from "node:crypto";

function verify(secret, header, rawBody) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return Math.abs(Date.now() / 1000 - Number(t)) < 300 &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}

Answer 2xx within 10 seconds. Otherwise ChatFlow retries after 1 min, 5 min, 30 min, 2 h, 6 h and 12 h, then marks the delivery failed. Order is not guaranteed. Media in message.received may still be downloading (url: null) — fetch the message later.

Partners: ChatFlow inside your own product

If you run your own CRM or service, you can offer ChatFlow's channels to your customers behind your product, with one API key and one webhook for all of them. Each customer is a separate organization, so their data stays apart. Register as a partner, pay for instances, and manage everything in your cabinet at /partner: a dashboard with counters, customers, keys, webhooks and billing.

Nobody makes links by hand. When a client presses "Connect WhatsApp" in your product:

  1. Your system makes one API call (below) with your partner key. The response has a connectUrl.
  2. Send the client to that address. They sign in with Meta and connect their number, with no ChatFlow account. That Meta step is required for every business on the official API.
  3. They come back to your returnUrl with ?status=connected added (declined or error if it didn't work), and your webhook receives channel.connected.
  4. From then on, call the normal API above with the same key, naming the client in the header X-ChatFlow-Client: their id or your own externalId.
curl -X POST https://chatflow.biz/api/v1/partner/clients \
  -H "Authorization: Bearer cfk_YOUR_PARTNER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Clinic Astana", "externalId": "crm-1042",
       "channels": ["whatsapp"],
       "returnUrl": "https://your-crm.example/whatsapp/done"}'

{ "id": "…", "externalId": "crm-1042", "connectUrl": "https://chatflow.biz/connect/cfl_…", … }

Add one webhook with your partner key and no header. It receives the events of all your clients, and each event has a data.client object saying whose it is. To connect another channel later, or if a link expired, ask for a new link: POST /partner/clients/crm-1042/connect-link. If you've used all your paid instances, connectUrl is null.

curl https://chatflow.biz/api/v1/conversations \
  -H "Authorization: Bearer cfk_YOUR_PARTNER_KEY" \
  -H "X-ChatFlow-Client: crm-1042"
POST /partner/clients{name, externalId?, channels?, returnUrl?} — returns the connectUrl. Your own reference in externalId also protects against duplicates (409) when you retry, and works in place of id everywhere. The response also has an apiKey just for this customer, if you prefer separate keys
GET /partner/clientsAll your customers, with connected accounts and messages sent
GET /partner/clients/{id}One customer
PATCH /partner/clients/{id}{name?, suspended?} — a suspended customer's API access and events stop until you resume them
POST /partner/clients/{id}/api-keyReplace that customer's own key
POST /partner/clients/{id}/connect-link{channels?, returnUrl?} — one of whatsapp, telegram, instagram, threads, tiktok, tiktokBusiness or more; all of them if left out
POST /partner/clients/{id}/whatsapp/complete{code, wabaId, phoneNumberId?, isCoexistence?} — finish a WhatsApp signup you ran in your own window, from your server, straight away: code works once and Meta gives it 30 seconds. Your domain must first be added to our Meta app, so ask us. Sends channel.connected
GET /partner/usageThe dashboard's counters: customers with WhatsApp, customers who used WhatsApp in the last 30 days, numbers, other channels, messages, instances
  • Instances and price: one instance is any connected account. By card the whole quantity is charged at its tier: 1–9 at $10, 10–49 at $8, 50 or more at $6 each a month. By invoice, 5,000 ₸ each a month. Paying by card, you buy instances up front; a connect link returns 402 no_free_instances when all are in use.
  • Connect links: each works for one connection and expires after 7 days. A new link replaces the previous one. Make one link per channel you need connected.
  • Limits per customer: 2,000 messages per 30 days, 1 WhatsApp number, 60 requests a minute. All your customers together: 1,000 requests a minute. Up to 200 customers; ask us for more.
  • WhatsApp fees: your customer signs in with Meta and adds their own payment method there. Meta bills message fees to them directly, not through ChatFlow or you.
  • Not included: X, AI features and WhatsApp calling. Only ChatFlow keys are issued: you never receive a Meta token.

AI tools (Claude, ChatGPT, Cursor) connect through the MCP server instead. · Privacy · Terms

Talk to the CEO

Questions, a custom plan or help getting connected? Write or call ChatFlow's CEO directly.

WhatsApp+7 702 732 62 04yernur@fastdev.org