API online·Base URL https://api.aistocks.storeReseller API v1 · updated 01 Dec 2026
AI StocksAPI Docs
Quick startGet API access
Reseller API · v1Live catalogue & stock

Sell the AI Stocks catalogue from your own shop.

Read products at your prices, place prepaid orders and deliver the result to your buyer — including products that need details from your buyer, such as a redeem code or an email address.

  • Prepaid in exact cents
  • Retry-safe orders
  • Instant & manual delivery
🌐
🔑
Bearer API keyOne key per reseller account
⚡
JSON · USD cents120 requests / minute

🚀Quick start

Get your API key on the AI Stocks Reseller Portal (or in the Telegram bot), then make four calls. Base URL: https://api.aistocks.store

1. Check your keyGET /v1/ping
2. Load productsGET /v1/products
3. OrderPOST /v1/orders
4. Deliverorder.items
cURL
curl https://api.aistocks.store/v1/products -H "Authorization: Bearer YOUR_API_KEY"

curl -X POST https://api.aistocks.store/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1001" \
  -H "Content-Type: application/json" \
  -d '{"product_id":10,"qty":1}'

Instant products return the delivered items in the same response. Products delivered later answer 202 with status: "pending"; you then check the order until it is delivered (see below).

🔐Authentication

Send your key on every /v1 request, in either header:

Example
Authorization: Bearer YOUR_API_KEY
X-API-Key: YOUR_API_KEY
  • Keys look like aistocks_ followed by 48 hex characters (earlier keys start with qm_live_). The key is shown once when issued — store it on your server only, never in a browser or app.
  • Missing or unknown keys return 401. After 15 failed attempts within 5 minutes your IP is blocked for 15 minutes (429 locked_out).
  • A key belongs to one reseller account and only spends that account's balance. The shop can revoke it at any time.

📐Basics & limits

Format

  • Requests and responses are JSON. Success: {"ok":true,…}. Error: {"ok":false,"error":{"code":"…","message":"…"}}.
  • Money comes twice: exact integer cents (unit_price_cents: 39) and a display string (unit_price: "0.39"). Currency is USD. Calculate with cents.
  • Times are Unix seconds. Request bodies may be up to 32 KB.

Rate limits

  • 120 requests per minute per key, of which at most 20 order attempts.
  • Every authenticated response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the minute resets).
  • Over the limit: 429 rate_limited with a Retry-After header. Wait, then retry.

🛍️Products

GET /v1/products returns every product you can sell, at your price, with live stock. The fields you need:

FieldMeaning
id, name, descriptionProduct identity. Sync by id — names and prices change, ids don't.
unit_price_cents, unit_price, currencyYour price per unit of qty.
delivery_type"auto" = delivered instantly in the order response. Any other value (for example "manual") = delivered later; the order waits as pending.
customer_input_fieldsDetails you must collect from your buyer before ordering (empty list = none). See Products that need customer data.
stock, stock_unlimited, stock_knownHow many units you can order. If stock_unlimited is true the product is available even though stock is 0. If stock_known is false, don't sell it.
min_qty, max_qtyAllowed quantity per order (max_qty: 0 = no maximum).
units_per_itemItems delivered per unit of qty (e.g. 5 = a pack of five accounts).
order_cooldown_secMinimum time between two orders of this product (0 = none).
instructionsPlain-text instructions & terms to give your buyer with the delivery.
preorder_supportedtrue if you may order it while out of stock. See Pre-orders.
Other fields you may see (optional)
product_type, subscription_type, has_warranty, warranty_periodDescriptive information for your product page.
sold_total, your_sold_qty, your_sold_spent_centsSales statistics (shop-wide and yours).
stock_additions, stock_notify_allowedRestock batches, if you announce restocks to your buyers.
emoji, custom_emoji_idDisplay icon.
customer_input_configuration_valid, preorder_*See the sections below.

New fields can be added at any time — ignore fields you don't use.

