Chatilo
USDPrices shown in US dollars Sign in Start free trial
Getting started

From nothing to a working request

This page takes about ten minutes. By the end you will have a key, a request that works, and the handful of rules every endpoint follows.

Create a key #

An API key lets a program act for one workspace (one business’s account in Chatilo). To make one:

  1. Sign in to Chatilo as the workspace’s owner or an admin.
  2. Open API and webhooks in the menu, under Automate. Go there now.
  3. Choose New key, give it a name that says where it will be used, and pick its access: Read and write or Read only.
  4. Copy the key. It starts with ck_live_ and is shown once. Only a fingerprint of it is stored, so nobody can show it to you again.

Make one key per system. Then you can switch one off without breaking the others, and the page shows when each was last used. A workspace can have ten.

Treat a key like a password. Keep it on your server, in an environment variable or a secrets store. Never put it in a web page, a mobile app or a public repository. If one leaks, delete it on the same page; it stops working at once.

API access is part of some plans. If the page says it isn’t in yours, requests answer not_in_plan until the plan is changed.

Make your first request #

Ask who the key belongs to. Replace YOUR_API_KEY with your key:

Request
curl "https://chatilo.me/api/v1/me" \
  -H "Authorization: Bearer YOUR_API_KEY"
<?php
$apiKey = 'YOUR_API_KEY';

