Buyer Automation API

Main bot wallet API, version 1.2.0. Safe for reseller automation with per-user controls.

Quick Links

Base URL: https://rexoprime.com

Swagger UI: https://rexoprime.com/api/swagger/

OpenAPI JSON: https://rexoprime.com/api/telegram-buyer/openapi.json

If you are new: read this page first, then use Swagger to run real test calls.

API Source Setup

Use this exact base URL in reseller panels:

https://rexoprime.com

A tgb_... key issued by Rexo Prime AI Tool Shop only validates on https://rexoprime.com. Do not send it to any other site.

External panel fieldValue
API nameRexo Prime AI Tool Shop
Base URLhttps://rexoprime.com
ProductsGET /api/telegram-buyer/products
BalanceGET /api/telegram-buyer/balance
PurchasePOST /api/telegram-buyer/purchase
OverridesGET/PUT/DELETE /api/telegram-buyer/products/<id>/overrides

Browser integrations are supported. CORS is enabled for buyer API routes only.

How It Works

  1. Buyer opens main bot profile and taps API Link.
  2. Buyer gets private key like tgb_....
  3. Buyer funds wallet first (API purchase uses wallet only).
  4. Client app calls products, balance, and purchase endpoints using that key.
  5. Purchase uses wallet balance only and obeys stock, limits, and custom pricing.
  6. Only automatic-delivery products are sold through the API. Manual-delivery products are not listed, and buying one returns 403 (manual_delivery_not_available).
  7. Telegram Premium and Telegram Stars are delivered automatically, usually within a few minutes. Send the recipient's Telegram username with the order as username, for example {"product_id": 123, "quantity": 500, "username": "@recipient"}. For Stars, quantity is the number of Stars (minimum 50); Premium is one per order. Without a usable username the call returns 400 (telegram_username_required) and nothing is charged. An order that cannot be delivered automatically is handled by the shop's team: it is delivered by hand, or cancelled and refunded to your balance, and the order status says so. Until then it stays in progress. These products are sold at the list price: the API discount does not apply to them.
  8. Products activated on the buyer's own account (an email address, a profile or post link, a username, a country) are automatic too. In the product list they have requiresCustomerDetails: true, and customer_details_prompt is the question to show your customer. Send the answer with the order, for example {"product_id": 255, "quantity": 1, "customer_payload": {"custom_details": "buyer@gmail.com"}}. The answer is checked before anything is charged: without it the call returns 400 (custom_details_required); an email without @ returns custom_details_invalid_email; a link that is not the full link returns custom_details_invalid_link. Send exactly what your customer typed: a typing mistake cannot be undone after delivery.

Allowed product browse, own balance check, own wallet purchases.

Blocked admin data, other users, seller products, bypass attempts.

Authentication

You can send the buyer key in one of these ways:

MethodExample
Query?key=tgb_xxx
Query alias?api_key=tgb_xxx, ?apiKey=tgb_xxx, or ?token=tgb_xxx
HeaderX-API-Key: tgb_xxx
BearerAuthorization: Bearer tgb_xxx

Key is tied to one buyer account. Rotate if leaked.

Endpoints

1) List products

GET /api/telegram-buyer/products

Optional query params: category_id, q

Returns only main-bot products the key owner can buy.

2) Wallet balance

GET /api/telegram-buyer/balance

Returns wallet + totals + effective API profile settings.

3) Purchase

POST /api/telegram-buyer/purchase

JSON body fields:

FieldRequiredTypeDescription
key / api_keyyesstringBuyer API key. You can also send it as a header.
product_idyesinteger/stringMain product ID from the products endpoint. Numeric strings are accepted.
quantitynointegerDefault 1, must pass user + product limits.
client_order_idnostringYour external reference for reconciliation.
resell_unit_pricenonumberOptional reseller metadata, allowed only when enabled for that API user.
emailsseat onlyarray/stringSeat products require exactly one email per quantity. Alias: customer_email.
target_telegram_idpremium onlyinteger/stringTelegram Premium recipient numeric Telegram user ID. Best for Bot Stars delivery.
target_username / usernamepremium onlystringTelegram Premium recipient @username. Best for LegalKeys third-party API delivery.

Per-user policy can also block purchase by daily spend limit, product allowlist, discount/commission profile, or purchase-disabled flag.

Order status

GET /api/telegram-buyer/order/{order_id}

Check an order after purchase. Read delivery_status and stop polling once final is true.

delivery_statusfinalMeaning
processingfalsePaid; automatic delivery is in progress. Poll again after poll_after_seconds.
manualfalsePaid; waiting for manual delivery. Poll again later.
deliveredtrueDone. The goods are in delivered_items / deliveredAccounts.
failedtrueThe order will not be delivered. Treat it as cancelled on your side.