🛒Placing orders

POST /v1/orders pays for the order from your balance and either delivers it at once or queues it for delivery.

Body fieldRule
product_idREQUIREDProduct id from GET /v1/products.
qtyREQUIREDBetween min_qty and max_qty. You receive qty × units_per_item items.
customer_inputsIF NEEDEDYour buyer's details, when the product has customer_input_fields.
preorderOPTIONALtrue to pre-order an out-of-stock product.

Also send a unique Idempotency-Key header (8–128 characters: letters, digits, _, -) for every new order — see Retries.

HTTPMeaning
201Delivered now — order.items contains everything.
202Paid and waiting for delivery (pending or preorder). Never order again — check the order.
200A retry of an order you already placed (replayed: true).
4xxRefused, nothing charged. See Errors.

🧾Products that need customer data

Some products need details from your buyer — a redeem code, an account email, a username… The product tells you exactly what to ask in customer_input_fields; you pass the answers in customer_inputs. No messages to the shop are needed: the details reach the shop with the order.

1. Read the fieldscustomer_input_fields
2. Ask your buyerrequired first
3. Ordercustomer_inputs
4. Wait & deliver202 → completed

1. Read the fields

JSON
{"id":57,"name":"Example — tokens on your account","delivery_type":"manual",
 "stock":0,"stock_unlimited":true,"unit_price":"0.70",
 "customer_input_fields":[
   {"key":"redeem_code","label":"Your redeem code (6 characters)","type":"text","required":true}
 ],
 "customer_input_configuration_valid":true, …}

Each field has a key (use it unchanged), a label (show it to your buyer), a type and required.

typeAccepted value
textUp to 200 characters.
emailA valid email address (max 254 characters).
phone7–15 digits, optional leading +; spaces are removed.
username3–32 letters, digits, _ or .; a leading @ is removed.

2. Send them with the order

cURL
curl -X POST https://api.aistocks.store/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1002" \
  -H "Content-Type: application/json" \
  -d '{"product_id":57,"qty":1,"customer_inputs":{"redeem_code":"AB12CD"}}'

customer_inputs is one flat object: field key → text value. Leave out optional fields you don't have. One order = one buyer: different buyers need separate orders.

3. The answer

Response
HTTP/1.1 202 Accepted
{"ok":true,
 "order":{"code":"RA-7C1D2E3F4A","status":"pending","delivery_type":"manual",
   "product_id":57,"qty":1,"total_cents":70,"total":"0.70","remaining_qty":1,
   "customer_inputs":[{"key":"redeem_code","label":"Your redeem code (6 characters)","value":"AB12CD", …}],
   "items":[], …},
 "balance_cents":1250,"balance":"12.50"}

The order is paid and waiting for the shop. Tell your buyer it is being processed and follow Order status & delivery.

