English
Get Session
GET/sessionFetch the session's data: the QR code, connection status, and the connected WhatsApp account's name and profile picture. After Create Session or Reset Session, this is the endpoint you call repeatedly until the QR code is scanned.
It's also safe to call while the session is disconnected, which makes it perfect for checking the connection regularly.
Endpoint Details
- Base URL:
https://api-zawa.azickri.com - Headers:
idandsession-id
Headers
| Header | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The id from Create Session. |
session-id | string | Yes | The sessionId from Create Session. |
Example Request
bash
curl "https://api-zawa.azickri.com/session" \
-H "id: YOUR_ID" \
-H "session-id: YOUR_SESSION_ID"javascript
import axios from 'axios';
const response = await axios.get('https://api-zawa.azickri.com/session', {
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
},
});
console.log(response.data);javascript
const response = await fetch('https://api-zawa.azickri.com/session', {
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
},
});
const data = await response.json();
console.log(data);Response
json
{
"id": "68b3f0a2c1d4e5f6a7b8c9d0",
"generatedId": "6281234567890:12@s.whatsapp.net",
"name": "Zawa Bot",
"sessionId": "0b2f7059-8a90-4f6d-8684-b0e1ce6f0310",
"isConnected": true,
"qrcode": "",
"picture": "https://pps.whatsapp.net/v/t61.24694-24/..."
}json
{
"id": "68b3f0a2c1d4e5f6a7b8c9d0",
"generatedId": "",
"name": "",
"sessionId": "0b2f7059-8a90-4f6d-8684-b0e1ce6f0310",
"isConnected": false,
"qrcode": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAAB...",
"picture": ""
}json
{
"statusCode": 400,
"message": "invalid header"
}json
{
"statusCode": 404,
"message": "session not found"
}| Field | Type | Description |
|---|---|---|
id | string | The session's main ID. |
generatedId | string | The WhatsApp ID (JID) of the connected device, formatted as number:device@s.whatsapp.net. Empty if it has never connected. |
name | string | The connected WhatsApp account's name. |
sessionId | string | The session's unique identifier. |
isConnected | boolean | true while the session is connected to WhatsApp. |
qrcode | string | The QR code as a base64-encoded PNG, without a data: prefix. Empty once connected or before the QR code is ready. |
picture | string | URL of the WhatsApp account's profile picture. May be empty. |
Showing the QR Code
qrcode is a raw base64 PNG. Add the data:image/png;base64, prefix and you can use it straight in an <img> tag:
javascript
const { qrcode, isConnected } = await response.json();
if (!isConnected && qrcode) {
document.querySelector('#qr').src = `data:image/png;base64,${qrcode}`;
}Polling tips
- Call this endpoint every 2–3 seconds while waiting for the scan.
- The QR code can change a few times, so always show the latest one.
- Stop polling once
isConnectedistrue. - If you suddenly get a
404, the QR code expired and the session was deleted, so create a new one.