$ch = curl_init('https://chatilo.me/api/v1/me');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$result = json_decode((string) curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

if ($status >= 400) {
    throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
print_r($result);
const apiKey = 'YOUR_API_KEY';

const response = await fetch("https://chatilo.me/api/v1/me", {
  headers: {
    Authorization: `Bearer ${apiKey}`,
  },
});
const result = await response.json();

if (!response.ok) {
  throw new Error(`${result.error.code}: ${result.error.message}`);
}
console.log(result);
import requests

api_key = "YOUR_API_KEY"

response = requests.get(
    "https://chatilo.me/api/v1/me",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=30,
)
result = response.json()

if not response.ok:
    raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
print(result)

You get the workspace back:

Response · HTTP 200
{
    "ok": true,
    "workspace": {
        "id": 1,
        "name": "Maple Thread Co.",
        "plan": "Growth",
        "timezone": "Asia/Kolkata"
    },
    "key": {
        "name": "Order system",
        "scope": "write"
    }
}

That’s the whole pattern: an address, your key in a header, JSON back. Next, send your first WhatsApp message, or read on for the rules.

Base address #

Every request on this installation starts with:

Base address
https://chatilo.me/api/v1

Chatilo is self-hosted, so the address is the one your Chatilo runs on. The examples on these pages already use it. Always use https in production: a key sent over plain http can be read on the way.

Authentication #

Send the key in the Authorization header of every request, after the word Bearer and a space:

Header
Authorization: Bearer YOUR_API_KEY

There are no sessions, cookies or tokens to refresh. A missing or wrong key answers 401 unauthorized. A key only ever sees its own workspace: an id that belongs to another workspace answers “not found”, exactly as if it didn’t exist.

Scopes #

A key has one of two levels of access, chosen when it is made:

KeyScopeWhat it can do
Read onlyreadEvery GET request: list and look up contacts, conversations, messages, broadcasts, orders, bookings and the rest. Good for reports and dashboards.
Read and writeread writeEverything a read-only key can, plus every request that changes something: POST, PUT and DELETE.

The rule is simple enough to remember: reading is GET, and GET never changes anything. A read-only key that tries to change something gets 403 read_only_key. Each endpoint in the reference says which key it needs, and Get the account tells a program what its own key may do. Subscribing to events (POST /hooks) is a change, so it needs a read-and-write key.

Keys made before scopes existed are read-and-write, as they always were.

Requests and responses #

  • Send JSON. Put the body in JSON with the header Content-Type: application/json. Filters on GET requests go in the query string.
  • You get JSON. A success has "ok": true and a 2xx status. Anything that was created answers 201.
  • Methods. GET reads, POST creates or does something, PUT changes the fields you send and leaves the rest alone, DELETE removes.
  • Dates and times come back in UTC as 2026-01-31T09:30:00Z. When you send one, include an offset (2026-01-31T15:00:00+05:30) or a Z. A time with neither is read on the workspace’s own clock.
  • Phone numbers need the country code. Send +919876543210; spaces and dashes are ignored. They come back as digits only: 919876543210.
  • Money is a whole number in the currency’s smallest unit, with the currency beside it: 129950 and "INR" is ₹1,299.50.
  • Ids are whole numbers and belong to one kind of thing: contact 12 and conversation 12 are unrelated.
  • Unknown fields are ignored, so a typo in a field name does nothing rather than failing. Check the response to see what was stored.

Errors #

Every failed request has a 4xx or 5xx status and the same body:

Error · HTTP 422
{
    "ok": false,
    "error": {
        "code": "window_closed",
        "message": "The customer hasn’t written in the last 24 hours. Send a template instead."
    }
}

code is a fixed word your program can test for; it will not change. message is a sentence written for a person, and may be reworded, so show it but don’t match on it.

StatusMeaningWhat to do
400The body couldn’t be read.Fix the JSON.
401No key, or a wrong one.Check the header and the key.
402The workspace’s plan has ended.Renew the plan in the app.
403Not allowed: a read-only key, a plan without this feature, or a plan limit reached.Read the code; retrying won’t help.
404No such endpoint, or nothing with that id in this workspace.Check the address and the id.
409It can’t be done in the current state: the time is taken, the order is already cancelled.Fetch the item and decide again.
422Something you sent is missing or not valid.The code names the field.
429Too many requests.Wait for Retry-After seconds.
500A fault on the server.Retry shortly, with an Idempotency-Key.
502WhatsApp or another channel refused the message.The message says why.

Every error code #

This list is made from the same description as the reference, so it is complete.

CodeStatusWhen
already_checked_in409The ticket was checked in before.
booking_not_found404No booking with that id or reference in this workspace.
campaign_not_found404No broadcast with that id in this workspace.
contact_limit403The plan’s contact limit is reached, so a new contact can’t be added.
contact_not_found404No contact with that id or phone number in this workspace.
conversation_not_found404No conversation with that id in this workspace. conversation_id is not a conversation in this workspace.
entry_not_found404No entry with that id or ticket code in this workspace.
hook_limit403The workspace already has 50 subscriptions.
hook_not_found404No subscription with that id in this workspace.
idempotency_conflict409A request with the same Idempotency-Key is still running.
invalid_active422active isn’t true or false.
invalid_assignee422assigned_to isn’t an active team member of this workspace.
invalid_attributes422attributes isn’t an object of names and text values, or there are more than 50.
invalid_audience422audience.type isn’t all, tags or segment, or no tag was given.
invalid_bill422account_no or amount is missing, or amount is not above zero.
invalid_category422category is longer than 60 characters.
invalid_channel422channel is not whatsapp or sms.
invalid_contacts422contacts is missing or isn’t a list.
invalid_customer422customer has no contact_id, phone or name.
invalid_date422A date filter isn’t a date and time like 2026-01-31T09:30:00Z. date is missing or isn’t YYYY-MM-DD.
invalid_description422description is longer than 800 characters.
invalid_email422email isn’t an email address.
invalid_event404There is no event with that name. event isn’t an event name.
invalid_filter422opted_in isn’t true or false. assigned_to isn’t an id or “none”.
invalid_header422The template has a media header and variables.header isn’t a link.
invalid_idempotency_key422The Idempotency-Key is longer than 200 characters.
invalid_image422image_url is private, unreachable, too large, or not a JPEG or PNG.
invalid_json400The body was sent as JSON but could not be read as JSON.
invalid_kind422kind is not one of the seven kinds.
invalid_media422media.url is missing, private, unreachable, too large, not an allowed file type, or not the type you said.
invalid_name422name is missing or longer than 150 characters. name is missing or too long.
invalid_notes422notes is longer than 5,000 characters. notes is longer than 1,000 characters.
invalid_opted_in422opted_in isn’t true or false.
invalid_page422The content cannot be saved: an empty headline, an unknown design, or a poll with fewer than two options.
invalid_phone422The phone number is missing or isn’t 8 to 15 digits with the country code. to has no country code or is not a phone number.
invalid_price422price isn’t a whole number above zero.
invalid_rules422rules isn’t customer or staff.
invalid_schedule422scheduled_at isn’t a time in the future.
invalid_sku422sku is longer than 64 characters.
invalid_start422start is missing or isn’t a date and time.
invalid_state409The broadcast isn’t sending. The broadcast isn’t paused.
invalid_status422status isn’t open or closed. status is not one of the entry statuses.
invalid_stock422stock isn’t a whole number or null.
invalid_tag422Neither tag nor tags was sent. No tag name was sent.
invalid_text422text is missing or too long. text is missing or longer than 4,096 characters.
invalid_type422type isn’t one of the six, or that type can’t be sent on the conversation’s channel.
invalid_url422target_url is missing, too long, can’t be found, or points to a private network.
message_limit403This month’s broadcast message allowance is used up.
message_not_found404No message with that id in this workspace.
no_number422No WhatsApp number is connected, or number_id isn’t one of yours. No WhatsApp number is connected.
no_sms_account422No SMS account is connected.
not_a_bill_page422That page is not a bill payment page.
not_a_ticket422The entry is not an event ticket.
not_found404There is no endpoint with that method and path.
not_in_plan403API access is not part of the workspace’s plan. Products and orders aren’t part of the workspace’s plan.
nothing_to_update422None of the fields was sent. Neither status nor assigned_to was sent.
opted_out422The contact has opted out. They can opt back in by replying START.
order_not_found404No order with that id in this workspace.
otp_throttled429A code went to this number in the last 30 seconds, or five in the last hour.
page_limit403The workspace already has 50 pages.
page_not_found404No page with that id or link name in this workspace.
phone_taken409Another contact already has that phone number.
plan_inactive402The workspace’s trial or plan has ended, or the workspace is suspended.
policy_violation422The text breaks Meta’s rules for WhatsApp, for example it asks for a full card number or promotes something Meta prohibits. The message says which rule. Nothing was sent.
product_limit403The workspace already has 2,000 products.
product_not_found404No product with that id in this workspace.
rate_limited429More than 120 requests in a minute with this key. Wait for the seconds in Retry-After.
read_only_key403A read-only key was used for a request that changes something.
segment_not_found404segment_id is not a segment in this workspace. No segment with that id in this workspace.
send_failed502The channel refused the message. The message text says why. Nothing was delivered. WhatsApp or the SMS provider refused the message.
server_error500Something failed on the server. Safe to retry, with an Idempotency-Key on writes.
service_not_found422service_id is missing or not a service in this workspace.
slot_unavailable409That time isn’t free: it was taken, is outside opening hours, or breaks the notice rules.
staff_not_found422staff_id is not an active staff member.
tag_limit403The workspace already has 1,000 tags.
tag_not_found404No tag with that id in this workspace. One of the tags doesn’t exist.
template_not_found422No approved template with that name and language on the sending number. No template with that id in this workspace.
ticket_not_valid409The ticket is unpaid or cancelled.
too_many422More than 100 contacts were sent.
unauthorized401The Authorization header is missing, or the key is wrong or deleted.
unknown_starting_point422template is not one of the starting points.
window_closed422Free text or a file was sent more than 24 hours after the customer’s last message. Send a template instead.

Pagination #

Lists come a page at a time, newest first. Ask for a page with page (starting at 1) and choose its size with limit (1 to 100; 50 when left out). Every paged response ends with the same five fields:

A paged response
{
    "ok": true,
    "contacts": [
        "…"
    ],
    "page": 2,
    "pages": 7,
    "total": 312,
    "limit": 50,
    "has_more": true
}

To read everything, keep asking for the next page while has_more is true. A page past the end is an empty list, never an error, so a loop that stops on an empty page also ends.

Read every page
curl "https://chatilo.me/api/v1/contacts?page=2&limit=100" \
  -H "Authorization: Bearer YOUR_API_KEY"
<?php
$apiKey = 'YOUR_API_KEY';
$page = 1;

do {
    $ch = curl_init('https://chatilo.me/api/v1/contacts?limit=100&page=' . $page);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
    ]);
    $result = json_decode((string) curl_exec($ch), true);
    foreach ($result['contacts'] ?? [] as $contact) {
        echo $contact['phone'], "\n";
    }
    $page++;
} while ($result['has_more'] ?? false);
const apiKey = 'YOUR_API_KEY';
let page = 1;
let result;

