Quick start: your first API call
Create a key, check it works and send your first WhatsApp message. About five minutes.
Before you start
- You are the owner or an admin of the workspace (only they can create API keys).
- A WhatsApp number is connected in Flowleb.
- A terminal (for cURL) or any tool that can send HTTP requests, such as Postman.
- Your own phone number to test with.
Step 1 · Create your API key
-
Open the REST API page
In your Flowleb dashboard, open the menu and find the Developer group.
Developer REST API
-
Name and create the key
Type a name you will recognise, like "Production backend", and click Create key.
-
Copy the key right away
The full key is shown only once. Flowleb keeps just a scrambled copy (a hash), so nobody can show it to you again. Save it somewhere safe, such as your server's environment settings.
Create your key
wsk_8fK2pQ…x7LmCopy
- Give the key a name you'll recognise.
- Click “Create key”.
- Copy the key and store it on your server. It's shown only once.
Simplified drawing of the dashboard page.
Step 2 · Check the key works
Ask the API who you are. Replace YOUR_API_KEY with your key. In the Node.js, Python and PHP samples the key is read from an environment variable called FLOWLEB_API_KEY.
/api/v1/me
Returns your workspace, plan and limits. Changes nothing, so it's safe to try.
curl https://flowleb.com/api/v1/me \
-H "Authorization: Bearer YOUR_API_KEY"
// Node.js 18+ (fetch is built in)
const res = await fetch('https://flowleb.com/api/v1/me', {
headers: { Authorization: `Bearer ${process.env.FLOWLEB_API_KEY}` },
});
console.log(res.status, await res.json());
import os, requests
res = requests.get(
"https://flowleb.com/api/v1/me",
headers={"Authorization": "Bearer " + os.environ["FLOWLEB_API_KEY"]},
)
print(res.status_code, res.json())
<?php
$ch = curl_init('https://flowleb.com/api/v1/me');
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('FLOWLEB_API_KEY')],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);
{
"data": {
"account": {
"name": "Maya Shah",
"email": "maya@example.com"
},
"workspace": {
"id": 12,
"name": "Maya's Store",
"slug": "mayas-store",
"timezone": "Asia/Kolkata",
"currency": "INR"
},
"plan": { "id": 3, "name": "Pro", "is_free": false },
"limits": { … },
"features": { … }
}
}
Step 3 · Send a message
Every request has the same four parts:
POST
https://flowleb.com/api/v1/messagesAuthorization: Bearer wsk_your_keyContent-Type: application/json{
"to": "919876543210",
"type": "text",
"text": "Order shipped!"
}- Method + address What to do (
POST= create or send) and where. - Your API key Proves the call comes from your workspace.
- Format Tells Flowleb the body is JSON.
- Body The details: who gets it and what it says.
/api/v1/messages
Sends one message. Put your own number in to: country code + number, digits only.
curl -X POST https://flowleb.com/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"type": "text",
"text": "Hi Maya, your order #2045 has shipped!"
}'
const res = await fetch('https://flowleb.com/api/v1/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.FLOWLEB_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
to: '919876543210',
type: 'text',
text: 'Hi Maya, your order #2045 has shipped!',
}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error?.code}: ${error?.message}`);
console.log('Message id', data.id, 'status', data.status);
import os, requests
res = requests.post(
"https://flowleb.com/api/v1/messages",
headers={"Authorization": "Bearer " + os.environ["FLOWLEB_API_KEY"]},
json={
"to": "919876543210",
"type": "text",
"text": "Hi Maya, your order #2045 has shipped!",
},
)
body = res.json()
if not res.ok:
raise RuntimeError(body)
print("Message id", body["data"]["id"], "status", body["data"]["status"])
<?php
$ch = curl_init('https://flowleb.com/api/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('FLOWLEB_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '919876543210',
'type' => 'text',
'text' => 'Hi Maya, your order #2045 has shipped!',
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 300) {
throw new RuntimeException($body['error']['message'] ?? 'Send failed');
}
echo 'Message id ' . $body['data']['id'];
{
"data": {
"id": 48213,
"to": "919876543210",
"type": "text",
"status": "sent",
"failure_reason": null,
"error_code": null,
"body": "Hi Maya, your order #2045 has shipped!",
"media_url": null,
"created_at": "2026-11-18T10:24:05+05:30"
}
}
Check your phone: the message should be there. Keep the id from the response; you need it in the next step.
Step 4 · Check delivery
/api/v1/messages/{id}
Shows the latest status of one message.
curl https://flowleb.com/api/v1/messages/48213 \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": {
"id": 48213,
"to": "919876543210",
"type": "text",
"status": "delivered",
"failure_reason": null,
"error_code": null,
"body": "Hi Maya, your order #2045 has shipped!",
"media_url": null,
"created_at": "2026-11-18T10:24:05+05:30"
}
}