Skip to content
Documentation menu
HTTP APITelegram

Thinking Ads

A video card can appear in Telegram while a response is being generated. The intro transitions into the ad. Buttons and attribution appear immediately by default. With the thinking format, they are added together once the video reaches the ad.

Both endpoints accept JSON. The API key is passed in the header Authorization: Bearer <SIDEKICK_API_KEY>.

The header (“Бот думает” by default) and the intro can be changed per Telegram platform in the dashboard: Platforms → platform → Thinking Ads. The same section sets the premium emoji before the header (the loading emoji by default), a custom intro (GIF or video) and how long it plays before the ad: 1–10 seconds, 5 by default. A short animation loops, a longer one is cut.

Card request

POST /api/v1/ad/thinking

FieldTypeRequiredDescription
platform_idstringYesPublic ID of the Telegram platform in Sidekick.
user_idnumberYesTelegram ID of the user who started generation.
language_codestringYesUser's language code.
accept_formatsstring[]NoUse thinking for a separate reveal. With card or when omitted, buttons appear on send. With rich_messages: false no card is returned.
user_messagestringRecommendedThe user's request the bot is answering now. Used to pick the ad; without it topic targeting cannot match.
capabilities.custom_emojibooleanNotrue if the bot owner has Telegram Premium: the header gets an animated loading emoji.
group_idnumberNoGroup ID when generating in a group. With bot_is_admin: true the card is sent ephemerally.

Request at most one card per generation. If the response is lost, generation continues without a retry. Telegram parameters

{
"platform_id": "plt_example",
"user_id": 123,
"language_code": "ru",
"accept_formats": ["thinking"]
}

Card response

When has_ad: false, there is no card and nothing else to call. When has_ad: true:

FieldDescription
impression_idPlacement ID for the finish request.
ad.sendInitial Telegram payload: header and video. In the thinking format, without buttons and attribution.
ad.revealEdit payload that adds buttons to the same message. Omitted for single-step cards.
ad.reveal_after_msMilliseconds after sending the card to apply reveal: by then the video already shows the ad.
ad.mediaThe card's video: id (stable for an intro + creative pair), url, duration_ms, ad_starts_ms (the crossfade to the ad starts) and ad_visible_ms (the ad fills the frame).
ad.finish_within_msCompletion window in milliseconds from issuance.
ad.button_text, ad.button_urlPrimary button label and URL.

The placement status is required when generation ends. For a two-step card, ad.reveal applies ad.reveal_after_ms after sending while generation is in progress.

Billing

Only the time the ad was on screen is paid: from card issuance to the first accepted finish, minus the intro (ad.media.ad_visible_ms).

Ad timePaid
under 2 secondsnothing
2 to 30 secondslinear: (time − 2 s) / 28 s of the impression price
30 seconds or moreone full impression, never more
not_sentnothing
finish after ad.finish_within_ms (4 minutes)nothing

A shorter intro leaves more time for the ad.

Statistics

Thinking Ads impressions, clicks and earnings are reported separately in the thinking block of GET /api/v1/earnings (in total and each day) and are already included in the overall figures. A paid card counts as one whole impression; unpaid cards are not counted. Earnings appear after the first accepted finish and are recorded at the card's issuance time, so the last ~10 minutes of Thinking data are incomplete. Days are UTC. Compute fill from your own /api/v1/ad/thinking calls: requests without an ad are not in the report.

Placement completion

POST /api/v1/ad/thinking/finish

The request requires the impression_id from the card response and the placement status.

statusMeaning
removedRemoval of the sent card was confirmed.
not_sentThe card was not sent.
unknownSending or removal could not be confirmed. The status can be updated later.

Success returns 204 No Content. Retrying with the same ID and status is safe.

Errors

StatusMeaning
400Invalid request parameters.
401Missing or invalid key.
404The placement is unavailable with this API key or does not exist.
409A different final status has already been accepted.
503The same finish request can be retried after the delay specified in Retry-After.