do {
  const response = await fetch(`https://chatilo.me/api/v1/contacts?limit=100&page=${page}`, {
    headers: { Authorization: `Bearer ${apiKey}` },
  });
  result = await response.json();
  for (const contact of result.contacts ?? []) {
    console.log(contact.phone);
  }
  page += 1;
} while (result.has_more);
import requests

api_key = "YOUR_API_KEY"
page = 1

while True:
    result = requests.get(
        "https://chatilo.me/api/v1/contacts",
        headers={"Authorization": f"Bearer {api_key}"},
        params={"limit": 100, "page": page},
        timeout=30,
    ).json()
    for contact in result.get("contacts", []):
        print(contact["phone"])
    if not result.get("has_more"):
        break
    page += 1

New items arrive at the front of a list, so on a busy workspace an item can appear on two pages while you read. Use the item’s id to skip ones you have seen, or filter with since or updated_since where the endpoint has it. A few short lists (tags, templates, numbers, services) are not paged and say so.

Rate limits #

Each key may make 120 requests every 60 seconds. Every response says where you stand:

HeaderMeaning
X-RateLimit-LimitHow many requests the key gets per window: 120.
X-RateLimit-RemainingHow many are left in the current window.
X-RateLimit-ResetWhen the window ends and the count starts again, as Unix time in seconds.
Retry-AfterOnly on a 429: how many seconds to wait before trying again.

