ChatKomodo Docs Home Sign in

API reference · Messaging

Devices

A device is one WhatsApp number linked to ChatKomodo (shown as a session in the API: its id is the sessionId in the paths). Create one, scan its QR code from WhatsApp → Linked devices (or use a pairing code), then send through it. GET /v1/sessions lists them with their status.

List devices

GET/v1/sessions

List all WhatsApp devices for the calling tenant.

Responses

  • 200List of sessions
    Response fields
    • sessionsarray of objectrequired
    • sessions[].idstringrequired
      ULID identifier
    • sessions[].statusstringrequired
      pending (starting), qr_ready (waiting for a scan), connected, disconnected (was working, connection lost) or failed
      One of: pending, qr_ready, connected, disconnected, failed
    • sessions[].phone_numberstring | nullrequired
      Paired WhatsApp number as digits with country code (no +), e.g. 447700900123
    • sessions[].wa_namestring | nullrequired
      WhatsApp display name, read from the phone when it is linked (no need to type it)
    • sessions[].wa_aboutstring | null
      The number's WhatsApp "About" text (bio), read after linking and refreshed whenever the profile is fetched. "" = no About; null = not read yet or hidden by the phone's privacy settings
    • sessions[].phone_displaystring | null
      The number in international format with its country code, e.g. +44 7700 900123
    • sessions[].phone_countrystring | null
      ISO 3166-1 alpha-2 country of the number, e.g. GB (null when unknown)
    • sessions[].phone_country_codestring | null
      Country calling code with +, e.g. +44
    • sessions[].api_key_idstringrequired
      Owning tenant
    • sessions[].warmup_until_msinteger | nullrequired
      Pacing until this timestamp (anti-ban)
    • sessions[].created_atintegerrequired
    • sessions[].connected_atinteger | nullrequired
    • sessions[].sandboxboolean
      true for a test device: WhatsApp is simulated and nothing is sent for real (see POST /v1/sessions with sandbox: true)
  • 401Unauthorized
Request
curl "https://api.chatkomodo.com/v1/sessions" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "sessions": [
    {
      "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "status": "pending",
      "phone_number": "+447700900123",
      "wa_name": "string",
      "wa_about": "string",
      "phone_display": "+447700900123",
      "phone_country": "+447700900123",
      "phone_country_code": "+447700900123",
      "api_key_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "warmup_until_ms": 1767225600000,
      "created_at": 1767225600000,
      "connected_at": 1767225600000,
      "sandbox": true
    }
  ]
}

Create a device

POST/v1/sessions

Create a new WhatsApp device (session). Poll qr_polling_url for the QR code and scan it from WhatsApp, or link with a pairing code (POST /v1/sessions/{id}/pairing-code). Limited by the plan's device quota.

With {"sandbox": true} it creates a test device instead: connected at once, no QR code, nothing ever reaches WhatsApp. Sends go through the normal pipeline (logs, webhooks, statuses move to delivered after about 1 s and read after about 3 s); numbers ending in 0000 always fail; customer messages are simulated with POST /v1/sessions/{id}/sandbox/inbound. One test device per business, outside the device quota, and its messages do not count toward the monthly quota.

Request body

  • sandboxboolean
    true creates a test device (no QR code, simulated WhatsApp)

Responses

  • 201Session created: pending with a QR polling URL, or a connected test device
    Response fields
    • idstringrequired
    • statusstringrequired
      One of: pending
    • qr_polling_urlstringrequired
  • 401Unauthorized
  • 403Plan device limit reached
  • 409This business already has a test device (SANDBOX_EXISTS, its id included)
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 201
{
  "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "status": "pending",
  "qr_polling_url": "https://example.com/file.jpg"
}

Simulate a customer message

POST/v1/sessions/{id}/sandbox/inbound

Test devices only: a message "from" a customer arrives on the test device and is handled like a real one. It is logged, fires the message.received webhook, appears in the inbox, and triggers welcome messages, auto-replies, chatbot flows and AI replies (whose answers go back through the test device). Nothing is sent over WhatsApp.

Path parameters

  • idstringrequired

