Run these in order. Your first bridge is free for 7 days with a card on file, nothing charged until the trial ends.
Create an API key at Dashboard → API keys. It starts with sk_ and is shown once, so copy it now. Every call below sends it as Authorization: Bearer $WA_API_KEY.
customer_ref = sandbox. Skip steps 2 and 3, use sandbox wherever a customer_ref appears below, and send to 15550001234, a fake contact who replies within seconds. Events show on your dashboard.npm install axios express
export WA_API_KEY="sk_..."
Your first bridge is created from the dashboard: one click connects a number and starts the 7-day free trial (card on file, $0 today). Every API call below can address it as /api/instances/default/…: default always means your first bridge, so no name goes in the URL. The call here is how you add more bridges to the subscription.
customer_ref is your internal identifier (user ID, slug, anything you control). webhook_url is optional: leave it out to use the hosted inbox and read events on the dashboard, change it any time with PATCH.
Store the webhook_secret that comes back. It signs every webhook the bridge sends you.
402 no_subscription: connect a number in the dashboard first.const axios = require('axios')
const API_KEY = process.env.WA_API_KEY
const BASE = 'https://wabridges.com/api'
async function provision(customerRef, webhookUrl) {
const { data } = await axios.post(`${BASE}/instances`, {
customer_ref: customerRef,
webhook_url: webhookUrl,
}, {
headers: { Authorization: `Bearer ${API_KEY}` }
})
return data // { id, customer_ref, state }
}
const bridge = await provision('user-123', 'https://yourbackend.com/hook')
console.log(bridge)
{"id": "7d09aa9c-…", "customer_ref": "user-123", "state": "running", "created_at": 1777180605, "webhook_secret": "whs_…", "webhook_url": "https://…/hook"}
You need the phone in hand for this step. Request a pairing code, open WhatsApp on the phone, go to Linked Devices → Link a device → Link with phone number, then enter the code. Any number works, personal, VoIP, or a spare SIM. No phone? Use sandbox.
Once paired, the bridge fires a connected webhook event. Poll /proxy/status or wait for the event.
async function pair(customerRef, phone) {
const { data } = await axios.post(
`${BASE}/instances/${customerRef}/proxy/pair`,
{ phone },
{ headers: { Authorization: `Bearer ${API_KEY}` } }
)
return data.code // "ABCD-EFGH"
}
const code = await pair('user-123', '15550001234')
console.log(`Enter this code on the phone: ${code}`)
{"code": "ABCD-EFGH"}
Add an Idempotency-Key: <unique-per-message> header in production so a timeout plus retry can never double-send. See Idempotency.
A bridge that sat for a few hours with no phone linked is paused to save resources. The first call after that returns 503 bridge_starting with a Retry-After header. Wait those seconds and retry once.
async function sendText(customerRef, to, body) {
const { data } = await axios.post(
`${BASE}/instances/${customerRef}/proxy/send/text`,
{ chat: to, body },
{ headers: { Authorization: `Bearer ${API_KEY}` } }
)
return data // { message_id, timestamp }
}
await sendText('user-123', '15559876543', 'Hello from the API!')
{"message_id": "ACE41E...", "timestamp": 1777180605}
Inbound messages and events are delivered by POST to your webhook_url. Return 200 immediately and do the work afterwards.
The webhook guide has every event type and field, plus signature verification.
const express = require('express')
const app = express()
app.use(express.json())
app.post('/hook', (req, res) => {
res.sendStatus(200)
const { event, ...data } = req.body
if (event === 'message' && !data.from_me) {
console.log(`${data.name}: ${data.body}`)
// reply with sendText(data.chat_id, 'Got it!')
}
})
app.listen(3000)
Everything the quickstart skipped: media, polls, contacts, presence, and every webhook payload.