Overview
Barcha endpointlar POST va JSON formatda

Fragment API bilan ishlash

Hujjatlar bo'limlarga ajratilgan. Har bir endpoint uchun darrov ishlatish mumkin bo'lgan URL, cURL, request, response va xatolik javoblari bir joyda ko'rsatiladi.

Base URL https://fragment-api.uz/api/v1
Header X-API-Key: <api-key>
So'rov POST + JSON body
Javob formati ok / message / code / result
1

API key yuboring

Har bir so'rovga X-API-Key header qo'shiladi.

2

JSON body yuboring

Barcha endpointlar POST ishlatadi va body application/json bo'ladi.

3

Javobni tekshiring

`ok=true/false` ga qarang, xatoda esa `code` orqali turini ajrating.

Ma'lumot

Telegram foydalanuvchi ma'lumotlarini olish endpointlari.

POST /v1/getInfo

Telegram foydalanuvchi ma'lumotlarini olish

URL https://fragment-api.uz/api/v1/getInfo
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/getInfo' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{
  "username": "durov"
}'
Request JSON body
{
  "username": "durov"
}
Response 200 OK
{
  "ok": true,
  "message": "Telegram foydalanuvchi topildi.",
  "result": {
    "username": "durov",
    "name": "Pavel Durov",
    "photo": "https://nft.fragment.com/photo.jpg",
    "is_premium": true
  }
}
Xatolik javobi 400
{
  "ok": false,
  "message": "Fragment bilan bog'liq muammo yuzaga keldi.",
  "code": "FRAGMENT_ERROR"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
Narxlar

Stars va Premium narxlarini olish endpointlari.

POST /v1/stars/pricing

Telegram Stars narxlarini olish

URL https://fragment-api.uz/api/v1/stars/pricing
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/stars/pricing' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{
  "amount": 60
}'
Request JSON body
{
  "amount": 60
}
Response 200 OK
{
  "ok": true,
  "message": "Stars narxlari muvaffaqiyatli olindi.",
  "result": {
    "amount": 50,
    "price": {
      "ton": "0.3151",
      "usd": "0.75",
      "selected": "0.75"
    }
  }
}
Xatolik javobi 400
{
  "ok": false,
  "message": "Fragment bilan bog'liq muammo yuzaga keldi.",
  "code": "FRAGMENT_ERROR"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
POST /v1/premium/pricing

Telegram Premium narxlarini olish

URL https://fragment-api.uz/api/v1/premium/pricing
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/premium/pricing' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{}'
Request JSON body
{}
Response 200 OK
{
  "ok": true,
  "message": "Premium narxlari muvaffaqiyatli olindi.",
  "result": {
    "packages": [
      {
        "months": 3,
        "ton": "5",
        "usd": "11.99"
      },
      {
        "months": 6,
        "ton": "6.67",
        "usd": "15.99"
      },
      {
        "months": 12,
        "ton": "12.1",
        "usd": "28.99"
      }
    ]
  }
}
Xatolik javobi 400
{
  "ok": false,
  "message": "Fragment bilan bog'liq muammo yuzaga keldi.",
  "code": "FRAGMENT_ERROR"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
Sotib olish

Stars va Premium sotib olish endpointlari.

POST /v1/stars/buy

Telegram Stars sotib olish

URL https://fragment-api.uz/api/v1/stars/buy
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/stars/buy' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{
  "amount": 60,
  "username": "durov"
}'
Request JSON body
{
  "amount": 60,
  "username": "durov"
}
Response 200 OK
{
  "ok": true,
  "message": "Stars buyurtmasi muvaffaqiyatli bajarildi.",
  "result": {
    "username": "durov",
    "amount": 50,
    "payment_method": "USDT",
    "cost": "0.75"
  }
}
Xatolik javobi 400
{
  "ok": false,
  "message": "Fragment bilan bog'liq muammo yuzaga keldi.",
  "code": "FRAGMENT_ERROR"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
POST /v1/premium/buy

Telegram Premium sotib olish

URL https://fragment-api.uz/api/v1/premium/buy
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/premium/buy' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{
  "duration": 12,
  "username": "durov"
}'
Request JSON body
{
  "duration": 12,
  "username": "durov"
}
Response 200 OK
{
  "ok": true,
  "message": "Premium buyurtmasi muvaffaqiyatli bajarildi.",
  "result": {
    "username": "durov",
    "duration": 3,
    "payment_method": "TON",
    "cost": "5"
  }
}
Xatolik javobi 400
{
  "ok": false,
  "message": "Fragment bilan bog'liq muammo yuzaga keldi.",
  "code": "FRAGMENT_ERROR"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
Hamyon

Loyiha hamyoni balansi va hisob-kitob endpointlari.

POST /v1/wallet/balance

Loyiha hamyoni balansini olish

URL https://fragment-api.uz/api/v1/wallet/balance
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/wallet/balance' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{}'
Request JSON body
{}
Response 200 OK
{
  "ok": true,
  "message": "Loyiha hamyoni balansi muvaffaqiyatli olindi.",
  "result": {
    "project": "Oscar stars",
    "address": "EQBCb8...PFKUBY",
    "balance_ton": "0.2400",
    "balance_usdt": "12.500000",
    "wallet_version": "V4R2",
    "network": "TON Mainnet"
  }
}
Balans xatosi 400
{
  "ok": false,
  "message": "Balansni yangilab bo'lmadi.",
  "code": "BLOCKCHAIN_FAIL"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}
POST /v1/wallet/calculate

Loyiha hamyoni bilan nimalar olish mumkinligini hisoblash

URL https://fragment-api.uz/api/v1/wallet/calculate
cURL tez sinov uchun
curl -X POST 'https://fragment-api.uz/api/v1/wallet/calculate' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <api-key>' \
  -d '{}'
Request JSON body
{}
Response 200 OK
{
  "ok": true,
  "message": "Loyiha hamyoni imkoniyatlari muvaffaqiyatli hisoblandi.",
  "result": {
    "balance_ton": "0.2400",
    "balance_usdt": "12.500000",
    "stars": {
      "max_amount": 16,
      "asset": "USDT",
      "amount": "0.2398",
      "ton": "0.0000",
      "usdt": "0.239800"
    },
    "premium": {
      "packages": []
    }
  }
}
Balans xatosi 400
{
  "ok": false,
  "message": "Balansni yangilab bo'lmadi.",
  "code": "BLOCKCHAIN_FAIL"
}
API key xatosi 401
{
  "ok": false,
  "message": "X-API-Key maydoni noto'g'ri yoki yetishmaydi.",
  "code": "VALIDATION_ERROR"
}
Server xatosi 500
{
  "ok": false,
  "message": "Serverning ichki kutilmagan xatosi.",
  "code": "CRITICAL_SERVER_ERROR"
}