Request body

  • fromstringrequired
    The customer's number (international, or local for the business country) or a person's chat id …@s.whatsapp.net
    Up to 64 characters
  • textstring
    What the customer writes (the caption with media; required without it)
    Up to 4 096 characters
  • namestring
    The customer's WhatsApp name (default "Test customer")
    Up to 100 characters
  • mediastring
    Send a small sample file: a photo, a PDF, a voice note or a video. It is stored like a real customer file (media_r2_key on the message, media_key in the message.media webhook)
    One of: image, document, audio, video

Responses

  • 202Delivered to the test device; webhooks and automations run in the background
    Response fields
    • okbooleanrequired
    • chat_idstringrequired
    • wa_message_idstringrequired
  • 400VALIDATION_ERROR or INVALID_PHONE
  • 404Not found or not owned by tenant
  • 409Not a test device (NOT_A_TEST_DEVICE)
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sandbox/inbound" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "from": "+447700900123",
  "text": "What time do you open on Saturday?",
  "name": "Sam Carter"
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sandbox/inbound', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "from": "+447700900123",
    "text": "What time do you open on Saturday?",
    "name": "Sam Carter"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sandbox/inbound",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "from": "+447700900123",
        "text": "What time do you open on Saturday?",
        "name": "Sam Carter",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sandbox/inbound', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'from' => '+447700900123',
        'text' => 'What time do you open on Saturday?',
        'name' => 'Sam Carter',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "from": "+447700900123",
	  "text": "What time do you open on Saturday?",
	  "name": "Sam Carter"
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sandbox/inbound", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 202
{
  "ok": true,
  "chat_id": "+447700900123",
  "wa_message_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X"
}

Get a device

GET/v1/sessions/{id}

Get a single session by id.

Path parameters

  • idstringrequired

Responses

  • 200Session detail
    Response fields
    • idstringrequired
      ULID identifier
    • statusstringrequired
      pending (starting), qr_ready (waiting for a scan), connected, disconnected (was working, connection lost) or failed
      One of: pending, qr_ready, connected, disconnected, failed
    • phone_numberstring | nullrequired
      Paired WhatsApp number as digits with country code (no +), e.g. 447700900123
    • wa_namestring | nullrequired
      WhatsApp display name, read from the phone when it is linked (no need to type it)
    • wa_aboutstring | null
      The number's WhatsApp "About" text (bio), read after linking and refreshed whenever the profile is fetched. "" = no About; null = not read yet or hidden by the phone's privacy settings
    • phone_displaystring | null
      The number in international format with its country code, e.g. +44 7700 900123
    • phone_countrystring | null
      ISO 3166-1 alpha-2 country of the number, e.g. GB (null when unknown)
    • phone_country_codestring | null
      Country calling code with +, e.g. +44
    • api_key_idstringrequired
      Owning tenant
    • warmup_until_msinteger | nullrequired
      Pacing until this timestamp (anti-ban)
    • created_atintegerrequired
    • connected_atinteger | nullrequired
    • sandboxboolean
      true for a test device: WhatsApp is simulated and nothing is sent for real (see POST /v1/sessions with sandbox: true)
  • 404Not found or not owned by tenant
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "status": "pending",
  "phone_number": "+447700900123",
  "wa_name": "string",
  "wa_about": "string",
  "phone_display": "+447700900123",
  "phone_country": "+447700900123",
  "phone_country_code": "+447700900123",
  "api_key_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
  "warmup_until_ms": 1767225600000,
  "created_at": 1767225600000,
  "connected_at": 1767225600000,
  "sandbox": true
}

Delete a device

DEL/v1/sessions/{id}

Closes the live connection, deletes the stored WhatsApp credentials and removes the session together with its auto-reply rules, blast campaigns, blocklist entries and message history. The inbox and scheduled messages are left in place, and WhatsApp is not asked to unlink the device. This cannot be undone.

Path parameters

  • idstringrequired
    Session (device) id

Responses

  • 200Deleted
    Response fields
    • okbooleanrequired
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
  • 404Unknown session, or a session of another tenant
Request
curl -X DELETE "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID', {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.delete(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('DELETE', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("DELETE", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "ok": true
}

Number protection status

GET/v1/sessions/{sessionId}/health

Protection status of the WhatsApp number: age and warm-up, new contacts and messages today against its limits, failures, blocks and opt-outs in the last 7 days. Messages over a limit are not refused: they go out the next day with room (08:00-10:00 WIB). People who wrote to the number first are never counted as new contacts.

