tg-ads-kit uses the same authenticated browser session that
https://ads.telegram.org uses.
Set TELEGRAM_ADS_COOKIE to the full HTTP Cookie request header sent by your
browser when it is logged in to https://ads.telegram.org.
It should look like a semicolon-separated cookie header:
stel_adowner=...; stel_ssid=...; stel_token=...The exact cookie names and values are controlled by Telegram Ads. The package
only validates that the header looks like an ads.telegram.org session cookie by
requiring a stel_ cookie to be present.
- Log in to
https://ads.telegram.orgin a browser. - Open browser developer tools.
- Open the Network tab.
- Reload an authenticated Telegram Ads page such as
/account. - Select the request to
ads.telegram.org. - Copy the full
Cookierequest header. - Store it outside source control, for example in
.env.
Do not copy response headers, individual cookie fragments, or JavaScript values. The client expects the complete request Cookie header.
Most reporting methods also need the Telegram Ads account token. You can find it in report links such as:
/reports/account/{accountToken}?month=202606Use the {accountToken} segment as TELEGRAM_ADS_ACCOUNT_TOKEN in local smoke
tests or pass it directly to client methods.
TG_ADS_API_TOKEN is not a Telegram token. It is your own bearer token for the
standalone HTTP API server.
curl "http://127.0.0.1:3000/v1/accounts/$TELEGRAM_ADS_ACCOUNT_TOKEN/daily" \
-H "Authorization: Bearer $TG_ADS_API_TOKEN"Use a long random value and keep it private.
Rotate the Telegram Ads browser session if the cookie is exposed. Rotate
TG_ADS_API_TOKEN if the standalone HTTP API token is exposed.