⚠️ Wrong or missing details are refused before any charge: customer_input_required (a required field is empty), invalid_customer_input (wrong format), unknown_customer_input (a key the product doesn't have — reload the product). Fix it and send again; the same idempotency key may be reused. If customer_input_configuration_valid is false, the product can't be ordered right now (409 input_configuration_error).

📦Order status & delivery

statusMeaningWhat to do
completedDelivered.Give your buyer items[].content and instructions. If refunded_cents > 0, part was refunded — refund your buyer that part.
pendingPaid, waiting for the shop to deliver.Check again later.
preorderPaid, waiting for stock.Check again later; you may cancel it.
refundedCould not be delivered; the full amount is back on your API balance.Refund your buyer. delivery_error may say why.

Waiting for delivery

There are no webhooks: check GET /v1/orders/:code with growing pauses (e.g. every minute, then every few minutes). When delivered:

JSON
{"ok":true,"order":{"code":"RA-7C1D2E3F4A","status":"completed","delivered_qty":1,"remaining_qty":0,
 "items":[{"content":"Tokens added to your account."}],"instructions":"…", …}}
  • items[].content is what you deliver — a credential, a code or a confirmation message. Treat it as private.
  • Large orders can be delivered in parts: items grows while the order stays pending. Forward only the new entries.
  • Delivered-later orders also show delivered_qty, remaining_qty, refunded_cents and closed_at (set when finished).
  • Need to cancel a waiting order? Contact support with the RA-… code. Through the API only pre-orders can be cancelled.

⏳Pre-orders

When preorder_supported is true, you can buy an out-of-stock product now and receive it as soon as stock arrives.

JSON
{"product_id":10,"qty":3,"preorder":true}
  • Answer: 202 with status: "preorder". Items arrive automatically, possibly in parts (preorder_delivery_mode: partial or full).
  • Limits can apply: preorder_max_qty (per order), preorder_max_open_units (open units in total) and preorder_allow_multiple (false = one open pre-order at a time). Over a limit: 409 preorder_limit. 0 means no limit.
  • Without preorder: true, an out-of-stock order is simply refused (409 out_of_stock) — it is never turned into a pre-order.
  • You can cancel the undelivered part at any time: POST /v1/orders/:code/cancel.

🔁Retries & idempotency

A network error does not tell you whether the order went through. The idempotency key makes retrying safe.

  • Create a new key for every new order and save it before sending. Send it as the Idempotency-Key header (or idempotency_key in the body).
  • Retry with the same key and the same body → you get the same order back (200, replayed: true), never a second charge.
  • Same key with a different body → 409 idempotency_key_conflict.
  • A refused request (4xx) creates nothing, so its key can be reused for the corrected request.
  • Lost the response? Look the order up with GET /v1/orders/by-idempotency/:key.
GET/v1/pingCheck your key
cURL
curl https://api.aistocks.store/v1/ping -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"reseller":"Your shop","status":"active","build":"reseller-api v1.4"}

Works even when your account is suspended, so you can see its status.

GET/v1/balanceYour prepaid balance
cURL
curl https://api.aistocks.store/v1/balance -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"balance_cents":961,"balance":"9.61","currency":"USD"}

To top up, contact the shop.

GET/v1/productsAll products
cURL
curl https://api.aistocks.store/v1/products -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"products":[
 {"id":10,"name":"Example account","description":"…","instructions":"Sign in, then keep recovery details unchanged.",
  "delivery_type":"auto","unit_price_cents":39,"unit_price":"0.39","currency":"USD",
  "stock":808,"stock_unlimited":false,"stock_known":true,
  "min_qty":1,"max_qty":0,"units_per_item":1,"order_cooldown_sec":0,
  "customer_input_fields":[],"preorder_supported":false, …}
]}

Not paginated. Inactive, free and unpriceable products are not listed. Field meanings: Products.

GET/v1/products/:idOne product · stock check
cURL
curl https://api.aistocks.store/v1/products/10 -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"product":{"id":10,"name":"Example account","stock":808, …}}

Same fields as in the list. Use it to re-check price, stock and required fields right before an order. Unknown or unavailable ids return 404 product_not_found.

POST/v1/ordersBuy
cURL
curl -X POST https://api.aistocks.store/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-1001" \
  -H "Content-Type: application/json" \
  -d '{"product_id":10,"qty":1}'

HTTP/1.1 201 Created
{"ok":true,
 "order":{"code":"RA-1A2B3C4D5E","idempotency_key":"order-1001","product_id":10,"product_name":"Example account",
   "qty":1,"units_per_item":1,"delivered_item_count":1,
   "unit_price_cents":39,"unit_price":"0.39","total_cents":39,"total":"0.39","currency":"USD",
   "status":"completed","created_at":1789143092,"replayed":false,
   "items":[{"content":"login:password"}],
   "instructions":"Sign in, then keep recovery details unchanged."},
 "balance_cents":961,"balance":"9.61"}

Body fields and answers: Placing orders. With customer data: Products that need customer data.