Path parameters

  • sessionIdstringrequired

Responses

  • 200Health
    Response fields
    • age_daysintegerrequired
      Days since the number first connected
    • warming_upbooleanrequired
      First 14 days: the daily limit for new contacts grows from 20 to 800
    • new_contacts_todayintegerrequired
    • new_contact_limitintegerrequired
      New contacts this number may message today (warm-up or your own limit, whichever is lower; after warm-up your limit up to 1 000)
    • sent_todayintegerrequired
    • daily_limitinteger | nullrequired
      Your limit for all messages a day, or null (only the platform limit)
    • new_contact_daily_limitinteger | nullrequired
    • last_7_daysobjectrequired
    • last_7_days.sentintegerrequired
    • last_7_days.failedintegerrequired
    • last_7_days.blocksintegerrequired
    • last_7_days.opt_outsintegerrequired
    • last_7_days.complaint_repliesintegerrequired
      Replies like "who is this?", "spam" or "stop texting me" to messages of this number
    • last_7_days.failure_ratenumberrequired
    • last_7_days.complaint_ratenumberrequired
      (blocks + opt-outs + complaint replies) / sent
    • delivery_ratenumber | nullrequired
      Share of the messages to people (last 7 days, sent over 90 minutes ago) that reached the phone; null with fewer than 20 such messages. Under 0.6 the level is at least careful, under 0.35 at_risk
    • delivery_sampleintegerrequired
      How many messages that is
    • reply_ratenumber | nullrequired
      Share of people this number messaged first (last 7 days, first message at least 6 hours old) who answered; null with no such contacts
    • cold_contacts_7dintegerrequired
      How many people that is
    • quota_factornumberrequired
      The new-contact limit follows the reply rate (needs 30 such contacts): 0.5 under 3 % replies, 0.75 under 8 %, 1.25 from 25 % (only after the first week), else 1; multiplied by the risk speed_factor
    • restricted_untilinteger | nullrequired
      When WhatsApp limited this number (rate limit or restriction), until when it does not message new contacts (24 hours); null otherwise. Replies to people who wrote first still go out
    • two_step_pin_confirmed_atinteger | nullrequired
      When the owner confirmed WhatsApp two-step verification (PIN) is on for this number; null if not confirmed
    • own_test_atinteger | nullrequired
      Last time this number sent a message to its own number (for example a broadcast test); null if never
    • levelstringrequired
      at_risk also while the number is restricted
      One of: good, careful, at_risk
    • riskobjectrequired
      Risk estimate for this number
    • risk.scorenumberrequired
      Estimated probability (0-1) that WhatsApp restricts or bans this number in the next days, from a model that looks at ten signals together (strangers messaged, replies, undelivered messages, failures, complaints, age, today's volume against the number's own habit, identical texts, night sending, a recent restriction)
    • risk.levelstringrequired
      low under 12 %, medium under 35 %, high from 35 %
      One of: low, medium, high
    • risk.reasonsarray of objectrequired
      The biggest contributors, largest first
    • risk.reasons[].featurestringrequired
      new_share, no_reply, undelivered, failures, complaints, young, burst, repetition, night, restricted_recent, trend (delivery getting worse over days), near_dup (near copies of one text), neighbor (other numbers on the server were limited), or an interaction such as young*burst
    • risk.reasons[].pointsintegerrequired
      Percentage points this signal adds to the score
    • risk.projected_30dnumberrequired
      Chance (0-1) of a limit or ban within 30 days if nothing changes
    • risk.reliabilitystringrequired
      prior: not enough outcomes yet, the score rests on general ban patterns. learning: the model learns from outcomes but is not proven. validated: at least 30 positive examples and it predicts them better than chance (AUC >= 0.7)
      One of: prior, learning, validated
    • risk.speed_factornumberrequired
      Multiplier on the new-contact limit, 0.3-1.3. It grows slowly while the score is low and drops fast when the score is high; it is updated once a day
    • risk.learned_fromobjectrequired
      How many restricted/banned and how many safe number-days the model has learned from. With few, the score still rests mostly on general ban patterns
    • risk.learned_from.bansintegerrequired
    • risk.learned_from.safeintegerrequired
  • 404Session not found
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/health" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/health', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/health",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/health', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/health", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "age_days": 1,
  "warming_up": true,
  "new_contacts_today": 1,
  "new_contact_limit": 50,
  "sent_today": 12,
  "daily_limit": 50,
  "new_contact_daily_limit": 50,
  "last_7_days": {
    "sent": 12,
    "failed": 1,
    "blocks": 1,
    "opt_outs": 1,
    "complaint_replies": 1,
    "failure_rate": 0.5,
    "complaint_rate": 0.5
  },
  "delivery_rate": 0.5,
  "delivery_sample": 1,
  "reply_rate": 0.5,
  "cold_contacts_7d": 1,
  "quota_factor": 0.5,
  "restricted_until": 1767225600000,
  "two_step_pin_confirmed_at": 1767225600000,
  "own_test_at": 1767225600000,
  "level": "good",
  "risk": {
    "score": 0.5,
    "level": "low",
    "reasons": [
      {
        "feature": "string",
        "points": 1
      }
    ],
    "projected_30d": 0.5,
    "reliability": "prior",
    "speed_factor": 0.5,
    "learned_from": {
      "bans": 1,
      "safe": 1
    }
  }
}

