API Documentation
Welcome to the Fragment API documentation. Here you'll find comprehensive guides and references to help you integrate our API for purchasing Telegram Stars and Premium subscriptions.
Getting Started
The Fragment API allows you to programmatically purchase Telegram Stars and Premium subscriptions for Telegram users. The API is designed to be simple and straightforward to use.
Base URL
Content Type
All requests should use the following content type:
Authentication
The API uses Fragment cookies and seed phrase for authentication. These credentials are used to make purchases on Fragment on your behalf.
Required Credentials
- Fragment Cookies: These are the cookies from your Fragment session
- Seed Phrase: The seed phrase used for the Fragment wallet from which the payment will be made
How to Extract Your Fragment Cookies
- First, connect your wallet and authorize through Telegram on fragment.com
- Install the Cookie-Editor extension for your browser
- Visit Fragment.com while logged in
- Click on the Cookie-Editor extension icon in your browser
- Export your cookies (preferably in JSON format)
- Use these cookies in your API requests
stel_token=ff9о...21c1;stel_dt=-120;stel_ssid=56a...a61;stel_ton_token=1uX...8Yei5zgC
Stars Purchase
Send Telegram Stars to any Telegram user instantly.
Endpoint
Parameter | Type | Required | Description |
---|---|---|---|
username | string | Yes | Target Telegram username (with or without @) |
amount | integer | Yes | Number of stars to send (minimum 50) |
cookies | string | Yes | Your Fragment cookies for authentication |
seed | string | Yes | Your Fragment wallet seed phrase |
Example Request
import requests
response = requests.post(
'https://fragment.bohd4n.dev/api/v1/BuyStars',
json={
'username': '@bohd4nx',
'amount': 50,
'cookies': 'your_fragment_cookies_here',
'seed': 'your_wallet_seed_phrase_here'
}
)
print(response.json())
Response
{
"success": true,
"message": "50 STARS SENT TO @bohd4nx",
"data": {
"transaction_id": "8f7e32a19c5694bb72d7b7b30139902e55e2ffab30c5b37bc36770e25a1e89a1",
"username": "@bohd4nx",
"amount": 50,
"timestamp": 1694792445
}
}
Error Handling
The API uses standard HTTP status codes and returns detailed error messages in case of failure.
Error Response Format
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {}
}
}
HTTP Status | Error Code | Description |
---|---|---|
400 | INVALID_PARAMS | Missing or invalid parameters |
401 | AUTH_FAILED | Authentication failed (invalid cookies or seed) |
404 | USER_NOT_FOUND | Target username not found |
402 | INSUFFICIENT_FUNDS | Not enough funds in your Fragment wallet |
500 | SERVER_ERROR | Internal server error |
Need Help?
If you need assistance or have any questions about the API, feel free to reach out to us.