Skip to main content

API Reference

Kaanha AI provides a REST API for programmatic access to contacts, conversations, messages, and more. All API endpoints use Bearer token authentication via API Keys.

Authentication

Create an API Key

  1. Go to Settings → API Keys → Create Key
  2. Give it a descriptive name and optional expiry date
  3. Copy the key immediately — it won’t be shown again

Using the API Key

Include the key in all requests:

Base URL


Endpoints

Status

GET /api/whatsapp-api/status Returns WhatsApp connection status for the authenticated organization.

Contacts

GET /api/whatsapp-api/contacts List contacts with optional filtering. POST /api/whatsapp-api/contacts Create a new contact.

Conversations

GET /api/whatsapp-api/chats List conversations. GET /api/whatsapp-api/chats/{conversationId} Get a single conversation with recent messages.

Messages

GET /api/whatsapp-api/messages List recent messages across all conversations. POST /api/whatsapp-api/send Send a message to a contact.
Supported message types:

Media

POST /api/media/upload Upload media. Returns a mediaId for use in message sends.
Supported types: images (JPEG, PNG, WebP), documents (PDF, DOCX), audio (MP3, OGG), video (MP4) GET /api/media/{mediaId} Download/stream a media file by ID.

MCP Server (Claude / AI Assistants)

Kaanha AI exposes an MCP (Model Context Protocol) server for integration with Claude and other AI assistants.

stdio Transport (Claude Desktop / Claude Code)

Available tools: list_contacts, get_contact, create_contact, list_conversations, get_conversation, send_message, list_templates, send_broadcast, get_analytics, list_ai_agents, list_quick_replies, create_payment_link

SSE Transport (Network Clients)


Rate Limits

Rate limit responses return HTTP 429 with a Retry-After header.

Webhooks (Outgoing)

Kaanha AI can push events to your server. See Webhooks Guide.

Error Codes

Error responses always include a JSON body: