Skip to main content

telead

PyPI Python Docs License: MIT

A Python library for the Telegram Ads API (https://promoteapi.telegram.org).

It covers every method in the API documentation — accounts, related accounts and budget transfers, ads, uploads, stats and reports, retargeting audiences, the Pixel Tag and the targeting catalogue — and adds what you would otherwise write yourself: typed responses, automatic idempotency keys, safe retries, pagination, schedule builders and local validation against the documented caps.

from telead import Client, InputAdTargetChannels

client = Client("<ACCESS_TOKEN>")

ad = client.create_ad(
    title="Autumn launch",
    text="Everything you need to know about the launch, in one channel.",
    promote_url="https://t.me/mychannel",
    cpm=2.5,
    placement="channel_post",
    target=InputAdTargetChannels(channel_ids=["@somechannel"]),
    initial_budget=50,
)
print(ad.ad_id, ad.status)

The access token is at ads.telegram.org/account/api.

Install

pip install telead

Python 3.9+. The only runtime dependency is requests. Upgrade with pip install -U telead; releases are listed on PyPI.

Documentation

https://elimeshi1.github.io/TeleAd/, built from docs/ with MkDocs Material.

Getting started Get a token, make a first call, create a first ad
How it works Requests, accounts, currencies, idempotency, pagination
Questions and answers Review, minimum CPMs, agencies, rate limits
Creating ads Create, edit, pause, schedule, review, delete
Targeting Channels, users, bots and search
Photos and videos Media in ads, and the website photo
Budgets and accounts Ad budgets, related accounts, transfers, transactions
Stats and reports Per-interval stats and monthly reports
Retargeting audiences Audiences from phone numbers
Pixel and conversions The Pixel Tag and conversion events
Client Every method
Targets and schedules InputAdTarget*, InputAdSchedule
Models Ad, Account, AdStatItem, …
Errors Exception tree, error codes, retries
Limits and formats Every cap, enumeration and file format
Recipes Agencies, top-ups, bulk edits, reports
Testing Testing your code without the network

Build the site locally with:

pip install -r docs/requirements.txt
mkdocs serve

At a glance

from telead import Client, InputAdSchedule, InputAdTargetUsers

with Client(token) as client:
    # Balances are in the account's own currency: EUR, TON or XTR.
    account = client.get_current_account()

    # Every ad, page after page.
    for ad in client.iter_ads():
        print(ad.ad_id, ad.status, ad.views, ad.ctr)

    # A photo ad for German-speaking Android users, weekday office hours.
    photo = client.upload_ad_photo("banner.jpg")
    client.create_ad(
        title="DACH — Android",
        text="Die App für dein Team.",
        photo_id=photo.photo_id,
        promote_url="https://t.me/mybot",
        cpm=3,
        placement="channel_post",
        target=InputAdTargetUsers(country_codes=["DE", "AT", "CH"], device="android"),
        schedule=InputAdSchedule.weekly(
            {d: range(9, 18) for d in ("mon", "tue", "wed", "thu", "fri")}, timezone=3600),
        initial_budget=100,
    )

    # Agencies: act on a related account, move budget, wait for the transfer.
    acme = client.with_account("rel-123")
    final = client.wait_for_transaction(client.increase_account_budget("rel-123", 50))

Calls that move money or create things carry an idempotency key automatically, so a retry after a dropped connection never runs them twice.

Examples

Tests

git clone https://github.com/Elimeshi1/TeleAd.git
cd TeleAd
pip install -U pip        # editable installs need pip 21.3 or newer
pip install -e ".[dev]"
pytest

License

MIT. telead is an independent library, not affiliated with or endorsed by Telegram.

Metadata

Release files for telead 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telead 0.1.1
File Size Uploaded
telead-0.1.1.tar.gz 41.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telead 0.1.1
File Interpreter ABI Platform
telead-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 76.3 kB

Release files / telead-0.1.1.tar.gz

Download URL telead-0.1.1.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3140dd290b75064985e19037bfc27d49bf34c928facf3bb8b849ce009370f47f
BLAKE2b-256 checksum
How to use checksums
65a77fa5126f0f03263eac15ce1967a554f20efc3e62dcd83e7c661889ca67e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release files / telead-0.1.1-py3-none-any.whl

Download URL telead-0.1.1-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bc0826079863dfa719c4d9f126a63c1fdff7067680f86aef6440d5976efd298
BLAKE2b-256 checksum
How to use checksums
3843d71e947403cb8b6c4947558ff3e4239345b70b3aa284ff84bd875d54c2f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page