API Reference

The Topup Bot API lets you place automated Free Fire diamond top-up orders, track their status, and receive delivery confirmations via webhook. All requests and responses are JSON.

Authentication

Every API request (except /api/v1/register) requires your API key as a Bearer token:

Authorization: Bearer sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Your API key is issued when your merchant account is approved. Keep it secret — anyone with your key can place orders against your wallet balance.

Create a merchant account

POST/api/v1/register

Public endpoint — no authentication required. Creates a merchant account with status: pending. An admin must approve it before you can log in or place orders.

FieldTypeNotes
business_namerequiredstringYour business or store name
usernamerequiredstring3-32 chars, letters/numbers/underscore/dot — used to log in at /dashboard
passwordrequiredstringAt least 8 characters — used to log in at /dashboard
contact_emailstringAt least one of email / telegram is required
contact_telegramstringYour Telegram username
unipin_emailstringOptional — can be added later by admin during approval
unipin_passwordstringOptional
unipin_pinstringOptional
// Response 200
{
  "success": true,
  "message": "Application submitted. An admin will review it shortly…",
  "api_key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
The api_key is for authenticating API requests only (Bearer token). Dashboard login (/dashboard) uses your username and password, not the API key.

Dashboard login

POST/api/v1/client/login

Logs a merchant into the dashboard portal. Sets an HttpOnly session cookie.

POST /api/v1/client/login
{ "username": "nepaltopup", "password": "••••••••" }

Reveal your API key

GET/api/v1/api-key

Session-authenticated (dashboard cookie) or Bearer token. Returns your current raw API key on demand, so you can copy it into an integration without it being shown anywhere by default.

Create a top-up order

POST/api/v1/topup

Queues a diamond top-up order for automated fulfillment. Rate-limited per your plan's rate_limit_per_min (default 10/min).

FieldTypeNotes
order_idrequiredstringYour own unique order reference
player_idrequiredstringFree Fire player ID to deliver to
diamond_amountrequiredstringe.g. "115", "weekly", "monthly"
callback_urlstringWebhook URL for delivery confirmation (falls back to your saved default)
POST /api/v1/topup
{
  "order_id": "ORD1001",
  "player_id": "123456789",
  "diamond_amount": "115",
  "callback_url": "https://yoursite.com/webhook"
}

// Response 200
{
  "message": "Order accepted and queued",
  "jobId": "ORD-xxxxxxxx-ORD1001",
  "service_fee_charged": 115,
  "remaining_balance": 4885
}

Get wallet balance

GET/api/v1/balance

Returns your current wallet balance, fee percentage, and webhook secret.

List recent orders

GET/api/v1/orders

Returns your most recent orders (up to 50).

Get order status

GET/api/v1/orders/:orderId

Poll a specific order's fulfillment status by your order_id.

Retry a failed order

POST/api/v1/orders/:orderId/retry

Re-queues a previously failed order for another fulfillment attempt.

Webhook callbacks

When an order completes or fails, Topup Bot sends a signed POST to your callback_url:

// Success
{ "order_id": "ORD1001", "status": "completed", "message": "Delivered 115 diamonds", "receipt_url": "https://…" }

// Failure (credits are automatically refunded)
{ "order_id": "ORD1001", "status": "failed", "message": "…reason…", "receipt_url": null }

Every webhook includes an HMAC-SHA256 signature so you can verify it came from Topup Bot:

x-bot-signature: <hex hmac>
x-signature-sha256: <hex hmac>

// Verify (Node.js example)
const expected = crypto.createHmac('sha256', YOUR_WEBHOOK_SECRET)
  .update(JSON.stringify(req.body)).digest('hex');
if (expected !== req.headers['x-bot-signature']) throw new Error('Invalid signature');
Webhooks are retried up to 5 times with exponential backoff (15s → 30s → 60s → 120s → 240s) if your endpoint doesn't respond with a 2xx status.

Common error responses

StatusMeaning
400Invalid or missing request fields
401Missing or invalid API key
402Insufficient wallet balance
403Account pending approval / inactive / IP not whitelisted
409Order with this order_id already exists
429Rate limit exceeded

Need help integrating? Get in touch via the homepage.