NewAds Insights — see what each Facebook ad costs and the WhatsApp leads it brings. Free on every plan. See Ads Insights →
Lead Pattern

Developers

WhatsApp API code examples

Working code for the Lead Pattern WhatsApp API — send approved templates and text replies, handle errors and rate limits, and receive real-time webhooks. Pick your language.

Last updated: 6 November 2026

✨ Ask AI about this page:ChatGPT logoChatGPTClaude logoClaudePerplexity logoPerplexity

Quick answer

Create an API key in your Lead Pattern dashboard and send it as-is in the Authorization header (no "Bearer" prefix) to https://public.leadpattern.com. POST /v2/whatsapp/message/template sends an approved template; POST /whatsapp/message/text sends a free-form reply inside the 24-hour window. Real-time events arrive at your URL as webhooks.

API reference

The basics

Everything you need to start

Value (from the API docs)
Base URLhttps://public.leadpattern.com
Auth headerAuthorization: YOUR_API_KEY — the raw key (starts with lp_), no Bearer prefix
Send a templatePOST /v2/whatsapp/message/template (named placeholders) or POST /whatsapp/message/template (positional)
Send a text replyPOST /whatsapp/message/text — only within 24 hours of the customer's last message
Register a webhookPOST /v2/webhook/register
Health checkGET /health-check (no key needed)
Rate limits60 requests a minute and 10 concurrent per key (default); 300 a minute per IP; 429 + Retry-After when exceeded
API calls per planStarter 1,000 a month · Growth 1,00,000 a month with unlimited API keys and webhooks · Enterprise custom

Template or text?

The WhatsApp 24-hour window, which Meta calls the customer service window, starts when a customer messages your business and resets with every new message from them. While it is open you can send normal replies without approval. Once 24 hours pass with no customer message, you can only send pre-approved templates. So: the first message to a customer, or any message after the window closes, is a template; replies inside the window can be plain text. The 24-hour window explained → · What a WhatsApp template is →

Beyond sending messages

The same API key also works for images, documents, buttons and lists, contacts, tags, notes, broadcast groups, WhatsApp Flows and exports — every endpoint is in the API reference. API keys come with usage logs, IP whitelisting and per-key rate limits. Webhooks & API →

Questions developers ask

Does Lead Pattern have a WhatsApp API for developers?+

Yes. Lead Pattern gives you a REST API and real-time webhooks on top of the official WhatsApp Business API. Starter includes 1,000 API calls a month; Growth includes 1,00,000 a month with unlimited API keys and unlimited webhooks.

How do I authenticate API requests?+

Send your API key in the Authorization header on every request, exactly as issued — without a Bearer prefix. Keep the key on your server.

Which languages can I use?+

Any language that can make HTTPS requests with JSON. This page has ready examples for Python, PHP, Node.js and cURL.

Where is the full API reference?+

At docs.leadpattern.com/api — every endpoint with its fields, sample responses and a Try It console.

Lead Pattern

Get your API key — free 14-day trial.

Set up the official WhatsApp Business API, create a key and send your first message today.

14-day free trial · No credit card · Free WhatsApp API setup

Ask AI about this page

Get a quick summary of this page from your favourite AI assistant — based only on leadpattern.com. Be one of the first to try it.