Check the WhatsApp profile is complete

GET/v1/sessions/{sessionId}/profile-check

Is the number's WhatsApp profile filled in? A number with no photo, no name or the default "about" that messages strangers looks like a throwaway number and is banned sooner. description is checked for WhatsApp Business numbers only (null otherwise). Cached 6 hours; ?refresh=1 asks WhatsApp again.

Path parameters

  • sessionIdstringrequired

Query parameters

  • refreshstring
    One of: 1

Responses

  • 200Profile check
    Response fields
    • photobooleanrequired
    • namebooleanrequired
    • aboutbooleanrequired
    • descriptionboolean | nullrequired
    • checked_atintegerrequired
    • completebooleanrequired
    • missingarray of stringrequired
  • 409Device not connected
  • 502WhatsApp did not answer
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile-check" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile-check', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile-check",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile-check', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile-check", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "photo": true,
  "name": true,
  "about": true,
  "description": true,
  "checked_at": 1767225600000,
  "complete": true,
  "missing": [
    "photo"
  ]
}

Set the number's daily limits

PUT/v1/sessions/{sessionId}/limits

Set the number's own daily limits, and whether two-step verification (PIN) is on in WhatsApp (two_step_pin; WhatsApp does not tell linked devices, so the owner confirms it). daily_limit (10-1 000) caps every message a day; new_contact_daily_limit (0-1 000) caps first messages to people the number never chatted with: during the 14-day warm-up only lower than the warm-up value counts. null removes a limit. Recorded as session.limits. Not for agents.

Path parameters

  • sessionIdstringrequired

Request body

  • daily_limitinteger | null
  • new_contact_daily_limitinteger | null
  • two_step_pinboolean
    The owner confirms (true) or withdraws (false) that two-step verification (PIN) is on in WhatsApp for this number

