wakit
REST API

REST API

Access wakit via the REST API using your API key.

wakit provides a REST API at /functions/v1/api that lets you list conversations, send messages, search contacts, and more. All endpoints authenticate with your wakit API key (sk_*).

Authentication

Every request requires the Authorization header with your wakit API key:

curl "https://api.wakit.ai/functions/v1/api/accounts" \
  -H "Authorization: Bearer {API_KEY}"

Create API keys in the wakit dashboard under Settings > API Keys.

CLI

You can also use the wakit CLI instead of curl:

npm install -g wakit-cli
wakit init                          # configure API key and default account
wakit conversations                 # list conversations
wakit send 5215551234 "Hello"       # send a message
wakit chat 5215551234               # view conversation history

See the CLI section below for all commands.

Endpoints

List accounts

List connected WhatsApp numbers for your organization.

GET /functions/v1/api/accounts

Response:

{
  "accounts": [
    { "phone": "5215588392274", "name": "Mirlo" }
  ]
}

List conversations

Get recent conversations with last message preview.

GET /functions/v1/api/conversations?limit=10&account_phone=5215588392274
ParameterRequiredDescription
limitNoMax conversations (default 10)
account_phoneNo*WhatsApp number to use (*required if org has multiple numbers)

Response:

{
  "account": { "name": "Mirlo", "phone": "5215588392274" },
  "conversations": [
    {
      "contact": { "name": "Maria Garcia", "phone": "5215551234567" },
      "unread": 2,
      "last_message": {
        "direction": "incoming",
        "content": { "kind": "text", "text": "Hola, necesito ayuda" },
        "timestamp": "10:30",
        "status": "delivered"
      }
    }
  ]
}

Get conversation (full context)

Fetch all messages from a conversation with a specific contact. Includes service window status.

GET /functions/v1/api/conversation?contact_phone=5215551234567&limit=50&account_phone=5215588392274
ParameterRequiredDescription
contact_phoneYesContact phone number (digits only, with country code)
limitNoMax messages (default 50)
account_phoneNo*WhatsApp number to use

Response:

{
  "account": { "name": "Mirlo", "phone": "5215588392274" },
  "contact": { "name": "Maria Garcia", "phone": "5215551234567" },
  "service_window": "open",
  "messages": [
    {
      "direction": "incoming",
      "content": { "kind": "text", "text": "Hola, necesito ayuda" },
      "time": "10:30",
      "status": "delivered"
    },
    {
      "direction": "outgoing",
      "content": { "kind": "text", "text": "Hola Maria! En que te puedo ayudar?" },
      "time": "10:31",
      "status": "read"
    }
  ]
}

Send a text message

Send a text message to a contact. Requires an open service window (incoming message within 24h).

POST /functions/v1/api/messages
Content-Type: application/json

{
  "contact_phone": "5215551234567",
  "text": "Hello from the API!",
  "account_phone": "5215588392274"
}

Send a template message

Send a pre-approved template. Works even outside the 24h service window.

POST /functions/v1/api/messages
Content-Type: application/json

{
  "contact_phone": "5215551234567",
  "template": {
    "name": "hello_world",
    "language": { "code": "es" },
    "components": []
  },
  "account_phone": "5215588392274"
}

Response (both):

{ "status": "sent" }

Search contacts

Search contacts by name or phone number.

GET /functions/v1/api/contacts?name=maria&limit=10
GET /functions/v1/api/contacts?number=5215551234567
ParameterRequiredDescription
nameNoSearch by name (partial match)
numberNoSearch by phone number (partial match)
limitNoMax results (default 10)

Response:

{
  "contacts": [
    { "name": "Maria Garcia", "phone": "5215551234567" }
  ]
}

List templates

List available WhatsApp message templates.

GET /functions/v1/api/templates?account_phone=5215588392274

Response:

{
  "templates": [
    { "id": "123", "name": "hello_world", "status": "APPROVED", "category": "UTILITY", "language": "es" }
  ]
}

Get template details

Fetch a specific template with its components.

GET /functions/v1/api/templates?template_id=123&account_phone=5215588392274

Response:

{
  "id": "123",
  "name": "hello_world",
  "status": "APPROVED",
  "category": "UTILITY",
  "language": "es",
  "components": [{ "type": "BODY", "text": "Hello {{1}}" }]
}

Health check

Validate Meta API tokens for all connected WhatsApp accounts. Returns quality rating and messaging limits.

GET /functions/v1/api/health

Response:

{
  "accounts": [
    {
      "phone": "5215588392274",
      "name": "Mirlo",
      "address": "238013449404478",
      "status": "active",
      "quality": "GREEN",
      "messaging_limit": "TIER_10K"
    },
    {
      "phone": "15550405258",
      "name": "Mirlo",
      "address": "375446602312881",
      "status": "error",
      "error": "Session has expired"
    }
  ]
}

Use this to monitor token health and detect disconnected numbers before they affect message delivery.

Errors

Errors return a JSON object with an error field:

{ "error": "Service window is closed (24h+ since last user message). You must send a template content to re-open it." }
StatusMeaning
401Invalid or missing API key
400Bad request (missing required parameter)
405Method not allowed
500Internal error

Supabase REST API (advanced)

For direct database access, wakit also exposes tables via the Supabase REST API (PostgREST). This requires a user JWT or service_role key and is intended for advanced use cases. All tables have Row Level Security (RLS) enabled.

TableDescription
organizationsTenant entities with metadata
organizations_addressesConnected phone numbers
contactsAddress book entries
contacts_addressesPhone numbers for contacts
conversationsConversations between org and contact
messagesMessages within conversations
agentsHuman or AI agents
api_keysAPI access keys
webhooksOutbound webhook subscriptions
quick_repliesReusable response snippets

CLI reference

The wakit CLI (wakit-cli on npm) wraps the REST API for terminal usage.

Install

npm install -g wakit-cli

Setup

wakit init
# → Base URL: https://api.wakit.ai
# → API Key: sk_...
# → Select default account

Config is saved to ~/.wakit/config.json.

Commands

CommandDescription
wakit initConfigure API key and default account
wakit statusShow connection status and accounts
wakit healthCheck Meta API token status for all accounts
wakit conversationsList recent conversations with preview
wakit chat <phone or name>View conversation history with a contact
wakit send <phone or name> "text"Send a text message
wakit send <phone> --template <name>Send a template message
wakit send <phone> --template <name> --vars "a,b"Send template with variables
wakit contacts [query]List all or search contacts by name/number
wakit templatesList WhatsApp message templates
wakit switch <account>Change default WhatsApp account

Flags

FlagDescription
--jsonOutput as JSON (for piping to other tools)
--from <phone>Override default account for this command
--limit <n>Limit number of results
--lang <code>Template language (default: es)

On this page