Home / Documentation

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

https://fragment.bohd4n.dev/api/v1

Content Type

All requests should use the following content type:

Content-Type: application/json

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

  1. First, connect your wallet and authorize through Telegram on fragment.com
  2. Install the Cookie-Editor extension for your browser
  3. Visit Fragment.com while logged in
  4. Click on the Cookie-Editor extension icon in your browser
  5. Export your cookies (preferably in JSON format)
  6. Use these cookies in your API requests
Example cookie format:
stel_token=ff9о...21c1;stel_dt=-120;stel_ssid=56a...a61;stel_ton_token=1uX...8Yei5zgC
Important: Never share your Fragment cookies or seed phrase with unauthorized parties. This API is designed to be self-hosted with your own credentials.

Stars Purchase

Send Telegram Stars to any Telegram user instantly.

Endpoint

POST /BuyStars
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

python
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

json
{
    "success": true,
    "message": "50 STARS SENT TO @bohd4nx",
    "data": {
        "transaction_id": "8f7e32a19c5694bb72d7b7b30139902e55e2ffab30c5b37bc36770e25a1e89a1",
        "username": "@bohd4nx",
        "amount": 50,
        "timestamp": 1694792445
    }
}

Premium Purchase

Gift Telegram Premium subscriptions to any Telegram user.

Endpoint

POST /BuyPremium
Parameter Type Required Description
username string Yes Target Telegram username (with or without @)
duration integer Yes Duration in months (3, 6, or 12)
cookies string Yes Your Fragment cookies for authentication
seed string Yes Your Fragment wallet seed phrase

Example Request

python
import requests

response = requests.post(
    'https://fragment.bohd4n.dev/api/v1/BuyPremium',
    json={
        'username': '@bohd4nx',
        'duration': 3,
        'cookies': 'your_fragment_cookies_here',
        'seed': 'your_wallet_seed_phrase_here'
    }
)
print(response.json())

Response

json
{
    "success": true,
    "message": "3 MONTHS PREMIUM SENT TO @bohd4nx",
    "data": {
        "transaction_id": "6a9d37f1c32e507b7d4b5c6a90a45c7f8e12d6ba31f98c43e56b9ca7d11e47ab",
        "username": "@bohd4nx",
        "duration": 3,
        "expires_at": 1702598400,
        "timestamp": 1694792522
    }
}

Error Handling

The API uses standard HTTP status codes and returns detailed error messages in case of failure.

Error Response Format

json
{
    "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.

© 2025 Fragment API. All rights reserved.

Built with by @bohd4nx

Not affiliated with Telegram or Fragment.