Buy products with
a single API call.
Get your personal API key from the Telegram bot, top up your wallet, and purchase instantly β connect your own website or bot in minutes.
Quickstart
Three steps to your first purchase.
Get your key
Open the Telegram bot β π API (or Profile β API Access) β Generate. Copy your key (starts with mk_).
Top up your wallet
Use the bot's Top Up button. Purchases are charged against your wallet balance.
Call the API
Send your key in the X-API-Key header on every request. That's it.
https://api.ai-market.store/api/v1 Β·
Auth: X-API-Key: mk_... Β·
Rate limit: 20 req / min
π€ Connect with AI β no coding needed
Using Claude Code or Cursor? Paste the prompt below, replace the last two lines, and let the AI build your integration for you.
I want to integrate the AI-Market API into my project.
API base URL: {BASE}
Auth: send my key on EVERY request in the header -> X-API-Key: <MY_KEY>
(I get the key from the AI-Market Telegram bot: tap "π API" -> Generate.)
Endpoints:
- GET /balance -> { "balance": number, "currency": "USDT" } (my wallet balance)
- GET /products -> { "products": [ { "id", "name", "price", "stock", "in_stock" } ] }
- POST /purchase -> buy a product using my wallet balance
body: { "product_id": "<id from /products>", "quantity": 1 }
header: Idempotency-Key: <any-unique-id> (optional; makes retries safe, never double-charges)
success -> { "success": true, "order_id", "codes": [...], "balance_remaining" }
Rules to follow:
- Send the X-API-Key header on every request.
- Branch on the JSON "code" field for errors:
NO_KEY / INVALID_KEY (401), VALIDATION (400), INSUFFICIENT_BALANCE (402),
FORBIDDEN (403), PRODUCT_NOT_FOUND (404), OUT_OF_STOCK (409),
RATE_LIMITED (429 -> wait "retry_after_seconds" then retry).
- Rate limit: max 20 requests per minute.
- A purchase only works if my wallet has enough balance (I top up inside the bot).
Now please build this for me:
>>> DESCRIBE WHAT YOU WANT, e.g. "a Node.js script that lists products and lets me buy one by id" <<<
Use my API key: >>> PASTE_YOUR_API_KEY_HERE <<<
>>> β¦ <<< lines with what you want and your key β send. The AI writes, runs, and fixes the code for you.
Products
Tap to load the live catalog β real product ids, prices & stock, straight from the store.
Endpoints
Three endpoints. Replace YOUR_API_KEY with your key.
Full example
# 1) Check your balance
curl -s "{BASE}/balance" \
-H "X-API-Key: YOUR_API_KEY"
# 2) List products
curl -s "{BASE}/products" \
-H "X-API-Key: YOUR_API_KEY"
# 3) Buy 1 unit (Idempotency-Key makes retries safe)
curl -s -X POST "{BASE}/purchase" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-001" \
-d '{"product_id":"002","quantity":1}'
const BASE = "{BASE}";
const KEY = "YOUR_API_KEY";
const headers = { "X-API-Key": KEY, "Content-Type": "application/json" };
// 1) Balance
const balance = await fetch(`${BASE}/balance`, { headers }).then(r => r.json());
console.log("Balance:", balance);
// 2) Products
const { products } = await fetch(`${BASE}/products`, { headers }).then(r => r.json());
// 3) Purchase (Idempotency-Key makes retries safe)
const res = await fetch(`${BASE}/purchase`, {
method: "POST",
headers: { ...headers, "Idempotency-Key": "order-001" },
body: JSON.stringify({ product_id: "002", quantity: 1 }),
});
const order = await res.json();
if (order.success) console.log("Codes:", order.codes);
else console.error("Failed:", order.code, order.error);
import requests
BASE = "{BASE}"
KEY = "YOUR_API_KEY"
headers = {"X-API-Key": KEY, "Content-Type": "application/json"}
# 1) Balance
print(requests.get(f"{BASE}/balance", headers=headers).json())
# 2) Products
products = requests.get(f"{BASE}/products", headers=headers).json()["products"]
# 3) Purchase (Idempotency-Key makes retries safe)
res = requests.post(
f"{BASE}/purchase",
headers={**headers, "Idempotency-Key": "order-001"},
json={"product_id": "002", "quantity": 1},
).json()
print(res["codes"] if res.get("success") else res)
Errors & handling
Every error returns JSON with a stable code you can branch on.
| Status | code | Meaning | What to do |
|---|---|---|---|
| 401 | NO_KEY / INVALID_KEY | Missing or revoked key | Check the header; regenerate in the bot |
| 400 | VALIDATION | Bad body (quantity 1β10) | Fix the request body |
| 402 | INSUFFICIENT_BALANCE | Wallet too low | Top up; see required / available |
| 403 | FORBIDDEN | Account suspended | Contact support |
| 404 | PRODUCT_NOT_FOUND | Unknown product id | Re-fetch /products |
| 409 | OUT_OF_STOCK | Not enough stock | Lower quantity or retry later |
| 429 | RATE_LIMITED | Over 20 req/min | Back off retry_after_seconds |
Idempotency-Key header on POST /purchase. Retrying with the same key within 24h returns the original result instead of charging twice.