Link a WhatsApp number
const url = 'https://api.emite.cr/v1/auth/me/whatsapp';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"phone":"+50688887777"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
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.
Example
+50688887777Responses
Section titled “Responses”The code went out; the link is pending until it is confirmed.
object
Always true: the verification code went out over WhatsApp.
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.
Example
{ "sent": true, "phoneE164": "+50688887777"}