- 💰 TON Advertisement Topups - Send TON for advertising campaigns and purchasing gifts (1-1,000,000,000 TON)
- 👑 Telegram Premium Gifts - Purchase Premium subscriptions (3, 6, or 12 months)
- ⭐ Telegram Stars Purchases - Buy Stars for users (50-1,000,000 Stars)
git clone https://github.com/bohd4nx/FragmentAPI.git
cd FragmentAPI
pip install -r requirements.txtCopy example configuration and edit:
cp .env.example .envEdit .env file:
COOKIES=your_fragment_cookies_here
SEED=word1 word2 word3 ... word24
HASH=your_fragment_hash_here
API_KEY=your_ton_api_key_herePrerequisites: Login to your Telegram account and connect the TON wallet you want to use for payments.
-
Install Cookie Editor Extension:
- Download from Chrome Web Store
- Add extension to your browser
-
Extract Cookies:
- Open Fragment.com and ensure you're logged in
- Refresh the page completely
- Click on the Cookie Editor extension icon
- Click "Export" button
- Select "Header String" format
- Copy the result → paste to
COOKIESin your.envfile - Important: Wrap the value in quotes to prevent semicolons from being treated as comments
Expected format:
COOKIES = "stel_token=<TOKEN>;stel_dt=<STEL_DT>;stel_ssid=<SSID>;stel_ton_token=<TON_TOKEN>"If you don't have a TON wallet yet:
-
Download Tonkeeper:
- iOS: App Store
- Android: Google Play
-
Create New Wallet:
- Open Tonkeeper app
- Tap "Create New Wallet"
- IMPORTANT: Write down your 24-word seed phrase on paper
- Store it securely - never share with anyone!
- Complete wallet setup
-
Get Your Seed Phrase:
- If you already have a wallet, go to Settings → Backup
- Enter your passcode
- Copy the 24 words → paste to
SEEDin your.envfile
Format: word1 word2 word3 ... word24
Prerequisites: Complete the cookies setup above first.
-
Connect Wallet to Fragment:
- Go to Fragment.com
- Ensure your TON wallet is connected
- Log in with your Telegram account
-
Extract Hash:
- Open Developer Tools (F12)
- Click on "Network" tab
- Navigate to Fragment Stars Purchase
- Select recipient as "Buy for myself"
- Refresh the page (Ctrl+R / Cmd+R)
- Look for network requests containing
?hash= - Find the hash value and copy it → paste to
HASHin your.envfile
Expected format: ?hash=<your_hash_here>
- Get API Key:
- Visit TON Console
- Create account and login
- Generate new API key
- Copy the key → paste to
API_KEYin your.envfile
Alternative: You can also use TON API for getting API key.
python main.pyfrom app.methods import FragmentTon, FragmentPremium, FragmentStars
# TON topup for ads
ton_client = FragmentTon()
result = await ton_client.topup_ton("@username", 5)
# Premium purchase
premium_client = FragmentPremium()
result = await premium_client.buy_premium("@username", 6)
# Stars purchase
stars_client = FragmentStars()
result = await stars_client.buy_stars("@username", 50)| Operation | Method | Parameters | Limits |
|---|---|---|---|
| TON Topup | topup_ton(username, amount) |
Username, TON amount | 1-1,000,000,000 TON |
| Premium Gift | buy_premium(username, months) |
Username, duration | 3, 6, or 12 months |
| Stars Purchase | buy_stars(username, amount) |
Username, Stars amount | 50-1,000,000 Stars |
All methods accept various username formats:
@username(with @)username(without @)
Made with ❤️ by @bohd4nx
Star ⭐ this repo if you found it useful!