Get QR Code (JSON) Guide
This endpoint allows you to retrieve the WhatsApp pairing QR Code in JSON format. This format is ideal if you want to build your own custom dashboard where users can scan the QR directly from your custom interface.
Pro Tip: Real-time UI
Use this endpoint within a polling mechanism (e.g., every 20-30 seconds) on your frontend to display the latest QR Code until the status changes to ALREADY_LOGGED_IN.
Response Structure
The response will include a base64 string that can be displayed directly in an <img> tag.
| Field | Type | Explanation |
|---|---|---|
status | string | success or error |
message | string | Status message (e.g., ALREADY_LOGGED_IN) |
data.qr_code | string | Base64 string with the prefix data:image/png;base64,... |
Implementation Example (React)
const fetchQR = async () => {
const res = await fetch(`https://api.wagy.web.id/api/v1/${DEVICE_ID}/auth/qr/json`, {
headers: { 'Authorization': `Bearer ${TOKEN}` }
});
const json = await res.json();
if (json.data?.qr_code) {
setQrImage(json.data.qr_code);
}
};
Get device QR code (JSON)
GET/:device_id/auth/qr/json
Fetch the latest pairing QR code as a base64 image string.
Request
Responses
- 200
OK