GET/v1/orders/:codeOne order · delivery status
cURL
curl https://api.aistocks.store/v1/orders/RA-1A2B3C4D5E -H "Authorization: Bearer YOUR_API_KEY"

Returns the order with its status, delivered items and instructions, in the same shape as the order answer. Use it to wait for delivery (statuses). Someone else's or an unknown code returns 404 order_not_found.

GET/v1/orders/by-idempotency/:keyFind an order by your key
cURL
curl https://api.aistocks.store/v1/orders/by-idempotency/order-1001 -H "Authorization: Bearer YOUR_API_KEY"

Read-only: finds the order you placed with this key (never buys). No order with this key: 404 order_not_found — then it is safe to send the order again with the same key.

GET/v1/ordersOrder history
cURL
curl "https://api.aistocks.store/v1/orders?limit=50&offset=0" -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"orders":[{"code":"RA-1A2B3C4D5E","product_id":10,"product_name":"Example account","qty":1,
  "total_cents":39,"total":"0.39","status":"completed","created_at":1789143092, …}]}

Newest first. limit 1–200 (default 50), offset from 0; stop when a page is shorter than limit. The list leaves out items and customer data — open an order to see them.

POST/v1/orders/:code/cancelCancel a pre-order
cURL
curl -X POST https://api.aistocks.store/v1/orders/RA-1A2B3C4D5E/cancel -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"replayed":false,"refunded_cents":250}

Cancels the undelivered part of a pre-order and returns its price to your API balance; delivered items stay delivered. Safe to repeat. Other orders return 409 cancel_not_allowed — ask support to cancel those.

GET/v1/soldYour sales per product
cURL
curl https://api.aistocks.store/v1/sold -H "Authorization: Bearer YOUR_API_KEY"

{"ok":true,"items":[{"product_id":10,"product_name":"Example account","qty":40,"orders":38,
  "spent_cents":1560,"spent":"15.60","currency":"USD","first_at":1786500000,"last_at":1789143092}],
 "total_qty":40,"total_spent_cents":1560,"total_spent":"15.60","currency":"USD"}

Counts delivered units only.

🚨Errors

Every error is {"ok":false,"error":{"code":"…","message":"…"}}. A refused request never charges your balance.

HTTPcodeWhat to do
400invalid_json, invalid_request, invalid_product_id, invalid_qty, invalid_idempotency_key, idempotency_key_mismatch, invalid_preorder, bad_requestFix the request.
400qty_out_of_rangeUse a quantity between min_qty and max_qty (both are in the error).
400customer_input_required, invalid_customer_input, unknown_customer_input, invalid_customer_inputsCorrect your buyer's details (customer data) and send again.
401missing_or_malformed_key, invalid_keyCheck your API key.
403reseller_suspended, access_revokedContact the shop.
404product_not_found, order_not_found, not_foundCheck the id, code or path.
409out_of_stockNot enough stock (for instant products available in the error says how many are left). Order less, later, or as a pre-order.
409insufficient_balanceTop up your API balance.
409idempotency_key_conflictThis key was used for a different order — use a new key.
409preorder_disabled, preorder_limitPre-order not possible for this product or over its limit.
409cancel_not_allowedOnly pre-orders can be cancelled here — ask support.
409input_configuration_error, pricing_error, invalid_balance, unsupported_source, invalid_costA problem on the shop's side — contact the shop.
413body_too_largeKeep the body under 32 KB.
429rate_limited, locked_outWait for Retry-After seconds.
429cooldownThis product was ordered too recently (order_cooldown_sec; orders from your linked Telegram account count too). Wait retry_after_seconds.
500 503internal_error, busyTemporary. Retry after a short pause with the same idempotency key.

