v1.0.0
Developer documentation

IMEI Locks Reseller API

Automate purchases of digital products from your bot, panel or script: real-time catalogue and stock, exact price quotes, atomic wallet settlement, instant code delivery, signed webhooks. Base URL: https://api.imeilocks.com

๐Ÿ”‘ Getting a key: open @Gemini_resellerapibot on Telegram โ†’ API key โ†’ Generate. The same bot shows your balance, lets you buy in chat, and handles top-ups.

HTTP headers
Authentication

Every request requires your confidential API secret in the X-API-Key header. Treat your API key as a password: it is stored hashed on our side and is shown exactly once when issued.

HeaderTypeDescription
X-API-KeyREQUIREDstringYour secret reseller API key (sk_live_โ€ฆ, or sk_test_โ€ฆ for the sandbox).
curl -H "X-API-Key: sk_live_your_secret_key" \
  https://api.imeilocks.com/api/v1/me

Quota headers
Rate limits & live quota

Requests are limited to 60 requests per minute per API key. Live budget headers are returned on every response.

HeaderDescription
X-RateLimit-LimitAllowed requests per 60-second window (60).
X-RateLimit-RemainingRemaining requests in the current window.
X-RateLimit-ResetUnix epoch timestamp when your quota refills.
HTTP/1.1 200 OK
Content-Type: application/json
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1788944424

Guarantees
Atomic settlement & zero-debit idempotency

๐Ÿ›ก๏ธ 1. Single-commit atomic settlementWallet deduction, order creation and code assignment execute inside one atomic SQLite transaction (BEGIN IMMEDIATE โ€ฆ COMMIT). If anything fails, funds roll back. You are never debited without an order.
๐Ÿ”„ 2. Idempotent replays (external_order_id)Pass your internal reference in external_order_id. If your connection drops and your bot retries, the API returns the original order with "idempotent_replay": true โ€” zero duplicate debits, zero duplicate orders.
โณ 3. Queue on empty stockIf stock is short, the order is accepted, charged and queued; it is fulfilled automatically (FIFO) the moment stock is added and you receive order.delivered. A queued order we cannot fulfil is cancelled with a full refund and order.failed.

Simulator
Price calculator

Pricing is a flat unit price per product: final_total = unit_price ร— quantity. Preview any order with GET /quote or below (needs a sandbox or live key from the console).

Unit price โ€”Total โ€”INR (1 USD = 100 INR) โ€”Stock โ€”

Endpoints

GET/api/v1/products โ€” List available products

Returns the live catalogue with available stock per product. custom_pricing is true when the product is at or below its low-stock buffer (orders that dip into the buffer must send accept_normal_price: true).

curl -X GET "https://api.imeilocks.com/api/v1/products" \
  -H "X-API-Key: YOUR_API_KEY"

Response (200 OK)

{
  "currency": "USD",
  "rate": "1 USD = 100 INR (fixed)",
  "products": [
    {
      "service_id": "gemini_pro_1m",
      "name": "Gemini Pro 1 Month",
      "description": "",
      "stock": 482,
      "custom_pricing": false,
      "unit_price": 0.5,
      "pricing_tiers": [{ "min": 1, "max": null, "price": 0.5 }],
      "bulk_discounts": []
    }
  ]
}

GET/api/v1/me โ€” Account profile & balance

Returns your account name, Telegram chat id (if linked) and active wallet balance in USD.

curl -H "X-API-Key: YOUR_API_KEY" https://api.imeilocks.com/api/v1/me
{ "chat_id": 123456789, "name": "My Bot", "balance": 145.5, "currency": "USD", "mode": "live", "key_created_at": "2026-09-15T10:00:00Z" }

GET/api/v1/quote โ€” Price quote preview

Validates the exact financials before submission: unit price, total, stock situation and whether your balance is sufficient. Nothing is committed.

Query paramTypeDescription
service_idREQUIREDstringProduct identifier.
quantityREQUIREDintegerDesired units.
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.imeilocks.com/api/v1/quote?service_id=gemini_pro_1m&quantity=500"
{
  "service_id": "gemini_pro_1m",
  "service_name": "Gemini Pro 1 Month",
  "quantity": 500,
  "stock": 482,
  "stock_warning": "Only 482 in stock. The order will be queued and fulfilled automatically once restocked.",
  "currency": "USD",
  "pricing": {
    "unit_price": 0.5, "slab_range": "1+", "base_total": 250.0,
    "bulk_discount_pct": 0, "bulk_discount_amount": 0.0,
    "final_total": 250.0, "price_source": "normal"
  },
  "fx": { "code": "INR", "rate": 100, "final_total": 25000.0 },
  "your_balance": 350.0,
  "sufficient_balance": true
}

POST/api/v1/order โ€” Place automated order

Executes an atomic balance deduction and immediate digital product delivery. Always pass external_order_id for safe zero-duplicate retries.

