Skip to content
FRAGMENT API

مرجع REST

واجهة API عامة موثقة بالكامل.

ابحث في العمليات العامة وافحص مخططات الطلبات والاستجابات.

عنوان أساس الإنتاج

https://api.fragment-api.space

مسار Stars الأساسي

Use POST /api/v1/stars/buy for new Stars integrations. It queues the purchase and returns a request ID for status checks.

توافق قديم

Only /api/v1/stars/create, /api/v1/stars/pay, and /api/v1/orders/{order_id} are marked legacy. They remain visible for existing integrations.

بيانات الاعتماد في الخادم الخلفي فقط

Never send wallet seed or Fragment cookies from browser code. Documentation examples use obvious placeholders only.

YOUR_BASE64_ENCODED_SEED · YOUR_BASE64_ENCODED_COOKIES

Select the exact TON wallet account.

Twelve-word BIP39 seeds use V5R1 accounts derived from m/44'/607'/{account_index}'. Existing seed formats keep their current wallet selection behavior.

  • seed

    Uses account index 0 for a 12-word seed.

  • seed + account_index

    Selects the specified V5R1 account directly.

  • seed + wallet_address

    Finds the matching common account index for the address.

  • seed + wallet_address + account_index

    Verifies that the address and index resolve to the same wallet.

نقاط النهاية العامة

GET
/health

Health check

POST
/api/v1/stars/buy

Купить Telegram Stars (через очередь)

POST
/api/v1/stars/createLegacy

Создать заказ на Stars (шаг 1)

POST
/api/v1/stars/payLegacy

Оплатить заказ (шаг 2)

GET
/api/v1/orders/{order_id}Legacy

Получить статус заказа

GET
/api/v1/queue/status

Получить общий статус очереди

GET
/api/v1/queue/{request_id}

Получить статус запроса в очереди

GET
/api/v1/queue

Получить длину очереди

POST
/api/v1/premium/check-eligibility

Проверить возможность получения Premium подарка

POST
/api/v1/premium/buy

Купить Telegram Premium

GET
/api/v1/wallet/balance

Get wallet balance

POST
/api/v1/wallet/resolve

Resolve or verify a wallet account

GET
/api/v1/commission/balance

Получить баланс комиссии

GET
/api/v1/transactions

Получить историю транзакций

GET
/api/v1/prices

Получить текущие цены

GET
/api/v1/commission/rates

Получить ставки комиссий

رموز الخطأ العامة

Handle the machine-readable error code and HTTP status. Server messages may contain additional context.

Error CodeHTTP StatusMessageDescription
VALIDATION_ERROR422Validation failed

Request parameters failed validation. Stars amount must be at least 50; check details for the exact field.

INVALID_USERNAME_FORMAT400Invalid username format

Username must start with @ and contain only alphanumeric characters and underscores (1-32 characters).

INVALID_SEED401Invalid seed phrase

The provided seed phrase is not valid base64 or cannot be decoded.

INVALID_COOKIES400Invalid cookies

The provided fragment_cookies are not valid base64 or cannot be decoded.

INVALID_FRAGMENT_COOKIES422Invalid Fragment cookies

fragment_cookies must decode from Base64 to a complete JSON object or array. Fix the session export before retrying.

INVALID_FRAGMENT_LOCAL_STORAGE422Invalid Fragment localStorage

fragment_local_storage must decode from Base64 to a JSON object. Fix the session export before retrying.

INVALID_WALLET_ADDRESS422Invalid wallet address

wallet_address must be a valid TON raw or user-friendly address.

WALLET_ADDRESS_MISMATCH422Wallet address mismatch

wallet_address does not belong to the supplied seed and account_index. Correct the selector instead of retrying unchanged input.

ACCOUNT_INDEX_NOT_FOUND422Account index not found

The address was not found in the common BIP39 account range. Pass the exact account_index used by the wallet.

INSUFFICIENT_BALANCE400Insufficient balance

Wallet does not have enough TON to complete the purchase.

USER_NOT_FOUND404User not found

The specified Telegram username does not exist.

ORDER_NOT_FOUND404Order not found

The specified order ID does not exist.

REQUEST_NOT_FOUND404Request not found

The specified request ID does not exist in the queue.

QUEUE_TIMEOUT408Queue timeout

Request timed out while waiting in the queue.

PREMIUM_ALREADY_ACTIVE400Premium already active

User already has an active Telegram Premium subscription.

ORDER_EXPIRED400Order expired

The order has expired and can no longer be paid.

RATE_LIMIT_EXCEEDED429Rate limit exceeded

Too many requests. Please wait before making another request.

API_BUSY429Service is busy

Another request is active. Respect Retry-After before submitting a new request; do not loop automatically.

INTERNAL_ERROR500Internal server error

An unexpected error occurred on the server.

FRAGMENT_ERROR502Fragment service error

Error communicating with fragment.com service.

SERVICE_UNAVAILABLE503Service unavailable

The service is temporarily unavailable. Please try again later.