Responses

  • 200Saved; the new health
    Response fields
    • age_daysintegerrequired
      Days since the number first connected
    • warming_upbooleanrequired
      First 14 days: the daily limit for new contacts grows from 20 to 800
    • new_contacts_todayintegerrequired
    • new_contact_limitintegerrequired
      New contacts this number may message today (warm-up or your own limit, whichever is lower; after warm-up your limit up to 1 000)
    • sent_todayintegerrequired
    • daily_limitinteger | nullrequired
      Your limit for all messages a day, or null (only the platform limit)
    • new_contact_daily_limitinteger | nullrequired
    • last_7_daysobjectrequired
    • last_7_days.sentintegerrequired
    • last_7_days.failedintegerrequired
    • last_7_days.blocksintegerrequired
    • last_7_days.opt_outsintegerrequired
    • last_7_days.complaint_repliesintegerrequired
      Replies like "who is this?", "spam" or "stop texting me" to messages of this number
    • last_7_days.failure_ratenumberrequired
    • last_7_days.complaint_ratenumberrequired
      (blocks + opt-outs + complaint replies) / sent
    • delivery_ratenumber | nullrequired
      Share of the messages to people (last 7 days, sent over 90 minutes ago) that reached the phone; null with fewer than 20 such messages. Under 0.6 the level is at least careful, under 0.35 at_risk
    • delivery_sampleintegerrequired
      How many messages that is
    • reply_ratenumber | nullrequired
      Share of people this number messaged first (last 7 days, first message at least 6 hours old) who answered; null with no such contacts
    • cold_contacts_7dintegerrequired
      How many people that is
    • quota_factornumberrequired
      The new-contact limit follows the reply rate (needs 30 such contacts): 0.5 under 3 % replies, 0.75 under 8 %, 1.25 from 25 % (only after the first week), else 1; multiplied by the risk speed_factor
    • restricted_untilinteger | nullrequired
      When WhatsApp limited this number (rate limit or restriction), until when it does not message new contacts (24 hours); null otherwise. Replies to people who wrote first still go out
    • two_step_pin_confirmed_atinteger | nullrequired
      When the owner confirmed WhatsApp two-step verification (PIN) is on for this number; null if not confirmed
    • own_test_atinteger | nullrequired
      Last time this number sent a message to its own number (for example a broadcast test); null if never
    • levelstringrequired
      at_risk also while the number is restricted
      One of: good, careful, at_risk
    • riskobjectrequired
      Risk estimate for this number
    • risk.scorenumberrequired
      Estimated probability (0-1) that WhatsApp restricts or bans this number in the next days, from a model that looks at ten signals together (strangers messaged, replies, undelivered messages, failures, complaints, age, today's volume against the number's own habit, identical texts, night sending, a recent restriction)
    • risk.levelstringrequired
      low under 12 %, medium under 35 %, high from 35 %
      One of: low, medium, high
    • risk.reasonsarray of objectrequired
      The biggest contributors, largest first
    • risk.reasons[].featurestringrequired
      new_share, no_reply, undelivered, failures, complaints, young, burst, repetition, night, restricted_recent, trend (delivery getting worse over days), near_dup (near copies of one text), neighbor (other numbers on the server were limited), or an interaction such as young*burst
    • risk.reasons[].pointsintegerrequired
      Percentage points this signal adds to the score
    • risk.projected_30dnumberrequired
      Chance (0-1) of a limit or ban within 30 days if nothing changes
    • risk.reliabilitystringrequired
      prior: not enough outcomes yet, the score rests on general ban patterns. learning: the model learns from outcomes but is not proven. validated: at least 30 positive examples and it predicts them better than chance (AUC >= 0.7)
      One of: prior, learning, validated
    • risk.speed_factornumberrequired
      Multiplier on the new-contact limit, 0.3-1.3. It grows slowly while the score is low and drops fast when the score is high; it is updated once a day
    • risk.learned_fromobjectrequired
      How many restricted/banned and how many safe number-days the model has learned from. With few, the score still rests mostly on general ban patterns
    • risk.learned_from.bansintegerrequired
    • risk.learned_from.safeintegerrequired
  • 400Validation error
