English
Get Session
GET/sessionGet 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:
idandsession-id
Headers
| Header | Type | Required | Description |
|---|---|---|---|
id | string | Yes | id from Create Session. |
session-id | string | Yes | sessionId 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"
}| Field | Type | Description |
|---|---|---|
id | string | The session's main ID. |
generatedId | string | Telegram user ID of the logged-in account. Empty if it has never connected. |
name | string | The Telegram account's name. Falls back to the username, phone, or ID when empty. |
username | string | The account's username without @. Empty if the account has none. |
phone | string | The account's phone number. |
sessionId | string | The session's unique identifier. |
isConnected | boolean | true when the session is logged in and connected to Telegram. |
qrcode | string | The 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. |
isPasswordRequired | boolean | true when the QR was scanned but the account uses two-step verification. Continue with Submit Password. |
passwordHint | string | The password hint you set in Telegram. May be empty. |
picture | string | Small profile photo as a data URI (data:image/jpeg;base64,...). May be empty. |
webhook | object | Current 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
isConnectedbecomestrue, or whenisPasswordRequiredbecomestrue(just ask for the password). - If you suddenly get
404, the QR expired and the session was deleted, so create a new one.