Skip to content

Get Session ​

GET /session

Fetch 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: id and session-id

Headers ​

HeaderTypeRequiredDescription
idstringYesThe id from Create Session.
session-idstringYesThe 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:[email protected]",
  "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"
}
FieldTypeDescription
idstringThe session's main ID.
generatedIdstringThe WhatsApp ID (JID) of the connected device, formatted as number:[email protected]. Empty if it has never connected.
namestringThe connected WhatsApp account's name.
sessionIdstringThe session's unique identifier.
isConnectedbooleantrue while the session is connected to WhatsApp.
qrcodestringThe QR code as a base64-encoded PNG, without a data: prefix. Empty once connected or before the QR code is ready.
picturestringURL 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 isConnected is true.
  • If you suddenly get a 404, the QR code expired and the session was deleted, so create a new one.