Initiate the login process by generating a pairing code that can be entered in your WhatsApp mobile app.
Authentication
Basic authentication credentials (username:password in base64)
Device identifier for multi-device support. Required when multiple devices are registered. If only one device is registered, it will be used as the default.
Query Parameters
Your phone number with country code (no + prefix)Example: 628912344551
Response
Response code indicating success or failureExample: SUCCESS
Human-readable response messageExample: Success
Login response dataThe pairing code to enter in WhatsAppExample: ABCD-1234
Example Request
curl -X GET 'http://localhost:3000/app/login-with-code?phone=628912344551' \
-u 'username:password' \
-H 'X-Device-Id: my-device-id'
Response Example
{
"code": "SUCCESS",
"message": "Success",
"results": {
"pair_code": "ABCD-1234"
}
}
Error Responses
Internal Server Error{
"code": "INTERNAL_SERVER_ERROR",
"message": "Failed to generate pairing code",
"results": null
}
Usage Notes
- Enter the pairing code in WhatsApp: Settings > Linked Devices > Link a Device > Link with Phone Number Instead
- The pairing code is time-limited and expires after a short period
- Make sure to use your phone number with country code but without the + prefix
- Once paired successfully, your session will be established
- The device will remain logged in until you explicitly logout