Body fieldTypeDescription
service_idREQUIREDstringTarget product id.
quantityREQUIREDintegerNumber of units to purchase.
external_order_idOPTIONALstringYour internal idempotency key (โ‰ค128 chars) to prevent double debiting.
accept_normal_priceOPTIONALbooleanSet true to override the low-stock buffer protection (409).
curl -X POST "https://api.imeilocks.com/api/v1/order" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"service_id": "gemini_pro_1m", "quantity": 2, "external_order_id": "bot_order_99812"}'

Response (201 Created) โ€” a replay of an existing external_order_id returns 200 with "idempotent_replay": true. Queued orders return "status": "queued" with an empty products array.

{
  "success": true,
  "order_id": "IL7K3M9QX2",
  "external_order_id": "bot_order_99812",
  "service_id": "gemini_pro_1m",
  "service_name": "Gemini Pro 1 Month",
  "quantity": 2,
  "status": "delivered",
  "total_cost": 1.0,
  "new_balance": 144.5,
  "currency": "USD",
  "price_breakdown": { "unit_price": 0.5, "slab_range": "1+", "base_total": 1.0, "bulk_discount_pct": 0, "bulk_discount_amount": 0.0, "final_total": 1.0, "price_source": "normal" },
  "created_at": "2026-09-15T10:00:00Z",
  "delivered_at": "2026-09-15T10:00:00Z",
  "products": ["KEY-GEMINI-A1904-8842", "KEY-GEMINI-B8912-7719"],
  "idempotent_replay": false
}

GET/api/v1/stats โ€” Reseller account analytics

Order counts and USD spend for today, 7d, 30d and all-time, plus a per-product breakdown. Optional start / end (ISO 8601) add a range block and filter the breakdown.

curl -H "X-API-Key: YOUR_API_KEY" "https://api.imeilocks.com/api/v1/stats?start=2026-09-01&end=2026-09-30"
{
  "orders":   { "today": 4, "7d": 28, "30d": 142, "all_time": 680 },
  "spending": { "today": 2.8, "7d": 18.2, "30d": 84.5, "all_time": 395.0 },
  "currency": "USD",
  "balance": 145.5,
  "range": { "start": "2026-09-01T00:00:00Z", "end": "2026-09-30T00:00:00Z", "orders": 140, "spending": 83.0 },
  "products_breakdown": [
    { "service_id": "gemini_pro_1m", "name": "Gemini Pro 1 Month", "orders": 120, "quantity_ordered": 540, "total_spent": 243.0 }
  ]
}

GET/api/v1/order/{order_id} โ€” Single order status & codes

Fetches status, timestamps and delivered codes for any previous order by its order_id (your external_order_id is accepted too).

curl -H "X-API-Key: YOUR_API_KEY" https://api.imeilocks.com/api/v1/order/IL7K3M9QX2
{
  "order_id": "IL7K3M9QX2", "external_order_id": "bot_order_99812",
  "service_id": "gemini_pro_1m", "service_name": "Gemini Pro 1 Month",
  "quantity": 2, "status": "delivered", "total_cost": 1.0, "currency": "USD",
  "price_breakdown": { โ€ฆ },
  "created_at": "2026-09-15T10:00:00Z", "delivered_at": "2026-09-15T10:00:00Z",
  "products": ["KEY-GEMINI-A1904-8842", "KEY-GEMINI-B8912-7719"]
}

Statuses: delivered (codes assigned), queued (charged, awaiting restock), failed (cancelled and fully refunded; see failed_reason).

GET/api/v1/orders โ€” Paginated order history

Query paramTypeDefaultDescription
pageOPTIONALinteger1Page number.
limitOPTIONALinteger20Orders per page (up to 50).
statusOPTIONALstringโ€”Filter: delivered / queued / failed.
curl -H "X-API-Key: YOUR_API_KEY" "https://api.imeilocks.com/api/v1/orders?page=1&limit=20"
{
  "page": 1, "limit": 20, "total": 1, "has_more": false, "currency": "USD",
  "orders": [
    { "order_id": "IL7K3M9QX2", "external_order_id": "bot_order_99812", "service_id": "gemini_pro_1m",
      "service_name": "Gemini Pro 1 Month", "quantity": 2, "total_cost": 1.0, "status": "delivered",
      "created_at": "2026-09-15T10:00:00Z", "delivered_at": "2026-09-15T10:00:00Z" }
  ]
}

GET/api/v1/orders/export โ€” Bulk order export (CSV / JSON)

Query paramTypeDescription
formatOPTIONALstringcsv or json (default json).
startOPTIONALstringISO 8601 start timestamp.
endOPTIONALstringISO 8601 end timestamp.
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.imeilocks.com/api/v1/orders/export?format=csv" -o orders_export.csv

POST/api/v1/keys/rotate โ€” Self-service key rotation

Instantly revokes your existing key and issues a new secret. The previous key stops working immediately.

