ChatKomodo Docs Home Sign in

Guide

Authentication

API keys

Send your key as a bearer token on every request to /v1:

Header
Authorization: Bearer <your API key>

A key acts as your business: it can use all of your devices, contacts and settings, within your plan. Keys are random 43-character strings, shown once when created, and stored by ChatKomodo only as a hash.

Child keys for separate integrations

Give each integration its own key (POST /v1/api-keys): it acts as your business but has its own request limit and can be revoked alone. A child key can also be limited to some devices. Such a scoped key only reaches what is listed below; everything else, including endpoints added later, answers 403 KEY_SCOPE_FORBIDDEN:

Scoped keyEndpoints
AllowedEverything under its own devices (/v1/sessions/{sessionId}/…), media uploads and files by key (/v1/media/upload-url, /v1/media/upload, /v1/media/{key}), link previews
Read onlyThe device list (only its own devices), account (/v1/me), usage, billing, business profile, settings, templates, rotators, agents, AI assistant settings (GET /v1/ai-reply)
Not allowedEverything else, among them business-wide lists that show every device (message history across devices, inbox, analytics, broadcasts, scheduled messages, /v1/sessions/all/…), the live event stream, API keys, webhooks, CRM, contacts, consent, privacy and store connections

Keys are created and revoked from a dashboard login (an API key cannot create keys).

Keeping keys safe

Signed requests (optional)

For extra protection against replay, add two headers. ChatKomodo then checks that the body was not changed and that the request is less than 5 minutes old:

Node.js
import { createHash, createHmac } from 'node:crypto';

const key = process.env.CHATKOMODO_API_KEY;
const body = JSON.stringify({ chat_id: '+447700900123', type: 'text', body: 'Signed hello' });
const ts = String(Date.now());
const bodyHash = createHash('sha256').update(body).digest('hex');
const signature = createHmac('sha256', key).update(`${ts}.${bodyHash}`).digest('hex');

await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/messages', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${key}`,
    'Content-Type': 'application/json',
    'X-Timestamp': ts,
    'X-API-Signature': signature,
  },
  body,
});

Send exactly the bytes you hashed. A wrong signature or an old timestamp returns 401.

Dashboard logins

The dashboard signs people in with a one-time code sent over WhatsApp (POST /auth/request-otp, POST /auth/verify-otp) and uses the returned token the same way: Authorization: Bearer <token>. Tokens last 2 hours and are renewed with POST /auth/refresh. A few endpoints are meant for people, not integrations, and need the owner's dashboard login — they are marked in the reference (for example creating API keys, editing AI documents and connecting stores).

Sign-in protection for the owner: an authenticator code can be required after the WhatsApp code (the sign-in then answers { "mfa_required": true, "mfa_token": … }; finish it with POST /auth/verify-mfa), passkeys sign in without a code (POST /auth/passkey/options, POST /auth/passkey/verify), and every signed-in device is listed and can be signed out (GET /v1/security/sessions). A sign-in from a new device notifies the owner.

New-browser check. Send a stable random device_id (16–64 characters, kept in the browser) with POST /auth/verify-otp and POST /auth/magic. When an owner who has a passkey or authenticator signs in from a device_id never seen before (or not for 180 days), the response is the second step with reason: "new_device" and a methods list (totp and/or passkey) instead of the tokens; finish it exactly as the authenticator step above. A known browser, an owner without a second factor, and agents are unaffected. The attempt is audited as auth.step_up.

Check a credential

Request
curl "https://api.chatkomodo.com/v1/me" \
  -H "Authorization: Bearer $CHATKOMODO_API_KEY"
const res = await fetch('https://api.chatkomodo.com/v1/me', {
  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/me",
    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/me', [
    '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/me", 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))
}

GET /v1/me says which business the credential belongs to, its plan, and whether it is an API key, the owner's login or an agent.