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)

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.0

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.0
File Size Uploaded
telead-0.1.0.tar.gz 40.9 kB Details

Built distribution (wheel)

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

Total release size: 75.4 kB

Release files / telead-0.1.0.tar.gz

Download URL telead-0.1.0.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1f866004a976ca70137e8e811c7022c2035c3a1cd7059c9c76311e2bbf34dabb
BLAKE2b-256 checksum
How to use checksums
995379d1d492e35ffed934596941923f401bb5be2aa54cd2abfa9a8851816e7e
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.0-py3-none-any.whl

Download URL telead-0.1.0-py3-none-any.whl
Size 34.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d07f8d37b0b69a8d192e5b17c3a4d38eb818e4cd2566748b19ec419cd09cc85
BLAKE2b-256 checksum
How to use checksums
21330fef53cad68d758a5be463c1e04377b7466717b9b9bd0bee5640a6e589b4
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

0.1.1

2 release files

This release

0.1.0 This release

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