Past the limit you get 429 rate_limited and nothing is done. Wait the number of seconds in Retry-After, then carry on. Two things keep you well under the limit: use the bulk endpoint to add many contacts in one request, and use webhooks instead of asking again and again whether something has changed.

Sending is also bound by WhatsApp’s own limits on your number, and by your plan’s contact limit and monthly broadcast allowance. Those answer with their own error codes, not with 429.

Idempotency #

Networks fail halfway. If a request to send a message times out, you can’t tell whether it was sent, and sending it again might message the customer twice. An Idempotency-Key makes a retry safe.

Add the header to any request that creates or sends something, with a value that is unique to that one operation: your own order number, or a random UUID you store before the first attempt.

A send that is safe to retry
curl -X POST "https://chatilo.me/api/v1/messages" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1042-shipped" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "type": "template",
    "template": {
        "name": "order_update",
        "language": "en",
        "body": [
            "Grace",
            "#1042"
        ]
    }
}'
  • The first request with a key does the work. A repeat with the same key within 24 hours does nothing and returns the first answer again, with the header Idempotent-Replay: true.
  • Only successes are remembered. If the first attempt failed (a 4xx or 5xx), the same key may be used to try again.
  • If the first request is still running when the repeat arrives, the repeat gets 409 idempotency_conflict. Wait a moment and retry.
  • A key is remembered per API key, not per endpoint. Use a different value for each operation; reusing one for a different request returns the earlier answer.
  • Keys can be up to 200 characters.

Endpoints that accept the header are marked Accepts Idempotency-Key in the reference: every create and every send. PUT and DELETE requests, and actions like pausing a broadcast or cancelling a booking, are safe to repeat as they are: doing them twice leaves things as doing them once (the second attempt may answer invalid_state or “not found”).

Versioning and stability #

This is version 1 of the API, and the /v1 in the address is the promise that goes with it. Within version 1:

  • We will not remove an endpoint, rename or remove a field, change a field’s type, change what an error code means, or make an optional field required.
  • We may add endpoints, add optional request fields and filters, add fields to responses and webhook deliveries, add event types, and add error codes for new situations.

So write clients that ignore fields they don’t know, and that treat an unknown error code like its HTTP status. If a change ever has to break that promise it will be a new version at /v2, and /v1 will keep working alongside it.

The reference is at version 1.3.1. The middle number goes up when endpoints or fields are added; the changelog lists what changed. Because Chatilo is self-hosted, an installation gets new endpoints when whoever runs it installs an update; openapi.json always describes the installation you are talking to.

Cookies on this site

We use the cookies needed to run the site and keep you signed in. With your OK we also remember choices you make here, such as the currency for prices. We don’t use advertising or tracking cookies. Cookie policy