Skip to main content

Telegram Stars & Premium API for Fragment

KYC 0% · NO-KYC 0.25%

Buy Telegram Stars and gift Premium from a Telegram bot, shop, or reseller backend. Use the Python SDK or direct REST with TON and USDT on TON. No API key needed.

Current SDK: v2.1.7 · Endpoint: https://api.fragment-api.space

PyPI version 2.1.7 Python versions MIT License

Python quick start · Direct REST · Build a shop · Русский

Try It Without a Wallet

Read current prices and API fees. These requests need no seed, cookies, or token and do not create a purchase:

curl https://api.fragment-api.space/api/v1/prices
curl https://api.fragment-api.space/api/v1/commission/rates

KYC has 0% API commission permanently; no-KYC has 0.25% API commission. Stars/Premium cost and blockchain fees are separate. Compare modes and payment methods.

Telegram Stars API: KYC 0%, no-KYC 0.25%, Python and REST, TON and USDT payments

Trust boundary: This is an independent service, not an official Telegram or Fragment API. This repository contains the client SDK, documentation, and examples, not the hosted backend. Purchase requests send your wallet seed to the API service for signing; KYC also sends Fragment session data. Base64 is encoding, not encryption. Use a dedicated operating wallet, keep its balance limited, and never put secrets in frontend code or public logs. See SECURITY.md.

Quick Start

Install on your backend:

pip install fragment-stars-api

Start with a read-only Python request:

from fragment_api import FragmentAPIClient

with FragmentAPIClient() as client:
    print(client.get_prices())
    print(client.get_rates())

The next example makes a real purchase. Set FRAGMENT_WALLET_SEED to your supported seed encoded as Base64 using your backend's secret configuration. Use a real recipient username in place of @telegram_user.

import os
from fragment_api import FragmentAPIClient

with FragmentAPIClient() as client:
    accepted = client.buy_stars(
        username="@telegram_user",
        amount=100,
        seed=os.environ["FRAGMENT_WALLET_SEED"],
        payment_method="ton",
        wait=False,
    )
    print(accepted.request_id)  # Persist against your shop order before polling.

This is no-KYC because cookies are omitted. For KYC, add cookies=os.environ["FRAGMENT_COOKIES"]. For Stars paid in USDT on TON, pass payment_method="usdt_ton"; keep TON for gas and any due API commission.

Poll client.get_status(request_id) until a final state. queued and processing are not delivery confirmation. With wait=True (the default), the SDK polls for you. On a timeout or uncertain payment, reconcile the existing request instead of sending another purchase. Python integration and recovery.

Choose Your Integration

Build Start here
Python / aiogram / FastAPI bot Python SDK guide
Node.js / TypeScript backend Node.js REST guide
PHP, Go, or another language HTTP reference and examples
Telegram Stars shop Minimal backend, shop checklist, full example shop
Telegram Premium gifting Premium API guide
Codex, Claude, or Cursor integration Codex skill / Claude skill

The shop examples are starting points, not a substitute for your checkout authentication, payment verification, or order deduplication.

Runnable Examples

KYC/no-KYC and TON/USDT · Node.js · PHP · Go · Minimal shop

KYC vs No-KYC

Mode Fragment cookies API commission Payment options
KYC Your own session 0% forever TON or USDT on TON where supported
No-KYC Not required 0.25% Stars: TON or USDT on TON; Premium: TON

Omitting payment_method keeps TON for existing clients. No-KYC Stars paid in USDT use USDT for the base price and TON for API commission. Commission accumulates per wallet and is collected when debt reaches 1 TON, not through an extra transfer on every order. The threshold is not an extra fee. Full comparison and collection rules.

Wallet Selection

Supported seed formats include a 24-word TON mnemonic, a supported 32-byte key, and a 12-word BIP39 mnemonic for V5R1. Send the complete supported seed as Base64 from your backend.

  • seed only: a 12-word seed defaults to account_index=0; legacy formats keep their wallet selection behavior.
  • seed + account_index: select a V5R1 account for a 12-word seed.
  • seed + wallet_address: resolve or verify the wallet; use the resolver examples when you do not know its index.
  • seed + wallet_address + account_index: verify the pairing before purchase.

Use POST /api/v1/wallet/resolve, never seed-bearing URL parameters. An address-resolution result is not proof that the wallet has enough funds to buy.

API Reference

Base URL: https://api.fragment-api.space — standard HTTPS, port 443.

Method Route Purpose
GET /health Availability
GET /api/v1/prices Current Stars/Premium prices
GET /api/v1/commission/rates API commission rates
POST /api/v1/stars/buy Queue a Stars purchase
GET /api/v1/queue/{request_id} Read a Stars request's status
POST /api/v1/premium/buy Buy 3, 6, or 12 months of Premium
POST /api/v1/premium/check-eligibility Check Premium recipient eligibility
POST /api/v1/wallet/resolve Resolve or verify a TON wallet account

No issued token, JWT, OAuth, Authorization, or X-API-Key is required for client routes. Full HTTP examples · Website reference.

Legacy endpoints https://api-fragment.duckdns.org and https://fragment-api.ydns.eu:8443 remain compatible. Existing integrations do not need to migrate immediately.

Common Client Mistakes

Problem Action
Fewer than 50 Stars Validate an integer amount of at least 50 before checkout.
Username without @, or a channel/bot instead of a user Pass the intended user's @telegram_user username.
KYC need_verify Complete the required verification on Fragment with the same account, then update session data if needed.
Missing wallet cookie Connect the matching wallet first; follow the cookies guide.
Timeout or uncertain transaction Keep request_id, inspect the status and wallet history; do not auto-repeat the purchase.
Rate limit Respect Retry-After; the no-KYC invoice limit is 300 per wallet per hour, separate from other request limits.

All error codes and recovery steps.

Help and Releases

Integration help · Contact @makecodev · Show your shop

SDK releases · SDK changelog · Public service updates · AI-readable docs

LIKE IT? STAR IT! A star helps other developers find the project. Integration feedback and real shop examples are welcome.

Contributing and License

Maintained by bbbuilt. See CONTRIBUTING.md and SECURITY.md. Never share seeds, cookies, private keys, or customer data in issues.

The client code and examples use the MIT License. This does not license the hosted backend or represent affiliation with Telegram or Fragment.

Metadata

Release files for fragment-stars-api 2.1.7

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

Source distribution (sdist)

Source distribution for fragment-stars-api 2.1.7
File Size Uploaded
fragment_stars_api-2.1.7.tar.gz 843.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fragment-stars-api 2.1.7
File Interpreter ABI Platform
fragment_stars_api-2.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 857.8 kB

Release files / fragment_stars_api-2.1.7.tar.gz

Download URL fragment_stars_api-2.1.7.tar.gz
Size 843.8 kB
Tags Source
SHA-256 checksum
How to use checksums
065844ddf99bbc3014b8ab1880f449eb3890b80b908252c0fd92b72ef61dcd63
BLAKE2b-256 checksum
How to use checksums
5071845e03b4c701138bf37961caec93fdf71ada66808e0f2d7ece28c5079bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / fragment_stars_api-2.1.7-py3-none-any.whl

Download URL fragment_stars_api-2.1.7-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3172c5b686407d9fc340153542ac7838d0c899e0751804006dcc7628ec2958ab
BLAKE2b-256 checksum
How to use checksums
63eb374111c68ab20ce68b7aa4a3a000dbb716686d68a0c540cdb6f4ca811c6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

2.1.7 This release

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.0

2 release files

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