Posts
Methods of the “MAX: posts” group. On the right — a request and response example for each.
Channel posts
/v1/max/channels/{channel}/posts/Posts of a public channel, newest first, in pages of up to 100 (50 by default); the next page link is in the next field. Filters: from and to — a period in Moscow time, inclusive; is_ad — advertising only (true) or without advertising (false). Available from the “API.Max Start” plan; a private channel returns 403 closed_channel, a group chat — 404 (we don’t collect chat messages), a deleted channel or one unavailable in MAX — 404.
Parameters
| Name | Where | Description |
|---|---|---|
channel requiredstring | path | Channel ID in datool.ru or public handle (with or without @) |
cursorstring | query | Next page cursor — use the ready link from the next field |
fromdate | query | From this day (Moscow time) |
is_adyes / no | query | Only ads (true) or no ads (false) |
limitnumber | query | Rows per page: 1–100, 50 by default |
todate | query | Up to and including this day (Moscow time) |
Response fields
| Field | Type | Description |
|---|---|---|
results | list | Posts on this page, newest first |
results[].id | number | datool.ru post number — used in /v1/max/posts/{id}/ |
results[].channel | number | Channel ID in datool.ru |
results[].external_id | number | Post number in the MAX channel |
results[].url | string or null | Post link in MAX or null |
results[].published_at | date and time | Publication time (ISO 8601, Moscow time, +03:00) |
results[].edited_at | date and time or null | When a text edit was noticed (ISO 8601, Moscow time) or null |
results[].text | string | Post text without markup (may be empty for a post with attachments only) |
results[].views | number or null | Views as of the last read, or null |
results[].reactions_count | number or null | Total reactions, or null (not read yet) |
results[].reactions | object | Reactions by emoji: {"👍": 12} |
results[].is_ad | yes / no | Advertising post: has an erid label, an “Advertising” mark or an external link with a call to buy or follow (detected automatically) |
results[].forwarded_from | object or null | Repost source or null |
results[].media | list | Attachments in post order |
results[].page_url | string | Post page on max.datool.ru |
next | string or null | Next page URL or null |
Errors
| Code | code | When |
|---|---|---|
| 400 | field errors | An invalid parameter or body field: the error comes under the field name, for example {"channels": ["Comma-separated channel numbers."]}. |
| 401 | not_authenticated / authentication_failed | No key, the key is wrong or revoked, the member is suspended or the key’s organization is archived. |
| 403 | tariff_required | Posts are closed on “API.Max Test” — “API.Max Start” is required. |
| 403 | closed_channel | A private channel: the API returns only its card. |
| 404 | not_found | There is no object with this number or name, or you can’t see it. |
| 404 | not_found | A group chat: chat messages are not collected. |
| 429 | rate_limited / quota_exceeded / throttled | Too often (more requests per second than your plan allows) or the requests for the period have run out; how long to wait is in the Retry-After header. |
| 503 | timeout | The database query took longer than 5 seconds — retry later or narrow the selection. |
Post
/v1/max/posts/{id}/A single post of a public channel by datool.ru number: text, publication and edit time, views, reactions by emoji, the advertising flag, the repost source and attachments. A post of a private, deleted or unavailable channel or of a group chat returns 404, as if it didn’t exist. Available from the “API.Max Start” plan.
Parameters
| Name | Where | Description |
|---|---|---|
id requirednumber | path | Post ID in datool.ru |
Response fields
| Field | Type | Description |
|---|---|---|
id | number | datool.ru post number — used in /v1/max/posts/{id}/ |
channel | number | Channel ID in datool.ru |
external_id | number | Post number in the MAX channel |
url | string or null | Post link in MAX or null |
published_at | date and time | Publication time (ISO 8601, Moscow time, +03:00) |
edited_at | date and time or null | When a text edit was noticed (ISO 8601, Moscow time) or null |
text | string | Post text without markup (may be empty for a post with attachments only) |
views | number or null | Views as of the last read, or null |
reactions_count | number or null | Total reactions, or null (not read yet) |
reactions | object | Reactions by emoji: {"👍": 12} |
is_ad | yes / no | Advertising post: has an erid label, an “Advertising” mark or an external link with a call to buy or follow (detected automatically) |
forwarded_from | object or null | Repost source or null |
forwarded_from.title | string | Source name as provided by MAX |
forwarded_from.link | string | Source link or empty |
forwarded_from.channel | number or null | Channel ID in datool.ru or null |
media | list | Attachments in post order |
media[].kind | string | image, video, audio, file, link, poll, sticker, location, contact |
media[].position | number | Attachment position in the post, from 0 |
media[].width | number or null | Image or video width in pixels or null |
media[].height | number or null | Image or video height in pixels or null |
media[].duration | number or null | Video or audio duration in seconds, or null |
media[].preview | string or null | Preview — our copy via the media.datool.ru CDN, or null (no copy) |
page_url | string | Post page on max.datool.ru |
Errors
| Code | code | When |
|---|---|---|
| 401 | not_authenticated / authentication_failed | No key, the key is wrong or revoked, the member is suspended or the key’s organization is archived. |
| 403 | tariff_required | Posts are closed on “API.Max Test” — “API.Max Start” is required. |
| 404 | not_found | There is no object with this number or name, or you can’t see it. |
| 429 | rate_limited / quota_exceeded / throttled | Too often (more requests per second than your plan allows) or the requests for the period have run out; how long to wait is in the Retry-After header. |
| 503 | timeout | The database query took longer than 5 seconds — retry later or narrow the selection. |
The error format, limit headers and what to do about each error are in the article “Errors”.