For a failed order, refunded is true when the money went back to your balance, with refund_amount and refunded_at. message carries a short explanation you can show to your staff. A failed order never becomes delivered later, so do not retry it: place a new order if you still need the product.

4) Product overrides (your own naming & pricing)

Customise what your API returns for each main-catalog product — your own name, description, flat price, and bulk (quantity) pricing. Overrides apply everywhere (this API, the bot, the website, and the Mini App).

MethodEndpointPurpose
GET/api/telegram-buyer/products/<id>/overridesYour override + the main bot defaults.
PUT/api/telegram-buyer/products/<id>/overridesSet/update (also POST / PATCH).
DELETE/api/telegram-buyer/products/<id>/overridesClear all overrides for this product.
GET/api/telegram-buyer/overridesList all your overrides in one call.

PUT / POST / PATCH JSON body — all optional; omit a key to leave it unchanged, send "" to clear:

FieldTypeDescription
custom_namestringYour product name (independent of price). Max 300.
custom_descriptionstringYour product description. Max 4000.
custom_pricenumberFlat price your customers pay. Must be ≥ the base price (mark-up only). 0/empty = use the shop's price.
custom_bulk_tiersstringYour OWN quantity pricing, one tier per line: 1-9 -> 4.50 (also 10+ -> 3.50, exact 5 -> 4.00). Every tier ≥ the base price. Empty = no bulk override.

Pricing precedence: your bulk tiers > your flat price > the shop's own pricing (the shop's own bulk tiers apply automatically when you set no override). A price/tier below base is rejected (below_base_price / bulk_below_base); a malformed tier list is rejected (invalid_bulk_tiers). Stock is always live from the catalog.

curl -X PUT "https://rexoprime.com/api/telegram-buyer/products/123/overrides" \
  -H "X-API-Key: tgb_xxxxxxxxx" -H "Content-Type: application/json" \
  -d '{"custom_name":"My Product","custom_bulk_tiers":"1-9 -> 4.50\n10-49 -> 4.00\n50+ -> 3.50"}'

Products Response Fields

Every product includes Rexo Prime AI Tool Shop-native fields and compatibility fields so common reseller panels can read it.

FieldMeaning
product_id, id, _idSame product identifier. Use it in purchase.
name, product_nameProduct title.
price, pricing, walletPricingEffective per-unit API price at quantity 1, after your commission/discount.
base_pricePer-unit price before your API commission/discount.
pricing_modefixed = one price at any quantity. bulk = quantity tiers apply (see promotions).
promotionsQuantity (bulk) price tiers. Array of { type:"bulk_price", minQty, maxQty?, price, label }. For a quantity Q, the per-unit price is the tier with the highest minQty ≤ Q (and Q ≤ maxQty when present); if none match, the base price is used. maxQty is omitted on an open-ended top tier (e.g. 50+). Empty [] when the product has no bulk pricing. Tier price is the base per-unit (before your commission/discount) — the exact charged unit price for your quantity comes back in the purchase response (unit_price).
bulk_tiers_textThe same tiers as human-readable text, one per line (e.g. 1-9 -> 0.60, 10-49 -> 0.55, 50+ -> 0.50). Empty when not a bulk product.
min_purchase_quantity, max_purchase_quantityOrder quantity limits (0 = no limit).
stock, stats.availableAvailable stock.
requiresCustomerEmailTrue for seat/manual-email products.
requiresTelegramUserIdTrue for Telegram Premium products. Send either target_telegram_id or target_username.
delivery_modeAlways automatic: manual-delivery products are not offered through the API.

Sample product with tier (bulk) pricing

The promotions array and bulk_tiers_text already reflect your per-product override when you set one (see Per-product overrides above); otherwise they carry the shop's own bulk pricing.

{
  "product_id": 42,
  "name": "Gemini Pro 18 month 5TB",
  "price": 0.60,
  "base_price": 0.60,
  "pricing_mode": "bulk",
  "bulk_tiers_text": "1-9 -> 0.60\n10-49 -> 0.55\n50+ -> 0.50",
  "promotions": [
    { "type": "bulk_price", "minQty": 1,  "maxQty": 9,  "price": 0.60, "label": "1-9 -> 0.60" },
    { "type": "bulk_price", "minQty": 10, "maxQty": 49, "price": 0.55, "label": "10-49 -> 0.55" },
    { "type": "bulk_price", "minQty": 50,               "price": 0.50, "label": "50+ -> 0.50" }
  ],
  "stock": 733,
  "min_purchase_quantity": 0,
  "max_purchase_quantity": 100,
  "delivery_mode": "automatic"
}

