Skip to content

Get Channel Messages ​

GET /channel/message

Get the message history of one Telegram channel, newest first. Each page fetches up to 100 messages. For the next page, pass the before value from the previous response.

Media in channel messages (images, videos, stickers, documents) comes as public media links, so you can drop them straight into <img> or <video>.

Endpoint Details ​

  • Base URL: https://api-zate.azickri.com
  • Headers: id and session-id
  • Requirement: the session must be connected (isConnected: true), and your account must have joined the channel

Parameters ​

ParameterInTypeRequiredDescription
idheaderstringYesid from Create Session.
session-idheaderstringYessessionId from Create Session.
channelIdquerystringYesChannel ID, like -1001234567890, or a public channel's username.
beforequerystringNoThe before value from the previous response. Leave it empty for the newest messages.

Example Request ​

bash
curl "https://api-zate.azickri.com/channel/message?channelId=-1001234567890" \
  -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/channel/message', {
  params: {
    channelId: '-1001234567890',
  },
  headers: {
    'id': 'YOUR_ID',
    'session-id': 'YOUR_SESSION_ID',
  },
});

console.log(response.data);
javascript
const params = new URLSearchParams({
  channelId: '-1001234567890',
});

const response = await fetch(`https://api-zate.azickri.com/channel/message?${params}`, {
  headers: {
    'id': 'YOUR_ID',
    'session-id': 'YOUR_SESSION_ID',
  },
});

const data = await response.json();
console.log(data);

Response ​

json
{
  "docs": [
    {
      "id": "182",
      "serverId": 182,
      "url": "https://t.me/infosatecakzate/182",
      "type": "text",
      "text": "Open until midnight tonight! 🍢",
      "created": "2026-10-11T15:15:51.000Z"
    },
    {
      "id": "181",
      "serverId": 181,
      "url": "https://t.me/infosatecakzate/181",
      "type": "image",
      "text": "New on the menu: lamb sate with peanut sauce",
      "image": {
        "url": "https://api-zate.azickri.com/media/68b3f0a2c1d4e5f6a7b8c9d0/-1001234567890/181/photo/Xk3d9QmPz0aB1cD2eF3gH4.jpg",
        "thumbnail": "https://api-zate.azickri.com/media/68b3f0a2c1d4e5f6a7b8c9d0/-1001234567890/181/thumb/Lm2pQr7sTu8vWx9yZa0bCd.jpg",
        "mimetype": "image/jpeg"
      },
      "created": "2026-10-10T10:02:11.000Z"
    },
    {
      "id": "180",
      "serverId": 180,
      "url": "https://t.me/infosatecakzate/180",
      "type": "video",
      "text": "Behind the scenes at the grill",
      "video": {
        "url": "https://api-zate.azickri.com/media/68b3f0a2c1d4e5f6a7b8c9d0/-1001234567890/180/file/Pq4rSt5uVw6xYz7aBc8dEf.mp4",
        "thumbnail": "https://api-zate.azickri.com/media/68b3f0a2c1d4e5f6a7b8c9d0/-1001234567890/180/thumb/Gh9iJk0lMn1oPq2rSt3uVw.jpg",
        "duration": 15,
        "mimetype": "video/mp4"
      },
      "created": "2026-10-09T19:30:00.000Z"
    },
    {
      "id": "179",
      "serverId": 179,
      "url": "https://t.me/infosatecakzate/179",
      "type": "poll",
      "text": "",
      "polling": {
        "name": "Which sate do you like best?",
        "options": ["Chicken", "Lamb", "Both"]
      },
      "created": "2026-10-08T08:30:00.000Z"
    }
  ],
  "before": 0
}
json
// channelId missing
{
  "statusCode": 400,
  "message": "channelId must be a string\nchannelId should not be empty"
}

// Not a channel, or one you haven't joined
{
  "statusCode": 400,
  "message": "channel not found"
}
json
{
  "statusCode": 404,
  "message": "session not found"
}
json
{
  "statusCode": 500,
  "message": "session not connected"
}
FieldTypeDescription
docsarrayList of messages, newest first.
docs[].idstringMessage ID.
docs[].serverIdnumberMessage ID as a number. Higher is newer.
docs[].urlstringLink to the message in Telegram: t.me/<username>/<id> for public channels, or t.me/c/<id>/<id> for private ones (members only).
docs[].typestringMessage type: text, image, video, sticker, document, or poll.
docs[].textstringMessage text, or the caption for media.
docs[].imageobjectWhen type = image: url (largest size, up to 2560 pixels), thumbnail (about 800 pixels), mimetype.
docs[].videoobjectWhen type = video: url, thumbnail (320 pixels), duration (seconds), mimetype.
docs[].stickerobjectWhen type = sticker: url, mimetype (image/webp). Animated stickers use their thumbnail image.
docs[].documentobjectWhen type = document: url, name, size (bytes), mimetype.
docs[].pollingobjectWhen type = poll: name (the question) and options (the choices).
docs[].createdstringWhen the message was sent (ISO 8601).
beforenumberSend this as the before query to get the next page. 0 means there are no more pages.

What's left out

  • Service messages (like "message pinned" or "channel photo changed") are skipped, so a page can hold fewer than 100 messages even when before isn't 0 yet.
  • Unsupported media without a caption still shows up, but as type: "text" with text: "UNSUPPORTED TYPE".
  • thumbnail can be empty when Telegram doesn't keep a thumbnail for that file.

Pagination ​

It's simple: call without before for the first page, then pass the before from each response to the next request. Stop when before is 0.

javascript
const BASE_URL = 'https://api-zate.azickri.com';
const headers = {
  'id': 'YOUR_ID',
  'session-id': 'YOUR_SESSION_ID',
};

async function getAllChannelMessages(channelId) {
  const messages = [];
  let before = '';

  do {
    const params = new URLSearchParams({ channelId });
    if (before) params.set('before', before);

    const response = await fetch(`${BASE_URL}/channel/message?${params}`, { headers });
    const data = await response.json();
    if (!response.ok) throw new Error(data.message);

    messages.push(...data.docs);
    before = String(data.before);
  } while (before !== '0');

  return messages;
}

const messages = await getAllChannelMessages('-1001234567890');
console.log(`${messages.length} messages in total`);

No need to fetch everything

Older channels can have thousands of messages. If you only need the latest ones, the first page is enough.