Skip to main content

Async Python library for Fragment.com API with seqno/balance confirmation and confirmReq

Project description

Fragment API Python

Fragment API Python SDK

Professional Python library for Fragment.com automation
v8.0.0 — No KYC Mode | Batch Operations | EVM Payments | Live Stats Dashboard

PyPI Python Versions Downloads Telegram License

GitHub Docs Dashboard


Feature Description
No KYC Mode Operate without Fragment cookies or account. Execute purchases and giveaways directly via a hosted REST API (fragment-api.tech).
Batch Operations Execute multiple sequential transactions easily with batch_purchase_stars, batch_purchase_premium, and batch_topup_ton.
EVM Payments Native support for 5 EVM methods: usdt_eth, usdt_pol, usdc_eth, usdc_base, usdc_pol.
Anonymous Telemetry Helps improve the library. No sensitive data is ever sent. View stats at fragment.s1qwy.ru/statistic.

  • Async-onlyFragmentClient with full async/await support.
  • Two Operating Modes — Full mode (with cookies) and No-Cookie Mode (No KYC required).
  • Purchases — Stars (50–10M), Premium (3/6/12 months), TON Ads.
  • Giveaways — Stars and Premium for channels (up to 24k winners).
  • Bidsplace_bid(item_type=1|3|5, slug, bid) — instant buy if bid = buy-now price.
  • Marketplace — Search usernames, numbers, gifts with filters and pagination.
  • Wallet — V4R2 and V5R1 (W5) support.
  • Auto-authentication — Obtain cookies via TON wallet and Telegram.
  • Anonymous numbers — Manage login codes, terminate sessions (+888).
  • NFT Management — Withdraw gifts to wallet, transfer to users.

pip install fragment-api-py
  • Python 3.10+
  • TON wallet seed phrase (12/18/24 words)
  • Fragment cookies (optional, only for full functionality)

The library now supports two operating modes depending on your privacy needs and workflow:

1. No KYC / No-Cookie Mode

Perfect for automated systems that do not want to manage Fragment cookies or pass KYC verifications. By initializing the client without cookies, operations utilize the hosted fragment-api.tech REST API to securely obtain unsigned transaction payloads, sign them locally with your seed, and broadcast them to the network. Note: EVM payment methods are not supported in No-Cookie mode (TON and USDT on TON only).

Supported No-Cookie Methods:

  • purchase_stars
  • purchase_premium
  • topup_ton
  • giveaway_stars
  • giveaway_premium
  • All batch_* variants of the above

2. Full Mode

Pass your Fragment session cookies (stel_ssid, stel_dt, stel_token, stel_ton_token) to access the entirety of Fragment's API, including marketplace operations, EVM payments, NFT management, and My Assets.


No KYC Mode Example

import asyncio
from FragmentAPI import FragmentClient

async def main():
    # Initialize WITHOUT cookies
    async with FragmentClient(
        seed="24 words...",
        wallet_version="V5R1"
    ) as client:
        
        # Wallet info
        wallet = await client.get_wallet()
        print(f"Balance: {wallet.balance_ton} TON, {wallet.balance_usdt} USDT")
        
        # Purchase stars without a Fragment account!
        result = await client.purchase_stars("@durov", 100)
        print(f"TX: {result.transaction_id}")
        
        # Execute batch operations
        batch = await client.batch_purchase_premium([
            {"username": "@durov", "months": 3},
            {"username": "@telegram", "months": 6}
        ])
        print(f"Succeeded: {batch.succeeded}/{batch.total}")

asyncio.run(main())

Full Mode Example

import asyncio
from FragmentAPI import FragmentClient
from FragmentAPI.types.results import EvmPaymentResult

async def main():
    # Initialize WITH cookies for full functionality
    async with FragmentClient(
        seed="24 words...",
        cookies={"stel_ssid": "...", "stel_token": "...", "stel_dt": "...", "stel_ton_token": "..."},
        wallet_version="V5R1",
    ) as client:
        
        # EVM payment (returns invoice)
        result = await client.purchase_stars("@durov", 50, payment_method="usdc_base")
        if isinstance(result, EvmPaymentResult):
            inv = result.invoice
            print(f"Send {inv.invoice_amount} {inv.token_symbol} to {inv.invoice_address}")
            print(f"Chain: {inv.invoice_chain_name}")
        
        # Place bid (type 1=username, 3=number, 5=gift)
        await client.place_bid(1, "username", bid=150)
        
        # Search marketplace
        items = await client.search_usernames("gold", filter="sale")

asyncio.run(main())

import asyncio
from FragmentAPI import FragmentClient

async def main():
    # Automatic authentication via TON wallet and Telegram
    cookies = await FragmentClient.authenticate(
        seed="24 words...",
        wallet_version="V5R1",
        phone="+71234567890"  # Optional: omit for QR code flow
    )
    
    async with FragmentClient(seed="24 words...", cookies=cookies) as client:
        profile = await client.get_profile()
        print(f"Logged in as: {profile.name}")

asyncio.run(main())

The library sends anonymous usage statistics to help understand which features are used and what errors users encounter.

Collected:

  • Library version, wallet version (V4R2/V5R1)
  • Method name, status (ok/error), duration
  • Error class name, scrubbed error message (first 200 chars)

NEVER Collected:

  • Seed phrases, cookies, API keys
  • Usernames (replaced with <username>)
  • Wallet addresses (replaced with <ton_addr> or <eth_addr>)
  • Transaction hashes, amounts
  • IP addresses

Disable telemetry:

FragmentClient(seed="...", cookies=..., stats_enabled=False)

Or set environment variable: export FRAGMENT_DISABLE_STATS=1

Live Dashboard: fragment.s1qwy.ru/statistic


Method Chain Token Flow
ton TON TON Automatic TX
usdt_ton TON USDT Automatic TX
usdt_eth Ethereum USDT Returns invoice
usdt_pol Polygon USDT Returns invoice
usdc_eth Ethereum USDC Returns invoice
usdc_base BASE USDC Returns invoice
usdc_pol Polygon USDC Returns invoice

Reporting Errors
Create an Issue or message in the Telegram chat.

Support the Project
If you find this library useful, consider supporting its development:

Donate TON

UQBsyxZvyQxDwAeOxoaWwO2HJoAmCKUoJlS_OpLzWHD9i2Xj

License
MIT License — free for commercial and personal use.


GitHubDocumentationTelegramLive Stats

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fragment_api_py-8.0.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fragment_api_py-8.0.0-py3-none-any.whl (62.8 kB view details)

Uploaded Python 3

File details

Details for the file fragment_api_py-8.0.0.tar.gz.

File metadata

  • Download URL: fragment_api_py-8.0.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for fragment_api_py-8.0.0.tar.gz
Algorithm Hash digest
SHA256 e9945b9ef51a1f0821c3de3082c887595cfb473adff13efeff83eb570c28a1ae
MD5 1dd7d6e25b453d1ed9e690ad5d8e07c9
BLAKE2b-256 fd08228e6d71afe20f175a7329b365d6fe4d72e0186697d0acfab5c59cf774d0

See more details on using hashes here.

File details

Details for the file fragment_api_py-8.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fragment_api_py-8.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 424a8e72cde433c9737291c36c28d2544018d5e59955adb688f7e7cbccf3a0b4
MD5 5501f1fe990c86d9fff111dffdf5e89b
BLAKE2b-256 c0ecc4be031bac0c5f41cc2e07288d7f4a0790241f6d6120eda0eb184085205a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page