curl -X POST "https://api.imeilocks.com/api/v1/keys/rotate" -H "X-API-Key: YOUR_OLD_API_KEY"
{ "success": true, "new_api_key": "sk_live_9f83a04b12c8e9fโ€ฆ", "message": "Your old key has been revoked. Store this new key securely." }

Real-time webhooks
Architecture & cryptographic verification

Webhooks remove polling. Whenever an order is delivered, queued or fails, we push a signed HTTPS POST to your endpoint (retried with backoff for up to 6 attempts: 1 m, 5 m, 30 m, 2 h, 6 h).

๐Ÿ”” order.deliveredCodes are assigned and ready for your customer. Payload includes products.
โณ order.queuedStock is pending restock. The order fulfils automatically once restocked.
โš ๏ธ order.failedThe order was cancelled and fully refunded (failed_reason).

Payload

{ "event": "order.delivered", "delivery_id": 41, "created_at": "2026-09-15T10:00:01Z",
  "data": { "order_id": "IL7K3M9QX2", "external_order_id": "bot_order_99812", "status": "delivered", "quantity": 2,
            "total_cost": 1.0, "products": ["KEY-โ€ฆ", "KEY-โ€ฆ"], โ€ฆ } }

HMAC-SHA256 signature verification. Every delivery carries X-Webhook-Signature: sha256=<hex> (plus X-Webhook-Event and X-Webhook-Delivery). Verify with your webhook secret over the raw request body:

import hmac, hashlib

def verify_webhook(raw_payload_bytes, signature_header, webhook_secret):
    expected = "sha256=" + hmac.new(webhook_secret.encode(), raw_payload_bytes, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature_header)

Respond with any 2xx status within 10 seconds. Anything else is retried.

POST/api/v1/webhooks โ€” Register webhook endpoint

FieldTypeDescription
urlREQUIREDstringYour HTTPS listener URL (public host; private/loopback addresses are rejected).
eventsREQUIREDarrayAny of order.delivered, order.queued, order.failed.
curl -X POST "https://api.imeilocks.com/api/v1/webhooks" \
  -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://mybot.com/webhooks/orders", "events": ["order.delivered", "order.queued"]}'
{ "id": 1, "url": "https://mybot.com/webhooks/orders", "events": ["order.delivered", "order.queued"],
  "created_at": "2026-09-15T10:00:00Z", "active": true,
  "secret": "9a38f7b2c01824d67e89ab32c10f8231e57c6โ€ฆ",
  "note": "Store this secret securely โ€” use it to verify webhook signatures (X-Webhook-Signature)." }

GET/api/v1/webhooks โ€” List registered webhooks

curl -H "X-API-Key: YOUR_API_KEY" https://api.imeilocks.com/api/v1/webhooks

DELETE/api/v1/webhooks/{id} โ€” Delete webhook endpoint

curl -X DELETE "https://api.imeilocks.com/api/v1/webhooks/1" -H "X-API-Key: YOUR_API_KEY"
{ "deleted": true, "id": 1 }

POST/api/v1/webhooks/test โ€” Test delivery ping

Sends an instant signed test event to all your registered webhooks and returns the HTTP status each returned.

curl -X POST "https://api.imeilocks.com/api/v1/webhooks/test" \
  -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" -d '{"event": "order.delivered"}'
{ "event": "order.delivered", "test_results": [ { "webhook_id": 1, "url": "https://mybot.com/webhooks/orders", "status": 200, "success": true } ] }

Interactive developer console
Execute real and simulated requests

The sandbox gives you a free sk_test_ key with a $50.00 wallet: orders deliver SANDBOX-* codes and never touch live stock. Switch to live and paste your own key to hit production.

Wallet โ€”Orders created 0
{"status": "Ready", "message": "Click Execute request to test this endpoint."}

Status codes
Error reference catalog

Errors are JSON: {"error": "<key>", "message": "<human text>"}.

CodeError keyCause & remediation
400invalid_jsonMalformed request body. Ensure a valid JSON payload.
400missing_parameterMissing mandatory fields such as service_id or quantity.
400invalid_parameterA field has the wrong type or range (e.g. quantity not a positive integer).
400invalid_urlWebhook URL is not an absolute public http(s) URL.
401missing_api_keyThe X-API-Key header was omitted.
401invalid_api_keyThe key was revoked, disabled, or does not exist.
402insufficient_balanceWallet balance is below the order total. Top up to proceed (required and balance are included).
404unknown_serviceRequested service_id is not in the catalogue.
404unknown_order / unknown_webhookNo such resource belongs to this account.
409buffer_stock_conflictQuantity crosses the low-stock buffer. Resend with "accept_normal_price": true.
429rate_limited60 requests/min exceeded. Back off until X-RateLimit-Reset.
500internal_errorAtomic rollback executed safely. Zero balance was lost. Retry the request (with the same external_order_id).

Releases
API changelog

v1.0.0 โ€” Production release (September 2026)

ยฉ 2026 IMEI Locks ยท Reseller API v1.0.0 ยท Telegram: @Gemini_resellerapibot