Connections

Link a WhatsApp number with a pairing code instead of a QR

A QR needs a second screen to scan from. A pairing code does not: the person types it on the phone that owns the number.

Ask for a code

Begin pairing by code
curl -X POST https://www.chatrail.dev/v1/connections/shop/pair \
  -H "Authorization: Bearer $CHATRAIL_API_KEY" -H "Content-Type: application/json" \
  -d '{ "method": "code", "phone": "+447700900123" }'

phone is the number being linked — WhatsApp sends the prompt to that phone. The response is a grant, not the code: fetch it once with GET /v1/connections/shop/qr/{grant_id}, which returns it with encoding: "pairing-code". Like a QR, the code is a pairing credential — whoever enters it links their device — so it is handed out once and never logged by ChatRail.

Enter it on the phone

WhatsApp → Linked devicesLink a deviceLink with phone number instead, then type the code. The connection moves to connected and connection.connected is sent. The dashboard's pair dialog offers the same flow under Link with phone number instead. Requests are rate limited, since each code makes WhatsApp notify the phone.

Related documentation

API reference · Webhook events · WhatsApp API · Security

BUILD IT

Wire it against the real schemas.

Every shape on this page is the one the endpoint validates. Verify it in your own stack before production rollout.

Start free