مرجع API

GramNumber Virtual Numbers API

OpenAPI 1.0.0

دانلود openapi.yaml آدرس پایه: https://www.gramnumber.com

Public catalog endpoints require no authentication.

Sales API (/api/v1/*) uses a Bearer token tied to a user wallet. Each successful checkout debits that user's balance exactly like the web storefront.

Virtual numbers

  • Catalog (no auth): GET /api/v1/catalog/services, GET /api/v1/catalog/services/{service}/prices
  • Purchase (Bearer): POST /api/v1/checkout
  • Orders (Bearer): GET /api/v1/orders, GET /api/v1/orders/{id}, GET /api/v1/orders/{id}/code, POST /api/v1/orders/{id}/cancel

Telegram Stars, Premium & Gifts

  • Catalog (no auth): GET /api/v1/catalog/telegram/stars, GET /api/v1/catalog/telegram/premium, GET /api/v1/catalog/telegram/gifts/collections, GET /api/v1/catalog/telegram/gifts?collection_id=..., POST /api/v1/catalog/telegram/gifts/quote
  • Purchase (Bearer): POST /api/v1/telegram/stars, POST /api/v1/telegram/premium, POST /api/v1/telegram/gifts
  • Gift payment (Bearer, when balance is short): GET|POST /api/v1/telegram/orders/{id}/payment, POST /api/v1/telegram/orders/{id}/complete, POST /api/v1/telegram/orders/{id}/cancel
  • Orders (Bearer): GET /api/v1/telegram/orders, GET /api/v1/telegram/orders/{id}

Gift purchase flow

  1. List collections → list gifts (or quote a gift_slug) → POST /api/v1/telegram/gifts with gift_slug + user_tag.
  2. If the wallet covers the quote → 201 and the gift is paid + transferred (awaiting_payment: false).
  3. If the wallet is short → 202 with a pending (or later not_enough) order, no debit yet, and a payment helper object (status / top-up / complete URLs).
  4. Top up via Cryptomus (POST .../payment → open pay_url), poll GET .../payment until can_complete, then POST .../complete to debit and deliver.
  5. Cancel with POST .../cancel while awaiting payment (no refund if wallet_debited is false). If supplier price rises while waiting, status becomes not_enough and remaining credits increase.

SecureTD (Telegram accounts)

  • Catalog (no auth): GET /api/v1/catalog/securetd/categories, GET /api/v1/catalog/securetd/categories/{categoryId}/products, GET /api/v1/catalog/securetd/search?q=...
  • Purchase (Bearer): POST /api/v1/securetd/checkout
  • Orders (Bearer): GET /api/v1/securetd/orders, GET /api/v1/securetd/orders/{id}, GET /api/v1/securetd/orders/{id}/download

Custom Tdata (separate catalog & checkout — not SecureTD; same URL shape as SecureTD)

  • Catalog (no auth): GET /api/v1/catalog/custom-tdata/categories, GET /api/v1/catalog/custom-tdata/categories/{categoryId}/products, GET /api/v1/catalog/custom-tdata/search?q=...
  • Purchase (Bearer): POST /api/v1/custom-tdata/checkout with product_id, quantity
  • Orders (Bearer): GET /api/v1/custom-tdata/orders, GET /api/v1/custom-tdata/orders/{id}, GET /api/v1/custom-tdata/orders/{id}/download

Gift cards

  • Catalog (no auth): GET /api/v1/catalog/gift-cards/categories, GET /api/v1/catalog/gift-cards/categories/{categoryId}
  • Purchase (Bearer): POST /api/v1/gift-cards/checkout
  • Pending payment (Bearer, when balance is short): GET|POST /api/v1/gift-cards/orders/{id}/payment, POST /api/v1/gift-cards/orders/{id}/complete, POST /api/v1/gift-cards/orders/{id}/cancel
  • Orders (Bearer): GET /api/v1/gift-cards/orders, GET /api/v1/gift-cards/orders/{id}

Gift card purchase flow

  1. List categories → open one category for card_id offers → POST /api/v1/gift-cards/checkout with category_id, card_id, optional quantity.
  2. If the wallet covers the price → 201 and fulfillment starts (awaiting_payment: false). Completed orders include codes.
  3. If the wallet is short → 202 with a pending order, no debit yet, and a payment helper object.
  4. Top up via Cryptomus (POST .../payment → open pay_url), poll GET .../payment until can_complete, then POST .../complete.
  5. Cancel with POST .../cancel while awaiting payment (refunds only if wallet_debited was true).

Create a token on the server: php artisan sales-api:create-token user@example.com my-integration

Interactive reference: {APP_URL}/docs/api

احراز هویت

endpointهای فروش به توکن Bearer متصل به کیف پول نیاز دارند. در هر درخواست احراز‌شده این هدر را بفرستید:

Authorization: Bearer gn_<secret>

توکن را در پروفایل یا روی سرور بسازید: php artisan sales-api:create-token user@example.com my-integration

Catalog

Public service list and live prices

GET /api/v1/catalog/services عمومی

List all public services

پاسخ‌ها

  • 200 Non-empty catalog CatalogServicesResponse
  • {
        "ok": true,
        "message": "string",
        "services": [
            {}
        ],
        "featured": {
            "primary": [
                {}
            ],
            "more": [
                {}
            ]
        },
        "irr_per_usd": 1,
        "markup_percent": 1
    }
  • 503 Upstream unavailable and no cached services ErrorResponse
  • {
        "ok": false,
        "message": "string"
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/services" \
  -H "Accept: application/json"
GET /api/v1/catalog/services/{service}/prices عمومی

Live price rows for one service

پارامترها

نام محل نوع اجباری توضیح
service path string بله Service identifier: `telegram`, numeric Ozvinoo id, or `sim_{slug}` for 5sim (e.g. `sim_whatsapp`).

پاسخ‌ها

  • 200 Price rows PricesResponse
  • {
        "ok": true,
        "message": "string",
        "rows": [
            {
                "country": "string",
                "range": "string",
                "count": "string",
                "base_price": 1,
                "price": 1,
                "usd": 1
            }
        ],
        "markup_percent": 1,
        "irr_per_usd": 1
    }
  • 404 Unknown service
  • 502 Upstream error ErrorResponse
  • {
        "ok": false,
        "message": "string"
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/services/{service}/prices" \
  -H "Accept: application/json"

Sales

Authenticated wallet checkout & order lookup

GET /api/v1/me توکن Bearer

Current token owner profile & wallet

پاسخ‌ها

  • 200 پاسخ MeResponse
  • {
        "ok": true,
        "user": {
            "id": 1,
            "email": "user@example.com",
            "name": "string",
            "balance_credits": 1,
            "balance_usd_display": "$12.34"
        },
        "virtual_numbers": {
            "catalog_services": "GET /api/v1/catalog/services",
            "catalog_prices": "GET /api/v1/catalog/services/{service}/prices",
            "checkout": "POST /api/v1/checkout",
            "list_orders": "GET /api/v1/orders",
            "show_order": "GET /api/v1/orders/{id}",
            "poll_sms_code": "GET /api/v1/orders/{id}/code",
            "cancel_order": "POST /api/v1/orders/{id}/cancel"
        },
        "telegram": {
            "catalog_stars": "GET /api/v1/catalog/telegram/stars",
            "catalog_premium": "GET /api/v1/catalog/telegram/premium",
            "catalog_gift_collections": "GET /api/v1/catalog/telegram/gifts/collections",
            "catalog_gifts": "GET /api/v1/catalog/telegram/gifts?collection_id={id}",
            "quote_gift": "POST /api/v1/catalog/telegram/gifts/quote",
            "purchase_stars": "POST /api/v1/telegram/stars",
            "purchase_premium": "POST /api/v1/telegram/premium",
            "purchase_gift": "POST /api/v1/telegram/gifts",
            "list_orders": "GET /api/v1/telegram/orders",
            "show_order": "GET /api/v1/telegram/orders/{id}",
            "gift_payment_status": "GET /api/v1/telegram/orders/{id}/payment",
            "gift_payment_topup": "POST /api/v1/telegram/orders/{id}/payment",
            "gift_payment_complete": "POST /api/v1/telegram/orders/{id}/complete",
            "cancel_order": "POST /api/v1/telegram/orders/{id}/cancel"
        },
        "securetd": {
            "catalog_categories": "GET /api/v1/catalog/securetd/categories",
            "catalog_products": "GET /api/v1/catalog/securetd/categories/{categoryId}/products",
            "search": "GET /api/v1/catalog/securetd/search?q=...",
            "checkout": "POST /api/v1/securetd/checkout",
            "list_orders": "GET /api/v1/securetd/orders",
            "show_order": "GET /api/v1/securetd/orders/{id}",
            "download": "GET /api/v1/securetd/orders/{id}/download"
        },
        "custom_tdata": {
            "catalog_categories": "GET /api/v1/catalog/custom-tdata/categories",
            "catalog_products": "GET /api/v1/catalog/custom-tdata/categories/{categoryId}/products",
            "search": "GET /api/v1/catalog/custom-tdata/search?q=...",
            "checkout": "POST /api/v1/custom-tdata/checkout",
            "list_orders": "GET /api/v1/custom-tdata/orders",
            "show_order": "GET /api/v1/custom-tdata/orders/{id}",
            "download": "GET /api/v1/custom-tdata/orders/{id}/download"
        },
        "gift_cards": {
            "catalog_categories": "GET /api/v1/catalog/gift-cards/categories",
            "catalog_category": "GET /api/v1/catalog/gift-cards/categories/{categoryId}",
            "checkout": "POST /api/v1/gift-cards/checkout",
            "list_orders": "GET /api/v1/gift-cards/orders",
            "show_order": "GET /api/v1/gift-cards/orders/{id}",
            "payment_status": "GET /api/v1/gift-cards/orders/{id}/payment",
            "payment_topup": "POST /api/v1/gift-cards/orders/{id}/payment",
            "complete": "POST /api/v1/gift-cards/orders/{id}/complete",
            "cancel": "POST /api/v1/gift-cards/orders/{id}/cancel"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/me" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/checkout توکن Bearer

Purchase one or more numbers (wallet debit)

Same payload semantics as authenticated web batch checkout (POST /shop/purchase-batch). Up to 25 lines per request. Each item is one logical line (service + country_range); use the storefront or /api/v1/catalog/services/{service}/prices to obtain valid country_range values.

بدنه درخواست CheckoutRequest

{
    "items": [
        {
            "service": "string",
            "country_range": "string"
        }
    ]
}

پاسخ‌ها

  • 201 All lines purchased CheckoutSuccess
  • {
        "ok": true,
        "had_awaiting_supplier": true,
        "orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "pending_sms",
                "supplier": "ozvinoo",
                "service_title": "string",
                "country_label": "string",
                "phone": "string",
                "external_request_id": 1,
                "sms_code": "string",
                "price_charged_credits": 1,
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient wallet balance CheckoutFailure
  • {
        "ok": false,
        "message": "string",
        "wallet": true,
        "partial_orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "pending_sms",
                "supplier": "ozvinoo",
                "service_title": "string",
                "country_label": "string",
                "phone": "string",
                "external_request_id": 1,
                "sms_code": "string",
                "price_charged_credits": 1,
                "created_at": "string"
            }
        ]
    }
  • 422 Validation or business error (includes partial_orders if some lines succeeded) CheckoutFailure
  • {
        "ok": false,
        "message": "string",
        "wallet": true,
        "partial_orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "pending_sms",
                "supplier": "ozvinoo",
                "service_title": "string",
                "country_label": "string",
                "phone": "string",
                "external_request_id": 1,
                "sms_code": "string",
                "price_charged_credits": 1,
                "created_at": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/checkout" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
        {
            "service": "string",
            "country_range": "string"
        }
    ]
}'
GET /api/v1/orders توکن Bearer

List virtual number orders

Returns the most recent virtual number orders for the token owner. Optional limit query (1–100, default 50).

پارامترها

نام محل نوع اجباری توضیح
limit query integer خیر —

پاسخ‌ها

  • 200 پاسخ VirtualNumberOrdersListResponse
  • {
        "ok": true,
        "orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "pending_sms",
                "supplier": "ozvinoo",
                "service_title": "string",
                "country_label": "string",
                "phone": "string",
                "external_request_id": 1,
                "sms_code": "string",
                "price_charged_credits": 1,
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/orders" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/orders/{order} توکن Bearer

Get one order by id (must belong to token user)

پارامترها

نام محل نوع اجباری توضیح
order path integer بله —

پاسخ‌ها

  • 200 پاسخ
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "pending_sms",
            "supplier": "ozvinoo",
            "service_title": "string",
            "country_label": "string",
            "phone": "string",
            "external_request_id": 1,
            "sms_code": "string",
            "price_charged_credits": 1,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/orders/{order}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/orders/{order}/code توکن Bearer

Poll SMS verification code

Poll while status is pending_sms. When the supplier delivers the code, status becomes completed and sms_code is set. Same supplier logic as the web storefront poll endpoint.

پارامترها

نام محل نوع اجباری توضیح
order path integer بله —

پاسخ‌ها

  • 200 پاسخ OrderPollResponse
  • {
        "ok": true,
        "status": "pending_sms",
        "sms_code": "string",
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "pending_sms",
            "supplier": "ozvinoo",
            "service_title": "string",
            "country_label": "string",
            "phone": "string",
            "external_request_id": 1,
            "sms_code": "string",
            "price_charged_credits": 1,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/orders/{order}/code" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/orders/{order}/cancel توکن Bearer

Cancel a virtual number order

Cancels pending_sms orders (refunds wallet) or refunds awaiting_supplier lines. Other statuses return HTTP 422.

پارامترها

نام محل نوع اجباری توضیح
order path integer بله —

پاسخ‌ها

  • 200 پاسخ OrderCancelResponse
  • {
        "ok": true,
        "refunded": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "pending_sms",
            "supplier": "ozvinoo",
            "service_title": "string",
            "country_label": "string",
            "phone": "string",
            "external_request_id": 1,
            "sms_code": "string",
            "price_charged_credits": 1,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user
  • 422 Cancel not allowed for this status ErrorResponse
  • {
        "ok": false,
        "message": "string"
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/orders/{order}/cancel" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"

Telegram

Telegram Stars, Premium & Gifts catalog and wallet checkout

GET /api/v1/catalog/telegram/stars عمومی

Telegram Stars packs and pricing

پاسخ‌ها

  • 200 Stars catalog available TelegramStarsCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "display_name": "string",
        "unit_price_usd": "$0.01",
        "min_custom_quantity": 49,
        "allows_custom_quantity": true,
        "unit_price_credits": 1,
        "preset_quantities": [
            50,
            75,
            100,
            150,
            250,
            350,
            500,
            750,
            1000,
            1500,
            2500,
            5000
        ],
        "packs": [
            {
                "quantity": 1,
                "price_credits": 1,
                "price_usd_display": "$5.00"
            }
        ]
    }
  • 503 Stars checkout disabled (no admin pricing) TelegramStarsCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "display_name": "string",
        "unit_price_usd": "$0.01",
        "min_custom_quantity": 49,
        "allows_custom_quantity": true,
        "unit_price_credits": 1,
        "preset_quantities": [
            50,
            75,
            100,
            150,
            250,
            350,
            500,
            750,
            1000,
            1500,
            2500,
            5000
        ],
        "packs": [
            {
                "quantity": 1,
                "price_credits": 1,
                "price_usd_display": "$5.00"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/telegram/stars" \
  -H "Accept: application/json"
GET /api/v1/catalog/telegram/premium عمومی

Telegram Premium plans and pricing

پاسخ‌ها

  • 200 Premium plans available TelegramPremiumCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "plans": [
            {
                "months": 1,
                "price_credits": 1,
                "price_usd": 1,
                "price_usd_display": "string",
                "wallet_price_display": "string"
            }
        ]
    }
  • 503 Premium checkout disabled TelegramPremiumCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "plans": [
            {
                "months": 1,
                "price_credits": 1,
                "price_usd": 1,
                "price_usd_display": "string",
                "wallet_price_display": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/telegram/premium" \
  -H "Accept: application/json"
GET /api/v1/catalog/telegram/gifts/collections عمومی

Telegram Gift collections

پاسخ‌ها

  • 200 Collections list TelegramGiftCollectionsResponse
  • {
        "ok": true,
        "message": "string",
        "purchase_available": true,
        "collections": [
            {
                "id": "string",
                "name": "string",
                "count": 1,
                "image_url": "string",
                "url": "string"
            }
        ]
    }
  • 503 Gifts catalog unavailable TelegramGiftCollectionsResponse
  • {
        "ok": true,
        "message": "string",
        "purchase_available": true,
        "collections": [
            {
                "id": "string",
                "name": "string",
                "count": 1,
                "image_url": "string",
                "url": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/telegram/gifts/collections" \
  -H "Accept: application/json"
GET /api/v1/catalog/telegram/gifts عمومی

List gifts in a collection (on sale)

پارامترها

نام محل نوع اجباری توضیح
collection_id query string بله —
sort query string خیر —

پاسخ‌ها

  • 200 Gift listings with wallet prices (includes ~10% site markup) TelegramGiftsCatalogResponse
  • {
        "ok": true,
        "collection_id": "string",
        "sort": "string",
        "count": 1,
        "purchase_available": true,
        "gifts": [
            {
                "gift_slug": "string",
                "name": "string",
                "number": "string",
                "price_ton": 1,
                "price_usd_est": 1,
                "wallet_price": "string",
                "price_credits": 1,
                "image_url": "string",
                "for_sale": true
            }
        ]
    }
  • 422 Missing or invalid collection_id
  • 503 Gifts catalog unavailable

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/telegram/gifts" \
  -H "Accept: application/json"
POST /api/v1/catalog/telegram/gifts/quote عمومی

Live gift quote (supplier price + markup)

Returns live USD/credits for a gift_slug (e.g. plushpepe-123). No wallet debit. Use before POST /api/v1/telegram/gifts. If purchase returns 202, re-check price via order payment status — supplier price can rise while awaiting top-up.

بدنه درخواست TelegramGiftQuoteRequest

{
    "gift_slug": "plushpepe-42"
}

پاسخ‌ها

  • 200 Quote OK and for sale TelegramGiftQuoteResponse
  • {
        "ok": true,
        "gift_slug": "string",
        "for_sale": true,
        "sell_price_ton": 1,
        "sell_price_usd": 1,
        "price_usd": 1,
        "price_credits": 1,
        "wallet_price": "string",
        "message": "string"
    }
  • 422 Invalid slug, sold out, or price unavailable TelegramGiftQuoteResponse
  • {
        "ok": true,
        "gift_slug": "string",
        "for_sale": true,
        "sell_price_ton": 1,
        "sell_price_usd": 1,
        "price_usd": 1,
        "price_credits": 1,
        "wallet_price": "string",
        "message": "string"
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/catalog/telegram/gifts/quote" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "gift_slug": "plushpepe-42"
}'
POST /api/v1/telegram/stars توکن Bearer

Buy Telegram Stars (wallet debit)

Debits the token owner's wallet and creates a manual-fulfillment order. user_tag accepts @username or https://t.me/username. quantity must be a preset pack size from the Stars catalog, or any custom amount from 50 upward.

بدنه درخواست TelegramStarsPurchaseRequest

{
    "user_tag": "@mychannel",
    "quantity": 100
}

پاسخ‌ها

  • 201 Order created TelegramPurchaseSuccess
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "staff_notified": true
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient wallet balance TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 422 Validation or invalid tag TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 503 Stars checkout disabled TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/stars" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "user_tag": "@mychannel",
    "quantity": 100
}'
POST /api/v1/telegram/premium توکن Bearer

Buy Telegram Premium months (wallet debit)

Debits the token owner's wallet and creates a manual-fulfillment order. months must match an available plan from the Premium catalog endpoint.

بدنه درخواست TelegramPremiumPurchaseRequest

{
    "user_tag": "https://t.me/username",
    "months": 3
}

پاسخ‌ها

  • 201 Order created TelegramPurchaseSuccess
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "staff_notified": true
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient wallet balance TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 422 Validation or invalid tag / plan TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 503 Premium checkout disabled TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/premium" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "user_tag": "https://t.me/username",
    "months": 3
}'
POST /api/v1/telegram/gifts توکن Bearer

Buy a Telegram Gift (instant or awaiting payment)

Quotes the live supplier price (with site markup), then either:

  • Enough balance → debits the wallet, pays the supplier, transfers the gift to user_tag (201).
  • Short balance → creates a gift order in pending without debiting (202, awaiting_payment: true) and returns a payment helper with remaining credits and URLs for status / Cryptomus top-up / complete.

Flow: list collections → list gifts → optional quote → purchase → (if 202) top up → complete. gift_slug looks like collection-number (e.g. plushpepe-42). user_tag accepts @username or https://t.me/username.

بدنه درخواست TelegramGiftPurchaseRequest

{
    "gift_slug": "plushpepe-42",
    "user_tag": "@recipient",
    "show_sender": false,
    "gift_image_url": "string",
    "gift_display_name": "string"
}

پاسخ‌ها

  • 201 Gift purchased and transferred (`awaiting_payment` false) TelegramGiftPurchaseSuccess
  • {
        "ok": true,
        "awaiting_payment": false,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 202 Order created and awaiting wallet top-up. No debit yet (`wallet_debited: false`). Use `payment.*` URLs, then `POST .../complete` after the balance covers `remaining_credits`. TelegramGiftAwaitingPaymentResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "payment": {
            "status": "pending",
            "status_label": "string",
            "remaining_credits": 1,
            "remaining_usd": 1,
            "remaining_usd_display": "$5.00",
            "balance_credits": 1,
            "balance_usd_display": "string",
            "can_complete": true,
            "payment_status_url": "https://example.com/api/v1/telegram/orders/12/payment",
            "create_topup_url": "https://example.com/api/v1/telegram/orders/12/payment",
            "complete_url": "https://example.com/api/v1/telegram/orders/12/complete"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 422 Validation, invalid tag, invalid gift, quote failed, or not for sale TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 503 Gifts checkout disabled or supplier payment/transfer failed (wallet refunded on supplier failure after debit) TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/gifts" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "gift_slug": "plushpepe-42",
    "user_tag": "@recipient",
    "show_sender": false,
    "gift_image_url": "string",
    "gift_display_name": "string"
}'
GET /api/v1/telegram/orders توکن Bearer

List Telegram Stars / Premium / Gift orders

Returns the most recent orders for the token owner. Optional limit query (1–100, default 50).

پارامترها

نام محل نوع اجباری توضیح
limit query integer خیر —

پاسخ‌ها

  • 200 Order list TelegramOrdersListResponse
  • {
        "ok": true,
        "orders": [
            {
                "id": 1,
                "order_number": "string",
                "product_type": "stars",
                "status": "completed",
                "status_label": "string",
                "quantity": 1,
                "months": 1,
                "gift_slug": "string",
                "gift_image_url": "string",
                "show_sender": true,
                "supplier_tx_id": "string",
                "user_tag": "string",
                "service_name_snapshot": "string",
                "price_charged_credits": 1,
                "quoted_price_credits": 1,
                "price_usd_display": "$4.99",
                "wallet_debited": true,
                "awaiting_payment": true,
                "remaining_credits": 1,
                "remaining_usd_display": "$1.25",
                "can_complete": true,
                "placed_via_api": true,
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/telegram/orders" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/telegram/orders/{telegramProductOrder} توکن Bearer

Get one Telegram Stars / Premium / Gift order

For gift orders awaiting payment, the live supplier quote is refreshed when possible. A price increase may move status from pending to not_enough and raise remaining_credits.

پارامترها

نام محل نوع اجباری توضیح
telegramProductOrder path integer بله —

پاسخ‌ها

  • 200 پاسخ
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/telegram/orders/{telegramProductOrder}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/telegram/orders/{telegramProductOrder}/payment توکن Bearer

Gift payment status (remaining balance)

Gift orders only. Refreshes the live quote while pending / not_enough, then returns remaining credits vs the token owner's wallet and whether POST .../complete can run.

پارامترها

نام محل نوع اجباری توضیح
telegramProductOrder path integer بله —

پاسخ‌ها

  • 200 Payment snapshot TelegramGiftPaymentStatusResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "can_complete": true,
        "cryptomus_configured": true,
        "status": "pending",
        "status_label": "string",
        "price_credits": 1,
        "price_usd_display": "string",
        "balance_credits": 1,
        "balance_usd_display": "string",
        "remaining_credits": 1,
        "remaining_usd": 1,
        "remaining_usd_display": "string",
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user
  • 422 Order is not a gift TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/telegram/orders/{telegramProductOrder}/payment" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/telegram/orders/{telegramProductOrder}/payment توکن Bearer

Create Cryptomus top-up for a gift order

Creates a wallet top-up invoice sized to the remaining gift price (at least the site minimum top-up). Open pay_url to pay with crypto. After Cryptomus credits the wallet, call POST .../complete. If the wallet already covers the price, returns can_complete: true without creating an invoice.

پارامترها

نام محل نوع اجباری توضیح
telegramProductOrder path integer بله —

پاسخ‌ها

  • 200 Balance already enough — call complete TelegramGiftTopupReadyResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "can_complete": true,
        "message": "string",
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 201 Cryptomus invoice created TelegramGiftTopupCreatedResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "pay_url": "string",
        "topup_id": 1,
        "topup_reference": "string",
        "amount_credits": 1,
        "amount_usd": 1,
        "amount_usd_display": "string",
        "remaining_credits": 1,
        "remaining_usd_display": "string",
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user
  • 422 Order not awaiting payment, or amount invalid TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 503 Cryptomus not configured or gateway error TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/orders/{telegramProductOrder}/payment" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/telegram/orders/{telegramProductOrder}/complete توکن Bearer

Complete a gift order after top-up

For pending / not_enough gift orders when the wallet covers the current quoted price. Debits the wallet, pays the supplier, and transfers the gift. Returns 201 on success (same shape as an instant gift purchase). Returns 402 if balance is still short.

پارامترها

نام محل نوع اجباری توضیح
telegramProductOrder path integer بله —

پاسخ‌ها

  • 201 Gift purchased and transferred TelegramGiftPurchaseSuccess
  • {
        "ok": true,
        "awaiting_payment": false,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Wallet still insufficient after re-quote TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 404 Not found or not owned by this user
  • 422 Not awaiting payment, invalid gift/tag, or invalid state TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }
  • 503 Supplier payment/transfer failed (wallet refunded after debit) TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/orders/{telegramProductOrder}/complete" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/telegram/orders/{telegramProductOrder}/cancel توکن Bearer

Cancel a Telegram product order

Allowed while status is pending, not_enough, or in_progress (same ownership rules as show). Gift orders awaiting payment typically have wallet_debited: false → status becomes cancelled with no refund. If the wallet was already debited, balance is restored and status becomes refunded.

پارامترها

نام محل نوع اجباری توضیح
telegramProductOrder path integer بله —

پاسخ‌ها

  • 200 Order cancelled or refunded
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user
  • 422 Cancel not allowed for this status TelegramPurchaseFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_type": "stars",
            "status": "completed",
            "status_label": "string",
            "quantity": 1,
            "months": 1,
            "gift_slug": "string",
            "gift_image_url": "string",
            "show_sender": true,
            "supplier_tx_id": "string",
            "user_tag": "string",
            "service_name_snapshot": "string",
            "price_charged_credits": 1,
            "quoted_price_credits": 1,
            "price_usd_display": "$4.99",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "$1.25",
            "can_complete": true,
            "placed_via_api": true,
            "created_at": "string"
        },
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/telegram/orders/{telegramProductOrder}/cancel" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"

SecureTD

SecureTD Telegram account catalog and wallet checkout

GET /api/v1/catalog/securetd/categories عمومی

SecureTD product categories

پاسخ‌ها

  • 200 Categories available SecureTdCategoriesCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "categories": [
            {
                "category_id": 1,
                "category_name": "Telegram accounts",
                "total_stock": 1
            }
        ]
    }
  • 503 SecureTD checkout disabled or upstream unavailable SecureTdCategoriesCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "categories": [
            {
                "category_id": 1,
                "category_name": "Telegram accounts",
                "total_stock": 1
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/securetd/categories" \
  -H "Accept: application/json"
GET /api/v1/catalog/securetd/categories/{categoryId}/products عمومی

SecureTD products in one category

پارامترها

نام محل نوع اجباری توضیح
categoryId path integer بله —

پاسخ‌ها

  • 200 Product list for category SecureTdProductsCatalogResponse
  • {
        "ok": true,
        "category_id": 1,
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }
  • 503 SecureTD checkout disabled SecureTdProductsCatalogResponse
  • {
        "ok": true,
        "category_id": 1,
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/securetd/categories/{categoryId}/products" \
  -H "Accept: application/json"
GET /api/v1/catalog/securetd/search عمومی

Search SecureTD products by country name or dial code

Matches product names across all categories. Query must be at least 2 characters.

پارامترها

نام محل نوع اجباری توضیح
q query string خیر Country name or dial code (e.g. `+1`, `USA`, `Germany`)

پاسخ‌ها

  • 200 Search results (empty when query is blank or too short) SecureTdSearchResponse
  • {
        "ok": true,
        "query": "string",
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }
  • 503 SecureTD checkout disabled SecureTdSearchResponse
  • {
        "ok": true,
        "query": "string",
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/securetd/search" \
  -H "Accept: application/json"
POST /api/v1/securetd/checkout توکن Bearer

Buy SecureTD Telegram account(s) (wallet debit)

Debits the token owner's wallet and submits a supplier purchase task. Poll GET /api/v1/securetd/orders/{id} until download_ready is true, then download via GET /api/v1/securetd/orders/{id}/download.

بدنه درخواست SecureTdCheckoutRequest

{
    "product_id": 12345,
    "quantity": 1
}

پاسخ‌ها

  • 201 Order created and supplier task started SecureTdCheckoutSuccess
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "processing",
            "product_id": 1,
            "product_name": "string",
            "category_id": 1,
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "$4.99",
            "task_id": "string",
            "task_status": 1,
            "file_url": "string",
            "download_ready": true,
            "download_url": "string",
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient wallet balance SecureTdCheckoutFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "errors": {}
    }
  • 422 Validation, invalid product, out of stock, or supplier error SecureTdCheckoutFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "errors": {}
    }
  • 503 SecureTD checkout disabled SecureTdCheckoutFailure
  • {
        "ok": false,
        "error": "insufficient_balance",
        "message": "string",
        "wallet": true,
        "errors": {}
    }

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/securetd/checkout" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 12345,
    "quantity": 1
}'
GET /api/v1/securetd/orders توکن Bearer

List SecureTD orders

Returns the most recent orders for the token owner. Optional limit query (1–100, default 50).

پارامترها

نام محل نوع اجباری توضیح
limit query integer خیر —

پاسخ‌ها

  • 200 Order list SecureTdOrdersListResponse
  • {
        "ok": true,
        "orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "processing",
                "product_id": 1,
                "product_name": "string",
                "category_id": 1,
                "quantity": 1,
                "price_charged_credits": 1,
                "price_usd_display": "$4.99",
                "task_id": "string",
                "task_status": 1,
                "file_url": "string",
                "download_ready": true,
                "download_url": "string",
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/securetd/orders" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/securetd/orders/{secureTdOrder} توکن Bearer

Get one SecureTD order

Syncs supplier task status when the order is still processing.

پارامترها

نام محل نوع اجباری توضیح
secureTdOrder path integer بله —

پاسخ‌ها

  • 200 پاسخ
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "processing",
            "product_id": 1,
            "product_name": "string",
            "category_id": 1,
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "$4.99",
            "task_id": "string",
            "task_status": 1,
            "file_url": "string",
            "download_ready": true,
            "download_url": "string",
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/securetd/orders/{secureTdOrder}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/securetd/orders/{secureTdOrder}/download توکن Bearer

Download completed SecureTD account file

Streams the supplier file with a GramNumber filename (GramNumber - {product} - {quantity}.{ext}). Requires Bearer auth; only the order owner can download.

پارامترها

نام محل نوع اجباری توضیح
secureTdOrder path integer بله —

پاسخ‌ها

  • 200 File attachment
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found, not owned, or file not ready
  • 502 Supplier file could not be fetched

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/securetd/orders/{secureTdOrder}/download" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"

Custom Tdata

Custom Tdata Telegram account files — separate folder catalog, checkout, and downloads (not SecureTD)

GET /api/v1/catalog/custom-tdata/categories عمومی

Custom Tdata product categories

Same response shape as SecureTD categories (region list with stock).

پاسخ‌ها

  • 200 Categories available SecureTdCategoriesCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "categories": [
            {
                "category_id": 1,
                "category_name": "Telegram accounts",
                "total_stock": 1
            }
        ]
    }
  • 503 Custom Tdata disabled or upstream unavailable SecureTdCategoriesCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "categories": [
            {
                "category_id": 1,
                "category_name": "Telegram accounts",
                "total_stock": 1
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/custom-tdata/categories" \
  -H "Accept: application/json"
GET /api/v1/catalog/custom-tdata/categories/{categoryId}/products عمومی

Custom Tdata products in one category

Same response shape as SecureTD category products.

پارامترها

نام محل نوع اجباری توضیح
categoryId path integer بله —

پاسخ‌ها

  • 200 Product list for category SecureTdProductsCatalogResponse
  • {
        "ok": true,
        "category_id": 1,
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }
  • 503 Custom Tdata disabled SecureTdProductsCatalogResponse
  • {
        "ok": true,
        "category_id": 1,
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/custom-tdata/categories/{categoryId}/products" \
  -H "Accept: application/json"
GET /api/v1/catalog/custom-tdata/search عمومی

Search Custom Tdata offers

Matches product names across all categories. Query must be at least 2 characters (same as SecureTD search).

پارامترها

نام محل نوع اجباری توضیح
q query string خیر Country name or dial code

پاسخ‌ها

  • 200 Search results (empty when query is blank or too short) SecureTdSearchResponse
  • {
        "ok": true,
        "query": "string",
        "products": [
            {
                "product_id": 1,
                "product_name": "USA +1",
                "total_stock": 1,
                "supplier_price_usd": 1,
                "retail_price_usd": 1,
                "wallet_price": "$2.50",
                "wallet_unit_price": "$2.50",
                "category_id": 1,
                "category_name": "string"
            }
        ]
    }
  • 503 Custom Tdata disabled ErrorResponse
  • {
        "ok": false,
        "message": "string"
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/custom-tdata/search" \
  -H "Accept: application/json"
POST /api/v1/custom-tdata/checkout توکن Bearer

Buy Custom Tdata account file(s) (wallet debit)

Separate from POST /api/v1/securetd/checkout. Debits the token owner's wallet and places a supplier order. Poll GET /api/v1/custom-tdata/orders/{id} until download_ready is true, then GET /api/v1/custom-tdata/orders/{id}/download.

بدنه درخواست CustomTdataCheckoutRequest

{
    "product_id": 1,
    "quantity": 1
}

پاسخ‌ها

  • 201 Order created CustomTdataCheckoutSuccess
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "processing",
            "product_id": 1,
            "product_name": "string",
            "category_id": 1,
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "$4.99",
            "download_ready": true,
            "download_url": "string",
            "download_filename": "string",
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient wallet balance CustomTdataCheckoutFailure
  • {
        "ok": false,
        "error": "string",
        "message": "string"
    }
  • 422 پاسخ CustomTdataCheckoutFailure
  • {
        "ok": false,
        "error": "string",
        "message": "string"
    }
  • 503 Custom Tdata checkout disabled

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/custom-tdata/checkout" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 1,
    "quantity": 1
}'
GET /api/v1/custom-tdata/orders توکن Bearer

List Custom Tdata orders

پارامترها

نام محل نوع اجباری توضیح
limit query integer خیر —

پاسخ‌ها

  • 200 پاسخ CustomTdataOrdersListResponse
  • {
        "ok": true,
        "orders": [
            {
                "id": 1,
                "order_number": "GN-10042",
                "status": "processing",
                "product_id": 1,
                "product_name": "string",
                "category_id": 1,
                "quantity": 1,
                "price_charged_credits": 1,
                "price_usd_display": "$4.99",
                "download_ready": true,
                "download_url": "string",
                "download_filename": "string",
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/custom-tdata/orders" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/custom-tdata/orders/{customTdataOrder} توکن Bearer

Get one Custom Tdata order

Syncs supplier status while the order is still processing.

پارامترها

نام محل نوع اجباری توضیح
customTdataOrder path integer بله —

پاسخ‌ها

  • 200 پاسخ
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "GN-10042",
            "status": "processing",
            "product_id": 1,
            "product_name": "string",
            "category_id": 1,
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "$4.99",
            "download_ready": true,
            "download_url": "string",
            "download_filename": "string",
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/custom-tdata/orders/{customTdataOrder}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/custom-tdata/orders/{customTdataOrder}/download توکن Bearer

Download completed Custom Tdata archive

پارامترها

نام محل نوع اجباری توضیح
customTdataOrder path integer بله —

پاسخ‌ها

  • 200 ZIP stream
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found, not owned, or file not ready

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/custom-tdata/orders/{customTdataOrder}/download" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"

GiftCards

Gift card catalog and wallet checkout

GET /api/v1/catalog/gift-cards/categories عمومی

List gift card categories

پاسخ‌ها

  • 200 Categories available GiftCardCategoriesResponse
  • {
        "ok": true,
        "message": "string",
        "markup_percent": 1,
        "categories": [
            {
                "category_id": "string",
                "name": "string",
                "note": "string",
                "image_url": "string",
                "slug": "string"
            }
        ]
    }
  • 503 Gift cards catalog unavailable GiftCardCategoriesResponse
  • {
        "ok": true,
        "message": "string",
        "markup_percent": 1,
        "categories": [
            {
                "category_id": "string",
                "name": "string",
                "note": "string",
                "image_url": "string",
                "slug": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/gift-cards/categories" \
  -H "Accept: application/json"
GET /api/v1/catalog/gift-cards/categories/{categoryId} عمومی

Gift card offers in one category

پارامترها

نام محل نوع اجباری توضیح
categoryId path string بله —

پاسخ‌ها

  • 200 Category with offers GiftCardCategoryResponse
  • {
        "ok": true,
        "category": {
            "category_id": "string",
            "name": "string",
            "note": "string",
            "image_url": "string",
            "offers": [
                {
                    "card_id": "string",
                    "name": "string",
                    "retail_price_usd": 1,
                    "price_credits": 1,
                    "wallet_price": "string",
                    "stock": 1,
                    "min_qty": 1,
                    "max_qty": 1
                }
            ]
        }
    }
  • 404 Category not found
  • 503 Gift cards catalog unavailable

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/catalog/gift-cards/categories/{categoryId}" \
  -H "Accept: application/json"
POST /api/v1/gift-cards/checkout توکن Bearer

Buy a gift card (wallet debit)

Debits the token owner's wallet and fulfills via the gift-card supplier. If balance is short, returns 202 with awaiting_payment: true (no debit yet).

بدنه درخواست GiftCardCheckoutRequest

{
    "category_id": "steam-us",
    "card_id": "steam-10",
    "quantity": 1
}

پاسخ‌ها

  • 201 Paid / fulfilling GiftCardCheckoutResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_kind": "gift_card",
            "status": "completed",
            "status_label": "string",
            "category_id": "string",
            "card_id": "string",
            "product_name": "string",
            "product_image_url": "string",
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "string",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "string",
            "codes": [
                "string"
            ],
            "placed_via_api": true,
            "created_at": "string"
        },
        "payment": {}
    }
  • 202 Awaiting wallet top-up GiftCardCheckoutResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_kind": "gift_card",
            "status": "completed",
            "status_label": "string",
            "category_id": "string",
            "card_id": "string",
            "product_name": "string",
            "product_image_url": "string",
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "string",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "string",
            "codes": [
                "string"
            ],
            "placed_via_api": true,
            "created_at": "string"
        },
        "payment": {}
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Insufficient balance (hard fail paths)
  • 422 Validation / invalid offer / out of stock
  • 503 Gift cards unavailable

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/gift-cards/checkout" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "category_id": "steam-us",
    "card_id": "steam-10",
    "quantity": 1
}'
GET /api/v1/gift-cards/orders توکن Bearer

List gift card orders

پارامترها

نام محل نوع اجباری توضیح
limit query integer خیر —

پاسخ‌ها

  • 200 پاسخ GiftCardOrdersListResponse
  • {
        "ok": true,
        "orders": [
            {
                "id": 1,
                "order_number": "string",
                "product_kind": "gift_card",
                "status": "completed",
                "status_label": "string",
                "category_id": "string",
                "card_id": "string",
                "product_name": "string",
                "product_image_url": "string",
                "quantity": 1,
                "price_charged_credits": 1,
                "price_usd_display": "string",
                "wallet_debited": true,
                "awaiting_payment": true,
                "remaining_credits": 1,
                "remaining_usd_display": "string",
                "codes": [
                    "string"
                ],
                "placed_via_api": true,
                "created_at": "string"
            }
        ]
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/gift-cards/orders" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/gift-cards/orders/{fazerCardsOrder} توکن Bearer

Get one gift card order

Syncs supplier status while processing. Completed orders include codes.

پارامترها

نام محل نوع اجباری توضیح
fazerCardsOrder path integer بله —

پاسخ‌ها

  • 200 پاسخ
  • {
        "ok": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_kind": "gift_card",
            "status": "completed",
            "status_label": "string",
            "category_id": "string",
            "card_id": "string",
            "product_name": "string",
            "product_image_url": "string",
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "string",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "string",
            "codes": [
                "string"
            ],
            "placed_via_api": true,
            "created_at": "string"
        }
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found or not owned by this user

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/gift-cards/orders/{fazerCardsOrder}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
GET /api/v1/gift-cards/orders/{fazerCardsOrder}/payment توکن Bearer

Gift card pending-payment status

پارامترها

نام محل نوع اجباری توضیح
fazerCardsOrder path integer بله —

پاسخ‌ها

  • 200 Remaining amount and can_complete flag
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 404 Not found

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/v1/gift-cards/orders/{fazerCardsOrder}/payment" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/gift-cards/orders/{fazerCardsOrder}/payment توکن Bearer

Create Cryptomus top-up for pending gift card order

پارامترها

نام محل نوع اجباری توضیح
fazerCardsOrder path integer بله —

پاسخ‌ها

  • 200 Invoice created (`pay_url`) or already can_complete
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 422 Order not awaiting payment
  • 503 Gateway unavailable

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/gift-cards/orders/{fazerCardsOrder}/payment" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/gift-cards/orders/{fazerCardsOrder}/complete توکن Bearer

Complete pending gift card order after top-up

پارامترها

نام محل نوع اجباری توضیح
fazerCardsOrder path integer بله —

پاسخ‌ها

  • 201 Debited and fulfilled (or processing) GiftCardCheckoutResponse
  • {
        "ok": true,
        "awaiting_payment": true,
        "order": {
            "id": 1,
            "order_number": "string",
            "product_kind": "gift_card",
            "status": "completed",
            "status_label": "string",
            "category_id": "string",
            "card_id": "string",
            "product_name": "string",
            "product_image_url": "string",
            "quantity": 1,
            "price_charged_credits": 1,
            "price_usd_display": "string",
            "wallet_debited": true,
            "awaiting_payment": true,
            "remaining_credits": 1,
            "remaining_usd_display": "string",
            "codes": [
                "string"
            ],
            "placed_via_api": true,
            "created_at": "string"
        },
        "payment": {}
    }
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 402 Still insufficient balance
  • 422 Invalid state

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/gift-cards/orders/{fazerCardsOrder}/complete" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"
POST /api/v1/gift-cards/orders/{fazerCardsOrder}/cancel توکن Bearer

Cancel a gift card order

پارامترها

نام محل نوع اجباری توضیح
fazerCardsOrder path integer بله —

پاسخ‌ها

  • 200 Cancelled (or refunded if already debited)
  • 401 پاسخ Unauthorized
  • {
        "message": "Invalid API token."
    }
  • 422 Cancel not allowed

نمونه cURL

curl -sS -X POST "https://www.gramnumber.com/api/v1/gift-cards/orders/{fazerCardsOrder}/cancel" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer gn_<your_token>"

Legacy

Backwards-compatible storefront JSON

GET /api/shop/telegram/stars عمومی

Telegram Stars catalog (legacy path; same JSON as /api/v1/catalog/telegram/stars)

پاسخ‌ها

  • 200 پاسخ TelegramStarsCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "display_name": "string",
        "unit_price_usd": "$0.01",
        "min_custom_quantity": 49,
        "allows_custom_quantity": true,
        "unit_price_credits": 1,
        "preset_quantities": [
            50,
            75,
            100,
            150,
            250,
            350,
            500,
            750,
            1000,
            1500,
            2500,
            5000
        ],
        "packs": [
            {
                "quantity": 1,
                "price_credits": 1,
                "price_usd_display": "$5.00"
            }
        ]
    }
  • 503 پاسخ TelegramStarsCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "display_name": "string",
        "unit_price_usd": "$0.01",
        "min_custom_quantity": 49,
        "allows_custom_quantity": true,
        "unit_price_credits": 1,
        "preset_quantities": [
            50,
            75,
            100,
            150,
            250,
            350,
            500,
            750,
            1000,
            1500,
            2500,
            5000
        ],
        "packs": [
            {
                "quantity": 1,
                "price_credits": 1,
                "price_usd_display": "$5.00"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/shop/telegram/stars" \
  -H "Accept: application/json"
GET /api/shop/telegram/premium عمومی

Telegram Premium catalog (legacy path; same JSON as /api/v1/catalog/telegram/premium)

پاسخ‌ها

  • 200 پاسخ TelegramPremiumCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "plans": [
            {
                "months": 1,
                "price_credits": 1,
                "price_usd": 1,
                "price_usd_display": "string",
                "wallet_price_display": "string"
            }
        ]
    }
  • 503 پاسخ TelegramPremiumCatalogResponse
  • {
        "ok": true,
        "message": "string",
        "plans": [
            {
                "months": 1,
                "price_credits": 1,
                "price_usd": 1,
                "price_usd_display": "string",
                "wallet_price_display": "string"
            }
        ]
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/shop/telegram/premium" \
  -H "Accept: application/json"
GET /api/shop/services عمومی

List all public services (legacy path; same JSON as /api/v1/catalog/services)

Use this endpoint when /api/v1/catalog/services is unavailable. Returns Telegram (Ozvinoo) plus 5sim products such as sim_whatsapp and sim_instagram. Fetch prices per service via GET /api/shop/{service}/prices or /api/v1/catalog/services/{service}/prices.

پاسخ‌ها

  • 200 Non-empty catalog CatalogServicesResponse
  • {
        "ok": true,
        "message": "string",
        "services": [
            {}
        ],
        "featured": {
            "primary": [
                {}
            ],
            "more": [
                {}
            ]
        },
        "irr_per_usd": 1,
        "markup_percent": 1
    }
  • 503 Upstream unavailable and no cached services ErrorResponse
  • {
        "ok": false,
        "message": "string"
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/shop/services" \
  -H "Accept: application/json"
GET /api/shop/{service}/prices عمومی

Same as catalog prices (legacy path for storefront)

پارامترها

نام محل نوع اجباری توضیح
service path string بله —

پاسخ‌ها

  • 200 پاسخ PricesResponse
  • {
        "ok": true,
        "message": "string",
        "rows": [
            {
                "country": "string",
                "range": "string",
                "count": "string",
                "base_price": 1,
                "price": 1,
                "usd": 1
            }
        ],
        "markup_percent": 1,
        "irr_per_usd": 1
    }

نمونه cURL

curl -sS -X GET "https://www.gramnumber.com/api/shop/{service}/prices" \
  -H "Accept: application/json"