Request
curl -X PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/limits" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "daily_limit": 50,
  "new_contact_daily_limit": 50,
  "two_step_pin": true
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/limits', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "daily_limit": 50,
    "new_contact_daily_limit": 50,
    "two_step_pin": true
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.put(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/limits",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "daily_limit": 50,
        "new_contact_daily_limit": 50,
        "two_step_pin": True,
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('PUT', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/limits', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'daily_limit' => 50,
        'new_contact_daily_limit' => 50,
        'two_step_pin' => true,
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "daily_limit": 50,
	  "new_contact_daily_limit": 50,
	  "two_step_pin": true
	}`)
	req, err := http.NewRequest("PUT", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/limits", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "age_days": 1,
  "warming_up": true,
  "new_contacts_today": 1,
  "new_contact_limit": 50,
  "sent_today": 12,
  "daily_limit": 50,
  "new_contact_daily_limit": 50,
  "last_7_days": {
    "sent": 12,
    "failed": 1,
    "blocks": 1,
    "opt_outs": 1,
    "complaint_replies": 1,
    "failure_rate": 0.5,
    "complaint_rate": 0.5
  },
  "delivery_rate": 0.5,
  "delivery_sample": 1,
  "reply_rate": 0.5,
  "cold_contacts_7d": 1,
  "quota_factor": 0.5,
  "restricted_until": 1767225600000,
  "two_step_pin_confirmed_at": 1767225600000,
  "own_test_at": 1767225600000,
  "level": "good",
  "risk": {
    "score": 0.5,
    "level": "low",
    "reasons": [
      {
        "feature": "string",
        "points": 1
      }
    ],
    "projected_30d": 0.5,
    "reliability": "prior",
    "speed_factor": 0.5,
    "learned_from": {
      "bans": 1,
      "safe": 1
    }
  }
}

Get the current QR code

GET/v1/sessions/{sessionId}/qr

Returns the QR payload for linking the device: render the qr string with any QR library and scan it from WhatsApp (Linked devices). A code lasts about 60 seconds; qr is null while none is available, so keep polling until status is qr_ready. Answers 410 once the device is connected.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Responses

  • 200Current QR state
    Response fields
    • qrstring | nullrequired
      Raw QR payload string (not an image); null when there is no valid code right now
    • expires_atinteger | nullrequired
      Expiry of the code (Unix epoch, milliseconds)
    • statusstringrequired
      Session status: pending, qr_ready, connected, disconnected or failed
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions
  • 404Unknown session, or a session of another tenant
  • 410The device is already connected (error: Already connected)
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/qr" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/qr', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/qr",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/qr', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/qr", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "qr": "string",
  "expires_at": 1767225600000,
  "status": "active"
}

Get the WhatsApp profile of a device

GET/v1/sessions/{sessionId}/profile

Returns the linked account: number, display name, picture, About text and, for Business accounts, the business profile and catalog. A connected device is queried live with a 10-second limit, and parts that do not answer in time come back null or empty (syncing: true marks a timed-out lookup). A device that is not connected returns the cached values with connected: false.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Responses

  • 200Profile
    Response fields
    • connectedbooleanrequired
    • syncingboolean
      true when the live lookup timed out and only partial data is returned
    • phone_numberstring | nullrequired
      Digits with country code, no +
    • wa_namestring | nullrequired
    • profile_pic_urlstring | nullrequired
    • aboutstring | nullrequired
      The About / status text
    • is_businessbooleanrequired
    • business_profileobject | nullrequired
      Only for Business accounts
    • business_profile.descriptionstring | nullrequired
    • business_profile.categorystring | nullrequired
    • business_profile.emailstring | nullrequired
    • business_profile.websitearray of anyrequired
    • business_profile.addressstring | nullrequired
    • business_profile.business_hoursarray of objectrequired
    • business_profile.business_hours[].daystringrequired
    • business_profile.business_hours[].modestringrequired
    • business_profile.business_hours[].openstring | nullrequired
      HH:MM
    • business_profile.business_hours[].closestring | nullrequired
      HH:MM
    • catalogarray of objectrequired
      Visible catalog products (Business accounts only; empty otherwise)
    • catalog[].idstringrequired
    • catalog[].namestringrequired
    • catalog[].pricenumberrequired
    • catalog[].currencystringrequired
    • catalog[].descriptionstringrequired
    • catalog[].imagestring | nullrequired
    • catalog[].urlstring | nullrequired
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions
  • 404Unknown session, or a session of another tenant
Request
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.get(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("GET", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/profile", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "connected": true,
  "syncing": true,
  "phone_number": "+447700900123",
  "wa_name": "string",
  "profile_pic_url": "https://example.com/file.jpg",
  "about": "string",
  "is_business": true,
  "business_profile": {
    "description": "Short description",
    "category": "string",
    "email": "you@example.com",
    "website": [
      "string"
    ],
    "address": "string",
    "business_hours": [
      {
        "day": "string",
        "mode": "string",
        "open": "string",
        "close": "string"
      }
    ]
  },
  "catalog": [
    {
      "id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
      "name": "Example",
      "price": 150000,
      "currency": "IDR",
      "description": "Short description",
      "image": "string",
      "url": "https://example.com/file.jpg"
    }
  ]
}

Request a phone-number pairing code

POST/v1/sessions/{sessionId}/pairing-code

Links the device with a code instead of a QR scan: enter the returned code on the phone (WhatsApp, Linked devices, Link with phone number). Needs a session that has a live connection manager, so create it with POST /v1/sessions or call /reconnect first.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • phone_numberstringrequired
    Number of the WhatsApp account to link, with country code. Everything but digits is stripped; local-format numbers are not resolved

Responses

  • 200Pairing code
    Response fields
    • codestringrequired
      Code to type on the phone
  • 400phone_number is missing
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
  • 404No live connection manager for this session; unknown session, or a session of another tenant
  • 500The library could not create a code; error carries its message
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/pairing-code" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "phone_number": "+447700900123"
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/pairing-code', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "phone_number": "+447700900123"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/pairing-code",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "phone_number": "+447700900123",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/pairing-code', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'phone_number' => '+447700900123',
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "phone_number": "+447700900123"
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/pairing-code", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "code": "RECIPIENT_OPTED_OUT"
}

Reconnect a device

POST/v1/sessions/{sessionId}/reconnect

Restarts the WhatsApp connection of the session. With clear_creds: true the stored credentials are wiped first and the status goes back to pending, so the device has to be linked again (QR or pairing code); this flag only takes effect when the session already has a live connection manager. Poll GET /v1/sessions/{id} for the resulting status.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • clear_credsboolean
    Wipe the stored WhatsApp credentials before reconnecting (default false)

Responses

  • 200Reconnect started
    Response fields
    • okbooleanrequired
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions, or the operation is not available to CS-agent logins
  • 404Unknown session, or a session of another tenant
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/reconnect" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "clear_creds": true
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/reconnect', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "clear_creds": true
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/reconnect",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "clear_creds": True,
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/reconnect', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'clear_creds' => true,
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "clear_creds": true
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/reconnect", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "ok": true
}

Resync groups and chats

POST/v1/sessions/{sessionId}/sync

Re-fetches the participating groups and the WhatsApp app-state (chats, contacts) and refreshes group names in the inbox; waits up to 15 seconds for the app-state part. contacts counts the one-to-one chats known in the inbox, not an address book.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Responses

  • 200Sync finished
    Response fields
    • groupsintegerrequired
      Groups the account participates in
    • contactsintegerrequired
      Distinct one-to-one chats in the inbox
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions
  • 404Unknown session, or a session of another tenant
  • 409The session is not connected (NOT_CONNECTED)
  • 502The sync failed (SYNC_FAILED)
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sync" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sync', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sync",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sync', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/sync", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "groups": 1,
  "contacts": 1
}

Check numbers on WhatsApp

POST/v1/sessions/{sessionId}/validate

Checks which of up to 1 000 numbers or JIDs have a WhatsApp account. Targets are normalised like recipients elsewhere (international format, or local format resolved against the business country or country_code); targets that cannot be normalised are dropped. If the lookup itself fails, every target is reported in not_registered. Limited to 10 calls per minute per key.

Path parameters

  • sessionIdstringrequired
    Session (device) id

Request body

  • targetsarray of stringrequired
    Phone numbers or JIDs
    Up to 1 000 items
  • country_codestring
    Calling code (digits) used for local-format numbers; defaults to the business country

Responses

  • 200Result
    Response fields
    • registeredarray of stringrequired
      JIDs that have a WhatsApp account
    • not_registeredarray of stringrequired
      Normalised JIDs that were not found
  • 400targets is not an array of strings, or has more than 1 000 entries
  • 401Missing or invalid credentials
  • 403The API key is restricted to other sessions
  • 404Unknown session, or a session of another tenant
  • 409The session is not connected
  • 429Strict rate limit exceeded: 10 requests per minute (RATE_LIMITED)
Request
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/validate" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "targets": [
    "+447700900123",
    "+12025550123"
  ]
}'
const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/validate', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "targets": [
      "+447700900123",
      "+12025550123"
    ]
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);
import os
import requests

res = requests.post(
    "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/validate",
    headers={
        "Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
    },
    json={
        "targets": [
            "+447700900123",
            "+12025550123",
        ],
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/validate', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
    ],
    'json' => [
        'targets' => [
            '+447700900123',
            '+12025550123',
        ],
    ],
]);

print_r(json_decode((string) $res->getBody(), true));
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{
	  "targets": [
	    "+447700900123",
	    "+12025550123"
	  ]
	}`)
	req, err := http.NewRequest("POST", "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/validate", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("CHATKOMODO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	if res.StatusCode >= 400 {
		panic(fmt.Sprintf("%d: %s", res.StatusCode, data))
	}
	fmt.Println(string(data))
}
Response 200
{
  "registered": [
    "string"
  ],
  "not_registered": [
    "string"
  ]
}