Quickstart
Make your first Landbot API call in a few minutes.
Make one authenticated request to the Platform API and read the response. You need your agent token from app.landbot.io/gui/settings/account.
Prerequisites
- A Landbot workspace. New to Landbot? The Help Center's Getting started and Build a bot cover creating an account and your first bot.
- Your agent token, under Account in the dashboard's Settings
Make the call
Start with GET /channels/. It returns the channels in your workspace, takes no path parameters and changes nothing.
curl https://api.landbot.io/v1/channels/ \
-H "Authorization: Token YOUR_AGENT_TOKEN" \
-H "Content-Type: application/json"
const res = await fetch('https://api.landbot.io/v1/channels/', {
headers: {
'Authorization': 'Token YOUR_AGENT_TOKEN',
'Content-Type': 'application/json',
},
});
const data = await res.json();
console.log(data);
import requests
res = requests.get(
'https://api.landbot.io/v1/channels/',
headers={
'Authorization': 'Token YOUR_AGENT_TOKEN',
'Content-Type': 'application/json',
},
)
print(res.json())
Read the response
A successful call returns 200 OK with a body like this:
{
"success": true,
"total": 3,
"channels": [
{
"id": 8,
"name": "Web chat",
"type": "landbot",
"active": true,
"created_at": 1485789228.878516,
"token": "H-8-GXQB4SYFQITIB9XZ"
}
]
}
Every listing endpoint in the Platform API answers with this shape: success, total, and a list named after the resource. See Pagination for how total and offset/limit work together.
Make a write call
Writes take the same header and a JSON body. To send a text message to a customer, replace 42 with a numeric customer ID from GET /customers/. Keep the trailing /: without it the request is redirected and loses its body.
curl https://api.landbot.io/v1/customers/42/send_text/ \
-X POST \
-H "Authorization: Token YOUR_AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Hello from the API"}'
const res = await fetch('https://api.landbot.io/v1/customers/42/send_text/', {
method: 'POST',
headers: {
'Authorization': 'Token YOUR_AGENT_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ message: 'Hello from the API' }),
});
const data = await res.json();
console.log(data);
import requests
res = requests.post(
'https://api.landbot.io/v1/customers/42/send_text/',
headers={
'Authorization': 'Token YOUR_AGENT_TOKEN',
'Content-Type': 'application/json',
},
json={'message': 'Hello from the API'},
)
print(res.json())
You get 200 OK with {"success": true}. The message reaches the customer on whatever channel they're on: web chat, WhatsApp, Messenger or APIchat. On WhatsApp, a free-form message only goes out within 24 hours of the customer's last message. After that, send a pre-approved WhatsApp template instead.
Sending to an unassigned customer assigns them to you. If another agent has the customer, the call fails with 412. Errors lists every error and which ones to retry.
What's next
-
Authentication: which token each API takes.
-
API reference: every endpoint, with an interactive playground.
-
Rate limiting: 40 requests a second, the
429response and how to retry. -
Errors: every error body and status, and which ones to retry.