Skip to content

Link a WhatsApp number

POST
/v1/auth/me/whatsapp
curl --request POST \
--url https://api.emite.cr/v1/auth/me/whatsapp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "phone": "+50688887777" }'

Sends a 6-digit verification code over WhatsApp to the number, valid for 10 minutes; confirm it at POST /v1/auth/me/whatsapp/verify. The number will act for the company of this session (403 TENANT_REQUIRED without one). Linking subscribes to nothing: a new link starts with every notification toggle off. A person has one link: linking another number, or from a session in another company, moves it there, keeps its toggles and puts it back to pending until the new code is confirmed. The answer is { sent: true, phoneE164 }. At most 3 codes per person per hour (400 WHATSAPP_OTP_RATE_LIMITED; one that could not be delivered, 502 WHATSAPP_OTP_SEND_FAILED, does not count). 409 WHATSAPP_PHONE_ALREADY_LINKED when another person has the number verified; 400 WHATSAPP_LINK_NOT_AVAILABLE_IN_DEMO in the demo. For a person’s session (JWT) only: an API key answers 403.

Media typeapplication/json
object
phone
required

The WhatsApp number to link, in E.164 (+50688887777). Without the + it is read as a Costa Rican number (88887777 becomes +50688887777); spaces and dashes are ignored. A number that cannot exist answers 400 WHATSAPP_PHONE_INVALID.

string
Example
+50688887777

The code went out; the link is pending until it is confirmed.

Media typeapplication/json
object
sent
required

Always true: the verification code went out over WhatsApp.

boolean
phoneE164
required

The number the code was sent to, normalized to E.164: the one the link now holds, pending until the code is confirmed at POST /v1/auth/me/whatsapp/verify.

string
Example
{
"sent": true,
"phoneE164": "+50688887777"
}