Repository navigation
Migrations
Historical sections describe the API at the indicated release. Later sections and current API documentation take precedence.
Fragment redirects /ads/topup to /ads. Remove purchase("ton", ...) calls, batch items with type="ton", get_ads_topup_recipient(), and imports of AdsTopupResult. There is no replacement for funding the Telegram account balance. Native TON remains a payment method for supported purchases. recharge_ads() funds an Ads account. Existing top-up history remains readable.
Use purchase("stars", username, amount), purchase("premium", username, months=3), and purchase("ton", username, amount). Batch remains available through purchase([...]). Separate purchase methods and function-style operation adapters are removed.
External payments return ExternalPaymentResult containing ExternalInvoice. The old EVM class names/modules and error aliases have been removed. For USDT TRON select usdt_tron; the SDK returns an unpaid external invoice and does not broadcast TRC-20 transfers. Use canonical ton / usdt_ton method names, not gram aliases. Use get_sessions, not list_sessions.
- Remove
shared_auth_seedandwallet_authconstructor arguments. - Remove reads of
wallet_auth/nokyc_mode; there is no shared mode. - Replace
NoKycBatchResultwithBatchResult. - Supply cookies for every Fragment HTTP operation. Explicit login and cookie refresh use only your wallet seed.
- The built-in public seed, shared-mode allowlist, module and example are deleted.
| Previous API | Version 14.1.0 |
|---|---|
/my/profile |
get_profile() reads the full main-page header |
ProfileInfo.identity_verified, wallet_verified
|
Removed; the current page does not expose these fields |
| Profile username | Empty string because the current header does not expose it |
Dedicated VerificationError
|
Import alias of FragmentAPIError; catch ordinary API errors |
| Stars giveaway search with package fields | Only query is sent; package and winner validation remains local |
| Tonviewer-only wallet parsing | Current gram.org/address/ links and legacy Tonviewer links are supported |
| Version 13 behavior | Version 14 behavior |
|---|---|
| Separate invoice broadcasts in a batch | Prepare all invoices, then submit one wallet message |
| Continue after some item preparation errors | Raise before sending if batch preparation fails |
| Arbitrarily large batches | Reject capacity overflow without automatically splitting |
| Shared auth wallet can be a fallback sender | Require an explicit sender account or payer seed |
| Generic page completion can confirm a purchase | Require completion correlated with the invoice id |
| Payment recovery is application-owned | Durable signed-intent journal and recovery APIs |
| A client-instance lock coordinates sends | OS payer lock across local processes; shared adapters for multiple hosts |
| Historical native service fee | 1.5% of explicit native principal, separate from network fees |
Preserve ~/.fragment-api or configure persistent payment storage, keep the original Fragment session for invoice confirmation, and use BatchResult.transaction for a single external signature. Do not also broadcast the component invoices. See Payment Batches and Recovery.
| Previous behavior or assumption | Version 13 |
|---|---|
| MarketApp fallback | Removed; restricted wallet-proof authentication replaces it |
marketapp_token |
Removed from the constructor |
MarketAppAPIError |
Removed |
| “No KYC” as a guarantee | Not provided |
| Batch means one transaction | Version 13 processed invoices separately; version 14 restores one combined wallet submission |
| Sent means delivered | Check fulfillment fields |
| Confirmation from seqno or balance changes | Not used as proof of this invoice |
Highload version HIGHLOAD_V3
|
Use HighloadV3R1
|
| Sender can always be changed after preparation | Preserve the requested sender identity |
| All USDT lookup failures mean zero balance | An unavailable balance can be None
|
| Float and boolean quantities are accepted | Integer inputs are strict |
| Shared session can manage an account | Account operations are blocked |
Supported compatibility names include ConfigError, purchase("ton", ...), purchase("ton", ...), gram payment aliases, ton_price, ton_rate.
Shared authentication is removed entirely. Missing cookies fail locally, explicit login uses the caller's wallet, and all batches return BatchResult.
- Remove KYC-specific error classification and obsolete verification fields.
- Read account details from the full page header after removal of
/my/profile. - Update Stars giveaway recipient search to the current frontend payload.
- Restore owner and history wallet parsing for Gram explorer links.
- Validate five native invoice preparation flows without signing or paying.
Live checks on November 2, 2026 returned request IDs and unsigned transactions for Stars, Premium, both giveaway types, and Ads top-ups without a KYC challenge in the tested session. The account's earlier verification status is unknown. Withdrawals and asset mutations were not exercised. These observations do not establish site-wide policy.
- Batches validate and prepare all invoices before a single wallet submission; capacity/preparation failures send nothing.
- Native fees use
FEE_BASIS_POINTS / 100percent (150means 1.5%), independently of network fees. - A signed BOC and invoice contexts are journaled before automatic broadcast.
-
get_payment,list_payments,reconcile_payment, and evidence-basedresolve_paymentsupport recovery without automatic repayment. - TON preparation requires a real payer seed or complete
sender_account; the shared auth wallet is never a payer. - Fulfillment requires a completion response matching the invoice id; uncorrelated page state stays unconfirmed.
See Payment Batches and Recovery for the execution contract and deployment requirements.
- Do not print mnemonics, cookies, OAuth tokens, login codes, or signed BOCs.
- Session storage is not an encrypted secret vault.
- Reconcile uncertain broadcasts instead of creating replacement payments.
- OS wallet locks coordinate local clients/processes sharing the same home and journal. Multiple hosts need shared storage and a distributed lock factory.
- Server behavior and HTML can change without an SDK release.
This is an unofficial project, not an official Fragment or Telegram API.
Repository · Examples · Issues
-
link_wallet()links an already connected TON wallet using the current user session. -
disconnect_wallet()disconnects TON and removesstel_ton_tokenfrom both local cookies and the live jar. -
logout()ends the Fragment session, clears local cookies and deletes the persisted session. -
mnemonic_type="ton" | "multichain"selects validation and derivation consistently for authentication, wallet inspection, preparation and signing. Defaults: multichain/BIP-39 forWalletTg, TON for other contracts. Rotated Telegram Wallet phrases are validated as two BIP-39 halves. - Ordinary wallets support 12/15/18/21/24 words where valid for the chosen scheme;
WalletTgaccepts 12 or 24. Invalid words/checksums fail locally. Requires tonutils 2.5.1+ and ton-core 0.7.1+.
client = FragmentClient(cookies=cookies, seed=seed, wallet_version="WalletTg")
# For BIP-39 with another supported contract, set mnemonic_type="multichain".
await client.link_wallet() # requires an existing stel_ton_tokenFragment restored /my/profile. get_profile() now reads the Telegram username, account details, identity_verified and wallet_verified from that page. Account and wallet badges are parsed separately.
Monetization withdrawals can require KYC. init_stars_withdrawal, confirm_stars_withdrawal, init_ads_withdrawal and confirm_ads_withdrawal raise KycRequiredError when Fragment requests verification. Complete verification on Fragment and retry explicitly. The SDK never completes KYC automatically.
Purchase and giveaway operations remain available without KYC. No blanket profile check is added to payments. The unified purchase API and external TRON invoices from 14.2.0 are retained.
USDT on TRON uses payment_method="usdt_tron" and returns ExternalPaymentResult with an ExternalInvoice. TRON payments are external: the SDK does not sign or broadcast TRC-20 transfers.
Use purchase("stars", username, amount), purchase("premium", username, months=3), or purchase("ton", username, amount). Batch purchases use purchase([...]) and retain one combined TON submission. The separate purchase_stars, purchase_premium, topup_gram, topup_ton, and batch_purchase methods are removed.
Function-style FragmentAPI.methods adapters, list_sessions, ConfigError, VerificationError, and old EvmInvoice / EvmPaymentResult names are removed. Use FragmentClient, get_sessions, ConfigurationError, FragmentAPIError, and the External* classes. Payment method aliases gram and usdt_gram are removed; use ton and usdt_ton.
Shared authentication has been removed. Fragment requests now use your own cookie session, with explicit authentication using your own wallet when needed.
| Area | What changed |
|---|---|
| Authentication | The built-in public auth seed, automatic shared-wallet proof, and shared-mode options are removed |
| Sessions | Fragment HTTP operations require user-owned cookies; missing cookies fail before any request |
| Batches | All batches return BatchResult; the shared-mode result type is removed |
| Profile |
get_profile() reads the restored /my/profile route and verification badges |
| Account fields | Name, username, photo, wallet address/label, identity and wallet verification |
| API errors | Revenue withdrawals raise KycRequiredError on a server verification request; other errors use FragmentAPIError
|
| Giveaways | Stars recipient search sends only query, matching the current Fragment interface |
| Marketplace | Wallet owners and history support the current gram.org/address/ explorer links |
Remove shared_auth_seed and wallet_auth constructor arguments and stop using nokyc_mode or NoKycBatchResult. Supply cookies directly, load them from session storage, or call FragmentClient.authenticate() with your own wallet before constructing the client. No built-in wallet is used for authentication or payment.
ProfileInfo.identity_verified and wallet_verified are restored in 14.3.0 with the profile page.
Live checks on November 2, 2026 returned request IDs and unsigned native-TON transactions for Stars, Premium, both giveaway types, and Ads top-ups without a verification challenge in the tested session. No payments were submitted. Withdrawals and asset mutations require valid operation links or assets and were not exercised by that check.
Important
Version 14 includes breaking changes. Batches combine all invoices into one wallet submission and reject preparation/capacity failures before sending. TON preparation requires a real payer identity. Fulfillment remains per invoice. Read the migration notes before upgrading.
Fragment API Python · v14.5.0
Documentation · Migrations · Examples · Issues
Maintained by S1qwy · MIT License · Support with TON
Unofficial SDK · Operations require the appropriate Fragment account and wallet permissions.
Fragment API Python