🏆Best practices

  • Show your buyers whether a product is delivered instantly or later, and collect the required details before they pay you.
  • Re-check the product (GET /v1/products/:id) right before ordering: price, stock and required fields can change.
  • Save the idempotency key before sending, and the RA-… code after. Never place a second order because the first one is still pending.
  • Keep the API key, delivered items and your buyers' details out of logs and out of browsers.
  • Calculate with the *_cents fields, not the display strings.
  • Back off on 429, 500 and 503.

🧩Code examples

Order a product (with customer data if it needs any) and wait until it is delivered.

Node.js
const BASE = 'https://api.aistocks.store', KEY = process.env.API_KEY;
const api = (path, opts = {}) => fetch(BASE + path, { ...opts,
  headers: { Authorization: 'Bearer ' + KEY, 'Content-Type': 'application/json', ...opts.headers } })
  .then(r => r.json());

async function buy(productId, qty, customerInputs, idempotencyKey) {
  const res = await api('/v1/orders', { method: 'POST',
    headers: { 'Idempotency-Key': idempotencyKey },
    body: JSON.stringify({ product_id: productId, qty, customer_inputs: customerInputs }) });
  if (!res.ok) throw new Error(res.error.code + ': ' + res.error.message);
  let order = res.order;
  while (order.status === 'pending' || order.status === 'preorder') {
    await new Promise(r => setTimeout(r, 60000));               // check once a minute
    order = (await api('/v1/orders/' + order.code)).order;
  }
  return order;   // completed → order.items ; refunded → refund your buyer
}

// buy(57, 1, { redeem_code: 'AB12CD' }, 'order-1002')
Python
import os, time, requests
BASE, KEY = 'https://api.aistocks.store', os.environ['API_KEY']
H = {'Authorization': 'Bearer ' + KEY}

def buy(product_id, qty, customer_inputs, idempotency_key):
    body = {'product_id': product_id, 'qty': qty}
    if customer_inputs:                                          # only when the product has fields
        body['customer_inputs'] = customer_inputs
    r = requests.post(BASE + '/v1/orders', json=body,
                      headers={**H, 'Idempotency-Key': idempotency_key}).json()
    if not r['ok']:
        raise Exception(r['error']['code'] + ': ' + r['error']['message'])
    order = r['order']
    while order['status'] in ('pending', 'preorder'):
        time.sleep(60)                                           # check once a minute
        order = requests.get(BASE + '/v1/orders/' + order['code'], headers=H).json()['order']
    return order   # completed -> order['items'] ; refunded -> refund your buyer

# buy(57, 1, {'redeem_code': 'AB12CD'}, 'order-1002')

❓FAQ

A product shows stock: 0 — can I sell it?

Yes, if stock_unlimited is true. Otherwise it is out of stock (or offer a pre-order when preorder_supported is true).

My order has been pending for a while.

Products delivered by the shop take some time. Keep checking the order; never buy again. If it takes unusually long, contact support with the RA-… code.

How do I send my buyer's redeem code / email to the shop?

In customer_inputs with the order — see Products that need customer data. No separate message is needed.

Why is a product missing from the list?

It is inactive, free, not sold through the API (e.g. file downloads), or has no price for API sales right now.

Did my order go through after a timeout?

Check GET /v1/orders/by-idempotency/:key, or simply send the same request with the same key — you'll get the existing order, never a second charge.

🗒️Changelog

v1.4 · 29 Nov 2026All products for every key. Products delivered by the shop and products that need customer data are listed and orderable for every API key — buyer details travel with the order in customer_inputs. The old deferred-v1 capability header is no longer needed (it is still accepted). Documentation rewritten.
v1.3Products delivered after purchase. 202 pending orders with automatic delivery or automatic refund.
v1.2Order rules. order_cooldown_sec, 429 cooldown, quantity limits in qty_out_of_range.
v1.1Rate-limit headers and /v1/sold.
v1.0Ping, balance, products and prepaid orders.

💬Support

For API access, balance top-ups or a question about an order, contact the shop. Mention your reseller name and the RA-… order code — never send your API key.

✓Copied to clipboard