Skip to content

Get Session ​

GET /session

Get the session data: QR code, connection status, the logged-in Telegram profile, and webhook settings. After Create Session or Reset Session, this is the endpoint you call repeatedly until the QR is scanned.

It's also safe to call while the session is disconnected, which makes it perfect for periodic connection checks.

Endpoint Details ​

  • Base URL: https://api-zate.azickri.com
  • Headers: id and session-id

Headers ​

HeaderTypeRequiredDescription
idstringYesid from Create Session.
session-idstringYessessionId from Create Session.

Example Request ​

bash
curl "https://api-zate.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-zate.azickri.com/session', {
  headers: {
    'id': 'YOUR_ID',
    'session-id': 'YOUR_SESSION_ID',
  },
});

console.log(response.data);
javascript
const response = await fetch('https://api-zate.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": "123456789",
  "name": "Cak Zate",
  "username": "cakzate",
  "phone": "6281234567890",
  "sessionId": "0b2f7059-8a90-4f6d-8684-b0e1ce6f0310",
  "isConnected": true,
  "qrcode": "",
  "isPasswordRequired": false,
  "passwordHint": "",
  "picture": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQ...",
  "webhook": {
    "url": "https://example.com/webhook/zate",
    "token": "super-secret-123"
  }
}
json
{
  "id": "68b3f0a2c1d4e5f6a7b8c9d0",
  "generatedId": "",
  "name": "",
  "username": "",
  "phone": "",
  "sessionId": "0b2f7059-8a90-4f6d-8684-b0e1ce6f0310",
  "isConnected": false,
  "qrcode": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAAB...",
  "isPasswordRequired": false,
  "passwordHint": "",
  "picture": "",
  "webhook": { "url": "", "token": "" }
}
json
{
  "id": "68b3f0a2c1d4e5f6a7b8c9d0",
  "generatedId": "",
  "name": "",
  "username": "",
  "phone": "",
  "sessionId": "0b2f7059-8a90-4f6d-8684-b0e1ce6f0310",
  "isConnected": false,
  "qrcode": "",
  "isPasswordRequired": true,
  "passwordHint": "cat's name",
  "picture": "",
  "webhook": { "url": "", "token": "" }
}
json
{
  "statusCode": 400,
  "message": "invalid header"
}
json
{
  "statusCode": 404,
  "message": "session not found"
}
FieldTypeDescription
idstringThe session's main ID.
generatedIdstringTelegram user ID of the logged-in account. Empty if it has never connected.
namestringThe Telegram account's name. Falls back to the username, phone, or ID when empty.
usernamestringThe account's username without @. Empty if the account has none.
phonestringThe account's phone number.
sessionIdstringThe session's unique identifier.
isConnectedbooleantrue when the session is logged in and connected to Telegram.
qrcodestringThe QR image as a base64 PNG, without a data: prefix. Changes roughly every 30 seconds. Empty when connected, waiting for a password, or not ready yet.
isPasswordRequiredbooleantrue when the QR was scanned but the account uses two-step verification. Continue with Submit Password.
passwordHintstringThe password hint you set in Telegram. May be empty.
picturestringSmall profile photo as a data URI (data:image/jpeg;base64,...). May be empty.
webhookobjectCurrent webhook settings: url and token. Both empty when the webhook is off. See Set Webhook.

Showing the QR Code ​

qrcode is a raw base64 PNG. Add the data:image/png;base64, prefix and it works in an <img> tag:

javascript
const { qrcode, isConnected, isPasswordRequired } = await response.json();

if (!isConnected && qrcode) {
  document.querySelector('#qr').src = `data:image/png;base64,${qrcode}`;
}

if (isPasswordRequired) {
  // Show a password form, then send it to POST /session/password
}

Polling tips

  • Call this endpoint every 2–3 seconds while waiting for the scan.
  • The QR changes roughly every 30 seconds, so always show the newest one.
  • Stop polling once isConnected becomes true, or when isPasswordRequired becomes true (just ask for the password).
  • If you suddenly get 404, the QR expired and the session was deleted, so create a new one.