01 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.
| Header | Type | Description |
|---|---|---|
X-API-KeyRequired | string | Your secret reseller API key (sk_live_…, or sk_test_… for the sandbox). |
curl -H "X-API-Key: sk_live_your_secret_key" \
https://s-ai.live/api/v1/me02 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.
| Header | Description |
|---|---|
X-RateLimit-Limit | Allowed requests per 60-second window (60). |
X-RateLimit-Remaining | Remaining requests in the current window. |
X-RateLimit-Reset | Unix 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: 178894442403 Guarantees
Atomic settlement & zero-debit idempotency
1. Single-commit atomic settlement
Wallet 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 stock
If 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 andorder.failed.
04 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
- —Will queue
Uses the key entered in the console.
The price calculator needs JavaScript. Use GET /quote for the same numbers.
05 Reference
Endpoints
All paths are relative to https://s-ai.live and answer in JSON.
- GET/api/v1/products
- GET/api/v1/me
- GET/api/v1/quote
- POST/api/v1/order
- GET/api/v1/stats
- GET/api/v1/order/{order_id}
- GET/api/v1/orders
- GET/api/v1/orders/export
- POST/api/v1/topup
- POST/api/v1/keys/rotate
GET/api/v1/products
List available products
Returns the live catalogue with available stock per product. input_type is quantity (buy N units) or accounts (send one line per unit in items; input_hint shows the format). 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
curl -X GET "https://s-ai.live/api/v1/products" \
-H "X-API-Key: YOUR_API_KEY"Python
import requests
r = requests.get("https://s-ai.live/api/v1/products",
headers={"X-API-Key": "YOUR_API_KEY"}, timeout=15)
print(r.json())Node.js
const r = await fetch("https://s-ai.live/api/v1/products",
{ headers: { "X-API-Key": "YOUR_API_KEY" } });
console.log(await r.json());{
"currency": "USD",
"rate": "1 USD = 100 INR (fixed)",
"products": [
{
"service_id": "gemini_pro_1m",
"name": "Gemini Pro 1 Month",
"description": "",
"input_type": "quantity",
"input_hint": "",
"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://s-ai.live/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 param | Type | Description |
|---|---|---|
service_idRequired | string | Product identifier. |
quantityRequired | integer | Desired units. |
curl -H "X-API-Key: YOUR_API_KEY" \
"https://s-ai.live/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 field | Type | Description |
|---|---|---|
service_idRequired | string | Target product id. |
quantityRequired* | integer | Number of units. *Not needed when you send items — the line count is the quantity. |
itemsConditional | array | Required for services with "input_type": "accounts": one customer-supplied line per unit, e.g. email|password|2fa_secret (max 100). The catalogue's input_hint gives the exact shape. Lines the supplier rejects are refunded to your wallet automatically. |
external_order_idOptional | string | Your internal idempotency key (≤128 chars) to prevent double debiting. |
accept_normal_priceOptional | boolean | Set true to override the low-stock buffer protection (409). |
cURL
curl -X POST "https://s-ai.live/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"}'Python
import requests
r = requests.post("https://s-ai.live/api/v1/order",
headers={"X-API-Key": "YOUR_API_KEY"},
json={"service_id": "gemini_pro_1m", "quantity": 2, "external_order_id": "bot_order_99812"},
timeout=30)
data = r.json()
if r.status_code in (200, 201):
print(data["order_id"], data["status"], data["products"])
else:
print("error:", data["error"], data["message"])Node.js
const r = await fetch("https://s-ai.live/api/v1/order", {
method: "POST",
headers: { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ service_id: "gemini_pro_1m", quantity: 2, external_order_id: "bot_order_99812" })
});
const data = await r.json();Account-based services (input_type: "accounts") — send the lines instead of a quantity:
curl -X POST "https://s-ai.live/api/v1/order" \
-H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{
"service_id": "extract_12m",
"items": ["budi@gmail.com|Passw0rd!|JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP"],
"external_order_id": "bot_order_99813"
}'Each delivered code is labelled with its account. Passwords and 2FA secrets are never echoed back: responses show "items": ["budi@gmail.com|••••|••••"].
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://s-ai.live/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://s-ai.live/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 param | Type | Default | Description |
|---|---|---|---|
pageOptional | integer | 1 | Page number. |
limitOptional | integer | 20 | Orders per page (up to 50). |
statusOptional | string | — | Filter: delivered / queued / failed. |
curl -H "X-API-Key: YOUR_API_KEY" "https://s-ai.live/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 param | Type | Description |
|---|---|---|
formatOptional | string | csv or json (default json). |
startOptional | string | ISO 8601 start timestamp. |
endOptional | string | ISO 8601 end timestamp. |
curl -H "X-API-Key: YOUR_API_KEY" \
"https://s-ai.live/api/v1/orders/export?format=csv" -o orders_export.csvPOST/api/v1/topupEnabled · USDT · BEP20
Add funds (crypto)
Opens a SYNQ Pay Express checkout for your account. Send the amount to the address shown there; your wallet is credited automatically (minus the gateway fee) the moment the payment confirms — no support ticket, no waiting.
| Body field | Type | Description |
|---|---|---|
amountRequired | number | USD amount to add (the minimum and maximum are set by the shop). |
curl -X POST "https://s-ai.live/api/v1/topup" \
-H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"amount": 50}'{ "deposit_id": 12, "invoice_number": "INV-7QW2…", "checkout_url": "https://pay.synqapi.co/pay/INV-7QW2…",
"amount": 50.0, "status": "pending", "asset": "USDT", "network": "BEP20", "currency": "USD",
"message": "Send the exact amount to the checkout address. Your wallet is credited automatically once the payment confirms." }GET /api/v1/topup/{deposit_id} re-checks one payment with the gateway and returns its status plus your new balance; GET /api/v1/topups lists the last 25.
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://s-ai.live/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." }06 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).
{ "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:
Python
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)Node.js
const crypto = require("crypto");
function verifyWebhook(rawBody, signatureHeader, secret) {
const expected = "sha256=" + crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader));
}PHP
$raw = file_get_contents('php://input');
$expected = 'sha256=' . hash_hmac('sha256', $raw, $secret);
$ok = hash_equals($expected, $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '');Respond with any 2xx status within 10 seconds. Anything else is retried.
POST/api/v1/webhooks
Register webhook endpoint
| Field | Type | Description |
|---|---|---|
urlRequired | string | Your HTTPS listener URL (public host; private/loopback addresses are rejected). |
eventsRequired | array | Any of order.delivered, order.queued, order.failed. |
curl -X POST "https://s-ai.live/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://s-ai.live/api/v1/webhooksDELETE/api/v1/webhooks/{id}
Delete webhook endpoint
curl -X DELETE "https://s-ai.live/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://s-ai.live/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 } ] }07 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.
{"status": "Ready", "message": "Click Execute request to test this endpoint."}
The interactive console needs JavaScript. Every request above also works from cURL.
08 Status codes
Error reference catalog
Errors are JSON: {"error": "<key>", "message": "<human text>"}.
| Code | Error key | Cause & remediation |
|---|---|---|
| 400 | invalid_json | Malformed request body. Ensure a valid JSON payload. |
| 400 | missing_parameter | Missing mandatory fields such as service_id or quantity. |
| 400 | invalid_parameter | A field has the wrong type or range (e.g. quantity not a positive integer). |
| 400 | invalid_url | Webhook URL is not an absolute public http(s) URL. |
| 401 | missing_api_key | The X-API-Key header was omitted. |
| 401 | invalid_api_key | The key was revoked, disabled, or does not exist. |
| 402 | insufficient_balance | Wallet balance is below the order total. Top up to proceed (required and balance are included). |
| 404 | unknown_service | Requested service_id is not in the catalogue (or is currently disabled). |
| 409 | service_unavailable | The supplier has this service closed right now. Nothing was charged; retry later. |
| 404 | unknown_order / unknown_webhook | No such resource belongs to this account. |
| 409 | buffer_stock_conflict | Quantity crosses the low-stock buffer. Resend with "accept_normal_price": true. |
| 429 | rate_limited | 60 requests/min exceeded. Back off until X-RateLimit-Reset. |
| 500 | internal_error | Atomic rollback executed safely. Zero balance was lost. Retry the request (with the same external_order_id). |
| 503 | topup_unavailable | Automatic top-ups are not enabled. Contact support to add funds. |
09 Panels & shops
DHRU Fusion compatible API
Run a DHRU / Fusion style panel? Add S-AI as a supplier with three values — no coding. The same API key works for both APIs; get it from your account.
| Setting | Value |
|---|---|
| API URL | https://s-ai.live/api/index.php (also /api) |
| Username | the email you registered with (shown on your API page) |
| API key | your sk_live_… key |
Actions
| action | What it returns |
|---|---|
accountinfo | AccountInfo.creditraw — your wallet balance in USD. |
serverservicelist / imeiservicelist | The catalogue grouped by category: SERVICEID, SERVICENAME, CREDIT (price per unit), STOCK, MAXQNT. Services that need your own accounts expose a CUSTOM field. |
placeserverorder / placeimeiorder | Parameters ID (SERVICEID) and QNT; account lines go in the custom field. A delivered order answers in the same call with STATUS 4 and the codes in CODE (one per <br>); STATUS 1 = queued, refunded automatically if it cannot be fulfilled. |
getserverorder / getimeiorder | STATUS 4 delivered · 1 pending · 3 rejected (refunded), plus CODE. |
# parameters may be XML (as here), a base64 JSON blob, or plain fields
curl -X POST "https://s-ai.live/api/index.php" \
-d "username=you@example.com" -d "apiaccesskey=sk_live_your_key" \
-d "action=placeserverorder" \
-d "parameters=<PARAMETERS><ID>12</ID><QNT>2</QNT></PARAMETERS>"
# delivered in the same call
{"SUCCESS":[{"MESSAGE":"Order received","REFERENCEID":"ILB3PKQGXQ","STATUS":4,"CODE":"KEY-1<br>KEY-2"}]}Errors come back as {"ERROR":[{"MESSAGE":"…"}]} with HTTP 200, the way Fusion clients expect. Wrong credentials answer Authentication Failed.
10 Releases
API changelog
Production release
September 2026
- Catalogue, account, quote, order, order status, paginated history, CSV/JSON export, analytics.
- Single-commit atomic settlement and
external_order_ididempotent replays. - Queued orders with automatic FIFO fulfilment on restock; cancellation with full refund.
- Webhooks engine (register, list, delete, test ping) with HMAC-SHA256 signatures and retry backoff.
- Self-service key rotation, live
X-RateLimit-*headers, free sandbox environment. - Crypto self-service top-ups through SYNQ Pay Express — wallet credited automatically on confirmation.