Buying 25 units here charges 0.55/unit (the 10-49 tier). You don't have to compute it — send your quantity to /purchase and the response returns the exact unit_price and totals.

Examples (cURL)

Products

curl -G "https://rexoprime.com/api/telegram-buyer/products" \
  --data-urlencode "key=tgb_xxxxxxxxx"

Products with header auth

curl "https://rexoprime.com/api/telegram-buyer/products" \
  -H "X-API-Key: tgb_xxxxxxxxx"

Balance

curl -G "https://rexoprime.com/api/telegram-buyer/balance" \
  --data-urlencode "key=tgb_xxxxxxxxx"

Purchase

curl -X POST "https://rexoprime.com/api/telegram-buyer/purchase" \
  -H "Content-Type: application/json" \
  -d '{
    "key":"tgb_xxxxxxxxx",
    "product_id":42,
    "quantity":2,
    "client_order_id":"my-order-10021",
    "resell_unit_price":19.99
  }'

Seat product purchase

curl -X POST "https://rexoprime.com/api/telegram-buyer/purchase" \
  -H "Content-Type: application/json" \
  -d '{
    "key":"tgb_xxxxxxxxx",
    "product_id":123,
    "quantity":2,
    "emails":["buyer1@example.com","buyer2@example.com"]
  }'

Examples (Python)

import requests

BASE = "https://rexoprime.com"
KEY = "tgb_xxxxxxxxx"

products = requests.get(
    f"{BASE}/api/telegram-buyer/products",
    params={"key": KEY},
    timeout=20,
).json()

balance = requests.get(
    f"{BASE}/api/telegram-buyer/balance",
    params={"key": KEY},
    timeout=20,
).json()

purchase = requests.post(
    f"{BASE}/api/telegram-buyer/purchase",
    json={
        "key": KEY,
        "product_id": 42,
        "quantity": 1,
        "client_order_id": "erp-5562"
    },
    timeout=25,
).json()

print(products)
print(balance)
print(purchase)

JavaScript / Browser Example

CORS is enabled for buyer API routes, so reseller panels can call the API from a browser app.

const BASE = "https://rexoprime.com";
const KEY = "tgb_xxxxxxxxx";

const products = await fetch(`${BASE}/api/telegram-buyer/products?key=${encodeURIComponent(KEY)}`)
  .then(r => r.json());

const purchase = await fetch(`${BASE}/api/telegram-buyer/purchase`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    key: KEY,
    product_id: products.products[0].product_id,
    quantity: 1,
    client_order_id: "web-order-1001"
  })
}).then(r => r.json());

Response Model

Success:

{
  "success": true,
  "version": "1.2.0",
  "order_id": 1721,
  "product_id": 42,
  "quantity": 1,
  "base_unit_price": 10.0,
  "price_after_commission": 9.5,
  "unit_price": 9.5,
  "commission_percent": 5.0,
  "commission_total": 0.5,
  "discount_percent": 0.0,
  "discount_total": 0.0,
  "new_balance": 120.25
}

Error:

{
  "success": false,
  "message": "Insufficient wallet balance.",
  "status": "insufficient_balance"
}

Status Codes

CodeMeaning
200Success
400Invalid request body or field values
401Invalid key
403Banned user, paused API, forbidden scope, or blocked IP
409Insufficient balance / out-of-stock / limit exceeded
413Request body too large
429Rate limit exceeded
503Buyer API disabled by admin

Security Model

  • Per-user key hashing + usage tracking
  • Main-scope only validation
  • Optional IP allowlist (single IP or CIDR)
  • Per-user read/write rate limits
  • Per-user max order quantity
  • Per-user daily spend cap
  • Per-user discount and commission control
  • Per-user allowed product IDs
  • Per-user purchase endpoint ON/OFF
  • Server-side stock and wallet atomic checks
  • No admin actions on this API surface

No API is absolutely attack-proof. Keep strict user limits, rotate keys, and monitor API logs in admin.

FAQ

Can reseller/API users increase selling price?

Yes. They can resell externally at any price. Optionally they may send resell_unit_price metadata if admin enabled it for that user. Markup cap is admin-controlled.

Do they need to add balance first?

Yes. Purchases only use wallet balance already in the main bot account.

Can this API access seller-bot products?

No. This API is main bot only.

Why does an external panel say “invalid API key”?

Most common cause: the base URL is wrong. Use https://rexoprime.com, not another provider domain. If the URL is correct, check that the API key is copied exactly and that the user is not paused, banned, IP-blocked, or rate-limited.