F
v0.0.4 · 105 endpoints · API عام للجميع
Fragment.com API — للجميع
Full automation API for Fragment.com — Telegram marketplace on TON blockchain. Multi-tenant: anyone can use it with their own key. TON wallet auto-pay, scheduled sniper, bulk purchases, structured marketplace data and persistent sessions. واجهة برمجة كاملة لمنصة Fragment للأصول على TON — أي شخص يستخدمها مباشرة: اربط محفظتك بمفتاحك الخاص (تشفير بمفتاحك) أو بعنوانها فقط، واحفظ كوكيزك مرة واحدة ثم شغّل كل شيء.
105Endpoint
22قسم
v0.0.4الإصدار
0إعدادات مطلوبة من المشغّل
🚀 كيف تبدأ في أقل من دقيقة
1مفتاحك الخاص
أي X-API-Key: anything تختاره يصبح هويتك — به تتشفّر وتُعزل محفظتك وجلساتك ومهامك. يُرسَل في الـ header وليس في الرابط أبداً.
2سجّل محفظة TON
إمّا بالعنوان فقط (read-only، بلا مفتاح): POST /api/wallet/setup {"address":"UQ..."}، أو بالكلمات الـ24 لمفتاحك ليشتغل الدفع التلقائي: {"seed":"word1 ... word24"}.
3سجّل الدخول عبر Telegram (مرة واحدة)افتح
صفحة تسجيل الدخول — يتولّد مفتاح عشوائي تلقائياً، أدخل رقمك وأكّده في تليجرام فتُحفظ الجلسة تحت مفتاحك. أو عبر API:
POST /api/auth/telegram/start {"phone":"9665XXXXXXXX"} ثم اقرأ
POST /api/auth/telegram/status. ولصق يدوي متاح أيضاً:
POST /api/session/save {"cookie":"stel_dt=..; stel_ssid=..; stel_token=.."}.
4استخدم أي endpoint بالأسفل
اشترِ Stars وأهدِ Premium، راجع السوق (JSON)، سلّح Sniping، وتتبّع مدفوعاتك عبر /api/tx/status.
⚡ إعداد المحفظة (مرة واحدة) — الدفع التلقائي
# 1. أضف محفظة TON (24 كلمة)
curl -X POST "https://fragment-api.contact-3mh.workers.dev/api/wallet/setup" -H "X-API-Key: " -H "Content-Type: application/json" -d '{"seed":"word1 word2 ... word24"}'
# أو سجّل محفظة خارجية بالعنوان فقط (بدون مفتاح):
curl -X POST "https://fragment-api.contact-3mh.workers.dev/api/wallet/setup" -H "Content-Type: application/json" -d '{"address":"UQ..."}'
# 2. اشترِ Stars وسيُدفع تلقائياً من محفظتك
curl -X POST "https://fragment-api.contact-3mh.workers.dev/api/stars/buy" -H "X-API-Key: " -H "Cookie: stel_dt=-240; stel_ssid=xxx; stel_token=xxx; stel_ton_token=xxx" -H "Content-Type: application/json" -d '{"recipient":"durov","quantity":"100","auto_pay":"1"}'
# 3. افحص محفظتك (بمفتاحك أو بعنوانك)
curl "https://fragment-api.contact-3mh.workers.dev/api/wallet" -H "X-API-Key: <your-key>"
# أو بالعنوان العام (بدون مفتاح):
curl "https://fragment-api.contact-3mh.workers.dev/api/wallet?address=UQ..."
👥 متعدد المستخدمين: API عام — كل مستخدم يرسل مفتاحه الخاص (X-API-Key: anything) فيصير هوية محفظته وجلساته وسنابراته (مشفّرة AES-256-GCM بمفتاحه). يمكن أيضاً تسجيل محفظة خارجية بالعنوان فقط read-only بدون مفتاح. العمليات الأخرى (شراء/بحث/مزادات) تحتاج كوكيز الجلسة كـ Cookie header.
── Utility / Docs ──
| Method | Endpoint | Description |
|---|
| GET | / | Interactive HTML documentation (this page) |
| GET | /docs.txt | Plain-text documentation |
| GET | /health | Health check |
| GET | /api/login | Telegram login page (auto-generated key, one-click login) |
| GET | /api/key | Generate a fresh random API key {ok, key} |
| GET | /api/hash | Get fresh API hash |
| GET | /api/session | Check saved/current session validity |
| POST | /api/session/save | Save cookies ONCE (validated, AES-256-GCM) |
| DELETE | /api/session | Clear saved session |
| GET | /api/session/helper | Browser snippet to copy your cookies |
| POST | /api/raw | Call any Fragment API method directly |
| GET | /api/page | Scrape raw marketplace page HTML |
| GET | /api/marketplace | Structured JSON listings {type, sort, filter, q, limit} |
── Telegram Login (auto session) ──
| Method | Endpoint | Description |
|---|
| POST | /api/auth/telegram/start | Start login {phone, stel_dt?} — Telegram pushes a confirm request → {session_id} — your key |
| POST | /api/auth/telegram/status | Poll {session_id} → {status:'waiting'} until confirmed → logs into Fragment and SAVES the session — your key |
| POST | /api/auth/telegram/finish | Finish with an existing Telegram result {id_token} or {auth} → saves the session — your key |
── Sniper (auto-bid) ──
| Method | Endpoint | Description |
|---|
| POST | /api/sniper/create | Arm an auto-bid {item, type, max_bid, trigger_seconds?, auto_pay?, webhook?} — your key |
| GET | /api/sniper/list | List YOUR sniper tasks — your key |
| POST | /api/sniper/remove | Remove task {id} — your key |
| POST | /api/sniper/run | Run the sniper now (cron runs it every minute) — your key |
── Wallet / Auto-pay ──
| Method | Endpoint | Description |
|---|
| POST | /api/wallet/setup | Store 24-word seed {seed} OR register an external {address} (read-only) — protected by YOUR key |
| GET | /api/wallet | Public info: address, balance, seqno — your key (X-API-Key) or ?address= |
| DELETE | /api/wallet | Remove YOUR wallet — your key |
| POST | /api/wallet/pay | Sign & send payment {to, amount_ton|amount_nano, payload?} — your key |
| POST | /api/wallet/pay/tx | Sign & send TonConnect messages {messages[]} or {transaction} — your key |
| GET | /api/wallet/activity | Last 20 wallet transactions |
| POST | /api/tx/status | Check a payment {hash} — your key |
── Bulk actions ──
| Method | Endpoint | Description |
|---|
| POST | /api/stars/bulk | Buy Stars for many recipients {recipients[], quantity, auto_pay?} |
── Search ──
| Method | Endpoint | Description |
|---|
| GET | /api/search | Browse marketplace (?type=usernames&sort=price_desc&filter=auction&q=) |
| POST | /api/search/auctions | Search auctions {query, type, offset_id} |
── Auction ──
| Method | Endpoint | Description |
|---|
| POST | /api/auction/state | Get auction state {type, username} |
| POST | /api/auction/bid | Place bid {type, username, bid} |
| POST | /api/auction/offer/init | Init direct offer {type, username} |
| POST | /api/auction/offer/confirm | Confirm offer {id, amount} |
| POST | /api/auction/sell | Start auction {type, username, min_amount, max_amount?} |
| POST | /api/auction/cancel | Cancel auction {type, username} |
| POST | /api/auction/subscribe | Subscribe to updates {type, username} |
| POST | /api/auction/unsubscribe | Unsubscribe {type, username} |
| POST | /api/auction/can-sell | Check sell eligibility {type, username, auction} |
── Stars ──
| Method | Endpoint | Description |
|---|
| POST | /api/stars/state | Init Stars page {mode?, lv?, dh?} |
| POST | /api/stars/prices | Get Stars prices {stars, quantity} |
| POST | /api/stars/search | Search recipient {query, quantity} |
| POST | /api/stars/buy | Buy Stars for user {recipient, quantity, show_sender?, auto_pay?} |
| POST | /api/stars/buy-self | Buy Stars for yourself {quantity, auto_pay?} |
| POST | /api/stars/repeat | Repeat last Stars purchase |
── Stars Giveaway ──
| Method | Endpoint | Description |
|---|
| POST | /api/stars-giveaway/state | Init page |
| POST | /api/stars-giveaway/prices | Get prices {stars, quantity} |
| POST | /api/stars-giveaway/search | Search recipient {query} |
| POST | /api/stars-giveaway/create | Create giveaway {recipient, quantity, stars, days, auto_pay?} |
| POST | /api/stars-giveaway/repeat | Repeat last |
── Premium ──
| Method | Endpoint | Description |
|---|
| POST | /api/premium/state | Init Premium page |
| POST | /api/premium/search | Search recipient {query, months} |
| POST | /api/premium/gift | Gift Premium {recipient, months: 3|6|12, auto_pay?} |
| POST | /api/premium/repeat | Repeat last |
── Premium Giveaway ──
| Method | Endpoint | Description |
|---|
| POST | /api/premium-giveaway/state | Init page |
| POST | /api/premium-giveaway/prices | Get prices {quantity} |
| POST | /api/premium-giveaway/search | Search channel {query} |
| POST | /api/premium-giveaway/create | Create giveaway {recipient, quantity, months, auto_pay?} |
| POST | /api/premium-giveaway/repeat | Repeat last |
── Ads ──
| Method | Endpoint | Description |
|---|
| POST | /api/ads/topup/state | Init topup page |
| POST | /api/ads/topup/search | Search account {query} |
| POST | /api/ads/topup | Topup someone {recipient, amount, auto_pay?} |
| POST | /api/ads/recharge | Recharge own {recipient, amount, auto_pay?} |
| POST | /api/ads/repeat-topup | Repeat topup |
| POST | /api/ads/repeat-recharge | Repeat recharge |
| POST | /api/ads/revenue/state | Init withdrawal page |
| POST | /api/ads/revenue/withdraw | Withdraw revenue {amount, address} |
── Gateway ──
| Method | Endpoint | Description |
|---|
| POST | /api/gateway/state | Init page |
| POST | /api/gateway/prices | Get prices {quantity} |
| POST | /api/gateway/recharge | Recharge {quantity, auto_pay?} |
| POST | /api/gateway/repeat | Repeat last |
── Assets ──
| Method | Endpoint | Description |
|---|
| POST | /api/assets | List owned assets {type, offset_id?} |
| POST | /api/assets/assign | Assign username {type, username, assign_to} |
| POST | /api/assets/bot-link | Get bot link {id} |
── NFT ──
| Method | Endpoint | Description |
|---|
| POST | /api/nft/convert/init | Start conversion {username} |
| POST | /api/nft/convert/check | Check conversion {id} |
| POST | /api/nft/convert/start | Finalize conversion {id, bid, transaction} |
| POST | /api/nft/convert/revert | Revert conversion {username, confirmed} |
| POST | /api/nft/transfer | Transfer NFT {username, recipient} |
| POST | /api/nft/transfer/check | Check transfer {id} |
| POST | /api/nft/withdraw | Withdraw to wallet {username, address} |
── Random ──
| Method | Endpoint | Description |
|---|
| POST | /api/random/state | Init page |
| POST | /api/random/play | Play {amount, number} |
| POST | /api/random/repeat | Repeat last |
── Login Codes ──
| Method | Endpoint | Description |
|---|
| POST | /api/login-codes/state | Get state |
| POST | /api/login-codes/toggle | Toggle codes {enabled} |
| POST | /api/login-codes/terminate | Terminate sessions {phone} |
── KYC ──
| Method | Endpoint | Description |
|---|
| POST | /api/kyc/token | Get KYC token |
| POST | /api/kyc/status | Update KYC status |
── Fragment Wallet / Auth ──
| Method | Endpoint | Description |
|---|
| POST | /api/auth/ton-link | Get TON auth link |
| POST | /api/auth/ton-proof | Verify wallet proof {account, device, proof} |
| POST | /api/auth/ton-logout | Disconnect TON wallet |
| POST | /api/wallet/verify | Verify wallet {address, proof} |
| POST | /api/wallet/check | Check wallet {address} |
| POST | /api/wallet/link | Link wallet {address, proof} |
| POST | /api/wallet/sessions | Get active sessions |
| POST | /api/wallet/terminate | Terminate session {session_id} |
| POST | /api/auth/logout | Full logout |
── History ──
| Method | Endpoint | Description |
|---|
| POST | /api/history/bids | Bids history |
| POST | /api/history/premium | Premium history |
| POST | /api/history/orders | Orders history |
| POST | /api/history/owners | Ownership history |
── Stars Revenue ──
| Method | Endpoint | Description |
|---|
| POST | /api/stars-revenue/state | Init withdrawal page |
| POST | /api/stars-revenue/withdraw | Withdraw revenue {amount, address} |
── Tonkeeper ──
| Method | Endpoint | Description |
|---|
| GET | /api/tonkeeper/raw | Get raw TX data (?id=req_xxx) |