Skip to content
FRAGMENT API

Guide d’intégration

SDK Python et REST direct.

Les données sensibles du portefeuille et de session restent sur votre backend.

Install and choose an integration

Python SDK

Current version: 2.1.6

The current official client is fragment-stars-api 2.1.6. It uses https://api.fragment-api.space by default.

Install with pipbash
pip install fragment-stars-api
View on PyPI

Direct REST / TypeScript

There is no published TypeScript SDK. Use the standard fetch API against the REST service from Node.js or server-side TypeScript.

https://api.fragment-api.space

Code examples

Buy Stars with the Python SDK

The primary Stars flow in version 2.1.6 uses buy_stars and /api/v1/stars/buy.

python
from fragment_api import FragmentAPIClient
client = FragmentAPIClient()
result = client.buy_stars(
username="@telegram_user",
amount=100,
seed="YOUR_BASE64_ENCODED_SEED",
cookies="YOUR_BASE64_ENCODED_COOKIES",
payment_method="ton",
account_index=0,
)
print(result.success)

Read status, prices, and rates

Public client methods and their equivalent direct REST requests.

python
prices = client.get_prices()
rates = client.get_rates()
queue = client.get_queue_status()
eligibility = client.check_premium_eligibility("@telegram_user")
status = client.get_status("REQUEST_ID")
wallet = client.resolve_wallet(
seed="YOUR_BASE64_ENCODED_SEED",
wallet_address="YOUR_TON_WALLET_ADDRESS",
)
print(wallet.account_index)
premium = client.buy_premium(
username="@telegram_user",
duration=3,
seed="YOUR_BASE64_ENCODED_SEED",
)

Python 2.1.6 public methods

  • buy_stars
  • buy_premium
  • get_rates
  • get_prices
  • get_queue_status
  • check_premium_eligibility
  • get_status
  • resolve_wallet

Commencez avec une référence fonctionnelle

Start with the ready-made Telegram Stars and Premium shop, browse the Python source, or open the full REST reference.