API v1 — InstaMarket

批发客户的 REST API:目录、订单、余额、Webhook。

Base URL: https://instamarket.pro/api/v1

⚡ Quick Start — 从密钥到首单仅需 5 分钟

开始使用 API 的最简链路:

  1. 在个人中心打开 API 密钥 → 创建密钥 — 获得 X-API-Key + HMAC secret。secret 只显示一次 — 请保存到密码管理器。
  2. 用该密钥试一下 GET /v1/health — 必须返回 200。
  3. 浏览目录:GET /v1/products?min_qty=10&max_price=2 — 所有商品及 min_quantity 字段(最低下单数量)。快速发货商品(instant_delivery=true)汇总在 GET /v1/instant 中——1 件起购。
  4. 充值:POST /v1/balance/topup → 把 USDT 发到返回的地址。链上确认后 5-10 秒,余额自动入账。
  5. 下单:POST /v1/orders,payment_method:"balance",并带上您自己的重试键——Idempotency-Key 请求头或 idempotence_id 字段。快速发货商品的响应通常直接返回 status: "completed",账号在 items 中——无需轮询。
  6. 若返回 status: "processing"——每 2–5 秒轮询一次 GET /v1/orders/{id},直到状态变为 completed(账号在 items 中)、refunded(未能发货——款项已退回余额)或 failed(请联系客服,我们会人工退款)。
  7. 可选:在 POST /orders 中传入 webhook_url 以推送通知代替轮询。

1. 获取 API 密钥

密钥由您在个人中心自行创建:API 密钥 → 创建密钥(需在通过机器人验证码登录后 15 分钟内操作)。HMAC secret 会同时生成并只显示一次 — 请立即保存。密钥使用账户的通用余额。限流:每密钥每分钟 60 次请求(超出 HTTP 429)。密钥问题请联系 客服.

2. 鉴权

X-API-Key: YOUR_KEY_HERE

每个请求都需要该 header。缺失或无效 → HTTP 401 Unauthorized。

3. 目录(只读)

GET /v1/health

密钥校验 + 可用性探针。

curl -H "X-API-Key: $KEY" https://instamarket.pro/api/v1/health
# {"status":"ok","timestamp":1779497200}

GET /v1/products

带筛选的目录。Query 参数:

  • category, sku
  • min_price, max_price (float, USDT)
  • min_qty (default 1), page (default 1), page_size (default 50, max 200)
curl -H "X-API-Key: $KEY" \
  "https://instamarket.pro/api/v1/products?min_price=1&page=1&page_size=50"

⚡ 关键响应字段(每个 items[] 元素中)

  • instant_delivery (bool) — 快速发货标记:true——商品有现货并立即发货,账号直接在 POST /v1/orders 的响应中返回
  • instant_stock (int) — 当前可快速发货的数量(其他商品为 0)。超过该数量的订单不会走快速发货

GET /v1/products/{id}

单个商品详情(按 ID)。

GET /v1/instant

仅返回当前有现货的快速发货商品(instant_delivery=true)。参数——category、min_price、max_price、page、page_size(1–200,默认 50);响应格式与 /v1/products 相同。instant_stock——单个订单可立即获得的数量,min_quantity = 1——1 件起购。列表实时变化:下单前请重新获取。

curl -H "X-API-Key: $KEY" "https://instamarket.pro/api/v1/instant?page=1&page_size=50"

# {"total": 3, "page": 1, "page_size": 50, "items": [
#   {"id": 18234, "title": "Instagram | ...", "title_en": "Instagram | ...", "title_zh": "Instagram | ...",
#    "category": "...", "price_usdt": 1.23, "quantity": 150, "min_quantity": 1,
#    "sku": 358, "source_site": null, "is_available": true, "has_real_device": true,
#    "followers_count": null, "account_age_days": null, "tags": ["..."],
#    "instant_delivery": true, "instant_stock": 150}
# ]}

GET /v1/categories

类目列表,含商品数量 + 最低价。

4. 余额与充值

GET /v1/balance

当前密钥余额 + 已花费/已充值/已退款总额。

curl -H "X-API-Key: $KEY" https://instamarket.pro/api/v1/balance
# {"balance_usdt": 50.0, "total_spent_usdt": 12.5,
#  "total_topup_usdt": 62.5, "total_refunded_usdt": 1.2,
#  "currency": "USDT"}

POST /v1/balance/topup

创建充值意向 → 获取 USDT 地址。客户选择金额和网络。请求体:

curl -X POST -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -d '{"amount_usdt": 100, "network": "usdt_trc_20"}' \
  https://instamarket.pro/api/v1/balance/topup

# {"topup_id": "abc123...", "payment_address": "TYz...",
#  "payment_network": "usdt_trc_20", "amount_usdt": 100.0,
#  "expires_at": 1779500800}

USDT 到账后 — 余额自动入账(cron 每 5 秒扫描入账 TX)。地址与网站购买共用(每个网络一个主钱包),意向通过金额区分。

⏱ 完整充值生命周期

  1. T+0:00 — 客户:POST /v1/balance/topup {amount_usdt: 100, network: "usdt_trc_20"}
  2. T+0:00 — API 创建 topup_id,返回 payment_address(你的主钱包)+ amount_usdt: 100 + expires_at: now+1h
  3. T+0:30 — 客户从自己的钱包发送 100 USDT(TRC-20)到该地址
  4. T+0:55 — TRC-20 确认(~20 秒 / 3-5 块)
  5. T+1:00 — backend(每 5 秒)发现入账 TX,按精确金额查找待匹配充值意向
  6. T+1:05 — backend 按 amount ±$0.01 匹配存款与你的意向 → BAL +100,status=credited_auto
  7. T+1:05 — 客户:GET /v1/balance → balance_usdt: 100.0 ✓

📋 响应字段 — 每个的含义

topup_id意向 UUID(Redis 中保留 24h)。用于状态轮询或审计。
payment_address所选网络的主钱包。与网站购买相同。 不会为每次充值生成新地址。
payment_network回显:usdt_trc_20 / usdt_bep_20 / usdt_polygon / usdt_arbitrum / usdt_erc20 / usdt_ton / usdt_solana。
amount_usdt你的转账金额 — backend 据此精确匹配你的入账 TX(±$0.01)并入账到余额。
expires_atUnix epoch +1h。若客户 1h 内未发送 TX → 意向过期;存款等待人工入账(联系 support)。

⚠️ Edge cases — 不一致时的处理

要求 $100,发送 $100.00
✅ 5-10 秒自动入账
要求 $100,发送 $99.99
✅ 入账(tolerance ±$0.01)
要求 $100,发送 $98
❌ 不会自动匹配。请联系 support — 按实际金额手动入账。
要求 $100,发送 $200
❌ 不匹配(超过 tolerance),需要手动入账
要求 $100,2h 后发送(已过期)
❌ 意向已过期;存款等待人工入账(联系 support)。
转账金额在 15 分钟窗口内与其他充值意向冲突
✅ 你的充值金额会被设为唯一(价格可能浮动 ~±1%)— 冲突概率极低。请以创建意向响应中的金额为准。
发错网络(usdt_bep_20 而非 usdt_trc_20)
❌ 存款会进入其他网络的地址,无法自动入账。请联系 support — 我们会处理并手动入账。

5. 订单(余额扣款)

POST /v1/orders

创建订单并从余额扣款。快速发货商品的账号直接在响应中返回。若订单未能发货且款项未发生任何支出,金额将自动退回余额(status: "refunded",refunded: true);详见下文「自动退款」。

BODY='{"product_id": 12345, "quantity": 10, "payment_method": "balance", "webhook_url": "https://your.app/api-cb"}'
TS=$(date +%s)
SIG=$(printf '%s\n%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -r | cut -d' ' -f1)
curl -X POST -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -H "X-Timestamp: $TS" -H "X-Signature: $SIG" \
  -H "Idempotency-Key: order-2026-0001" \
  -d "$BODY" https://instamarket.pro/api/v1/orders

# instant_delivery=true -> fast delivery, accounts in THIS response:
# {"order_id": 790, "status": "completed", "price_usdt": 12.34, "quantity": 10,
#  "payment_address": null, "payment_network": null, "payment_expires_at": null,
#  "items": [{"items": [{"login": "login1", "password": "pass1", "raw": "login1:pass1|..."}, ...],
#             "raw": "login1:pass1|...\nlogin2:pass2|..."}],
#  "error_message": null, "refunded": false,
#  "created_at": 1779497200, "updated_at": 1779497200}
#
# Not delivered within ~4.5 s, or a regular item -> processing, no items yet
# (then GET /v1/orders/{id} or the webhook):
# {"order_id": 789, "status": "processing", "price_usdt": 12.34, "quantity": 10,
#  "payment_address": null, "payment_network": null, "payment_expires_at": null,
#  "items": null, "error_message": null, "refunded": false,
#  "created_at": 1779497200, "updated_at": 1779497200}

快速发货: instant_delivery=true 的商品在同一请求内完成——POST /v1/orders 的响应直接返回 status: "completed",账号在 items 中,通常不到一秒。服务器最多等待约 4.5 秒;若未完成则返回 status: "processing":款项已扣除,订单继续处理——请通过 GET /v1/orders/{id} 获取账号或等待 webhook。HTTP 客户端超时请设为不少于 10 秒。其他商品的响应为 status: "processing",不含 items。

POST /v1/orders 与 GET /v1/orders/{id} 中 items 的格式:包含一个对象的数组。raw——全部账号文本,每行一个(行格式见商品名称,例如 login:password|cookies);items——同样的账号按字段拆分:login、password、raw,如有还包括 email、email_password、cookies、twofa_seed。在 webhook 中 items 就是该对象本身,没有外层数组。

重试不会重复购买: 请带上您自己的重试键——Idempotency-Key 请求头或请求体字段 idempotence_id(二者含义相同;同时传入且不一致——422)。键可以是您自己的任意唯一字符串,例如 UUID。使用相同的键和相同的请求体重复调用 POST /v1/orders,不会创建也不会支付第二个订单——将返回已创建的订单:相同的 order_id、当前状态,以及已发货的账号;客户端超时后重试同样如此。相同的键配不同的请求体——422;使用该键的首个请求仍在处理——409,请稍等几秒再试。键保留 30 天。每次重复请求都要重新签名(新的 X-Timestamp):同一签名不会被接受两次。

若余额 < 价格 → HTTP 402 Payment Required + 充值指引。

⚠️ 最低下单数量见 min_quantity 字段;低于该数量将返回 HTTP 400 并提示允许的最低数量。快速发货商品(instant_delivery=true)1 件起购——可以只买一个账号。

GET /v1/orders

该密钥创建的订单列表(最新在前)。使用 page/page_size 分页,?status= 筛选(processing | completed | failed | expired | cancelled | refunded | needs_review)。此处不返回账号凭据 —— 凭据仅通过 GET /v1/orders/{id} 获取。

curl -H "X-API-Key: $KEY" "https://instamarket.pro/api/v1/orders?page=1&page_size=50"
curl -H "X-API-Key: $KEY" "https://instamarket.pro/api/v1/orders?status=completed"

# {"total": 137, "page": 1, "page_size": 50,
#  "items": [
#    {"order_id": 790, "status": "completed", "product_id": 12345,
#     "sku": 358, "title": "Instagram | Autoreg", "quantity": 10,
#     "price_usdt": 12.34, "refunded": false,
#     "created_at": 1779497200, "updated_at": 1779497500}
#  ]}

⚠️ 此响应中的 items[] 是订单,不是账号。某笔订单的账号请通过 GET /v1/orders/{id} 获取。

GET /v1/orders/{id}

订单状态;发货后账号在 items 中。仅创建该订单的密钥可见(其他密钥的订单返回 404)。

curl -H "X-API-Key: $KEY" https://instamarket.pro/api/v1/orders/789

# {"order_id": 789, "status": "completed", "price_usdt": 12.34, "quantity": 10,
#  "payment_address": null, "payment_network": null, "payment_expires_at": null,
#  "items": [{"items": [{"login": "login1", "password": "pass1", "raw": "login1:pass1|..."}, ...],
#             "raw": "login1:pass1|...\nlogin2:pass2|..."}],
#  "error_message": null, "refunded": false,
#  "created_at": 1779497200, "updated_at": 1779497500}

订单状态

  • processing — 已付款,正在发货
  • completed — 已全部发货,账号在 items 中
  • partial — 部分发货:已收到的在 items 中,其余请联系客服
  • needs_review — 发货结果未知,订单人工审核中:审核后显示账号;如需退款,由客服人工处理
  • failed — 未完成;若款项未发生任何支出,金额将自动退回余额,状态变为 refunded,否则请联系客服,我们会人工退款
  • expired — 支付期限已过,订单关闭
  • cancelled — 已取消;如已扣款,客服将人工退款
  • refunded — 款项已退回余额(refunded: true)——自动或由客服退回

自动退款

若订单未能发货且款项未发生任何支出,金额将自动退回支付该订单的余额(密钥余额即账户通用余额):订单状态变为 status: "refunded",refunded: true,error_message: "Order refunded.",并向 webhook_url 发送带最终状态 refunded 的 webhook(若退款前已发出 failed webhook,随后会再发一次最终状态)。若购物车只发出部分商品,则退回未发货商品的金额,订单保持 completed。若结果未知(needs_review)或订单仍为 failed,则人工退款——请带上订单号联系客服。

6. Webhook 通知

在 POST /v1/orders 中传入 webhook_url——订单进入最终状态(completed, partial, failed, expired, cancelled, refunded,包括自动退款后)时,我们会向该地址 POST JSON,通常在 30 秒内。快速发货商品的账号已在 POST 响应中——webhook 会再发送一次。

POST $YOUR_WEBHOOK_URL
Content-Type: application/json
X-Webhook-Timestamp: 1779497230
X-Webhook-Signature: <hmac_sha256(secret, f"{ts}\n{body}").hex()>
X-Webhook-Algorithm: HMAC-SHA256

{
  "order_id": 789,
  "status": "completed",
  "price_usdt": 12.34,
  "quantity": 10,
  "product_id": 12345,
  "items": {"items": [{"login": "login1", "password": "pass1", "raw": "login1:pass1|..."}, ...],
            "raw": "login1:pass1|...\nlogin2:pass2|..."},
  "error_message": null,
  "refunded": false,
  "fired_at": 1779497230
}

期望 HTTP 2xx 响应。5xx/超时 — 最多 5 次指数退避重试。5 次失败后标记为 fired。

7. 使用统计

GET /v1/usage

按密钥统计:请求数、最近活跃、累计花费、累计退款。

curl -H "X-API-Key: $KEY" https://instamarket.pro/api/v1/usage
# {"request_count": 1234, "last_used_at": 1779497200,
#  "first_used_at": 1779480000, "last_endpoint": "/api/v1/products",
#  "total_spent_usdt": 125.50}

8. 账号交付

发货时间:快速发货商品(instant_delivery=true)——立即,账号在 POST /v1/orders 的响应中(通常不到一秒)。其他商品——status=processing 之后 30 秒至 10 分钟:轮询 GET /v1/orders/{id} 或等待 webhook。

  1. POST /v1/orders → status=processing
  2. 异步处理(30s-10min)
  3. 成功 → status=completed
  4. GET /v1/orders/{id} → items[]
  5. Webhook 触发(如已注册)

⚡ 快速发货(instant_delivery=true):整个流程只需一个请求。POST /v1/orders 立即返回 status=completed 和 items;若发货超过约 4.5 秒——返回 processing,之后通过 GET /v1/orders/{id} 或 webhook 获取。

9. USDT 网络与手续费

网络手续费时间推荐
usdt_trc_20$0.5-11-3 min默认
usdt_bep_20$0.2-0.530 sec - 2 min便宜快速
usdt_polygon$0.01-0.051-3 min最便宜
usdt_arbitrum$0.1-0.330 sec已在 Arbi 时
usdt_erc20$0.1-12-5 min已在以太坊时
usdt_ton$0.05-0.15-15 sec快速
usdt_solana$0.01-0.025-30 sec便宜快速

通过 API(POST /v1/balance/topup)可在以上 7 个网络充值余额。在网站和个人中心还可使用 Avalanche 网络的 USDT、USDC(BEP20、Polygon、Arbitrum、Avalanche、Solana)、CryptoBot 和 Telegram Stars——余额共用。

⚠️ 请严格使用申请中指定的网络(payment_network)转账:所有 EVM 网络(含 Ethereum ERC20,usdt_erc20)的地址相同,但只有在申请中指定网络上的转账才会入账。

10. 限制与计费

  • 限流:每密钥每分钟 60 次(HTTP 429)
  • API 价格 = 网站价格(无加价)
  • page_size:1-200(默认 50)
  • 订单 quantity:1-10000
  • 充值:1-100000 USDT
  • Webhook 超时 10s,最多 5 次重试
  • 自动退款:订单未能发货且款项未发生任何支出——金额自动退回余额(refunded);结果未知(needs_review)或订单仍为 failed——请带上订单号联系客服,我们会人工退款

11. 错误码

  • 400 — 低于最低下单数量(min_quantity);webhook_url 被拒绝;不支持的充值网络;X-Timestamp 无效;未知的 ?status= 值
  • 401 — 缺少 X-API-Key 或密钥无效——{"detail": "Invalid or missing X-API-Key"};POST 还包括:无签名、签名不符、时间偏差超过 5 分钟、重复使用同一签名(Replay detected)
  • 402 — 余额不足
  • 403 — IP 不在该密钥的白名单中,或密钥所有者已被封禁
  • 404 — 商品或订单不存在(其他密钥的订单同样返回 404)
  • 409 — 现货数量不足(Insufficient stock);该商品正被其他买家占用;扣款冲突——请重试;使用该重试键的请求仍在处理中——请稍等几秒再试
  • 422 — 请求体未通过校验(字段类型或范围);该重试键已被用于不同的请求体;同时传入 Idempotency-Key 与 idempotence_id 且二者不一致
  • 429 — 每个密钥每分钟超过 60 次请求(等待时间见响应文本);每个密钥未完成的充值超过 3 笔;连续使用无效密钥后 IP 被临时封禁(响应头 Retry-After)
  • 501 — 暂不支持非余额支付订单(payment_method ≠ "balance")
  • 503 — 服务暂时不可用——请重试(使用新签名)

错误以 JSON {"detail": "…"} 返回;422 的 detail 字段是按字段列出的错误列表。

11.5 安全(HMAC + IP 白名单)

生产密钥的额外防护:HMAC 签名(在个人中心创建密钥时自动附带 secret),以及按需联系客服开启的 IP 白名单。

HMAC 请求体签名(POST /orders + /topup)

在个人中心创建密钥时会同时生成 HMAC secret(仅显示一次)。POST /orders 与 /topup 强制要求 HMAC secret + 两个额外 header(fail-closed)。公式:

X-Timestamp = Unix 时间戳秒(与服务器漂移 ≤5 分钟)
X-Signature = hmac_sha256(secret, f"{timestamp}\n{request_body}").hex()
# Python example
import hmac, hashlib, time, json, requests
KEY = "..."; SECRET = "..."
BASE = "https://instamarket.pro/api/v1"
body = json.dumps({"product_id": 12345, "quantity": 1, "payment_method": "balance"})
ts = str(int(time.time()))
sig = hmac.new(SECRET.encode(), f"{ts}\n{body}".encode(), hashlib.sha256).hexdigest()
r = requests.post(f"{BASE}/orders", data=body, headers={
    "X-API-Key": KEY,
    "Content-Type": "application/json",
    "X-Timestamp": ts,
    "X-Signature": sig,
})
print(r.status_code, r.json())

防护对象:重放攻击、MITM 篡改、密钥意外泄露(没有 secret 无法生成签名)。POST /orders 与 /topup 现在强制要求签名(fail-closed,自 2026-06-03):没有 secret 的密钥返回 HTTP 401。

IP 白名单

允许的 IP 只能由我们的客服为密钥绑定:请用创建密钥的账号联系客服并发送服务器 IP。白名单为空时不校验 IP(默认)。若有至少一个 IP,其他来源返回 HTTP 403。

操作审计

你的 API-key 下的所有操作都会被记录。可通过 GET /v1/usage 查看你自己的使用统计(请求次数、最后使用时间、累计消费)。

🧪 立即试用 — 交互式 Playground

在下方粘贴你的 X-API-Key,点击任意按钮 — 请求将直接从本页发送到 API。POST 端点的 HMAC 签名会在浏览器自动计算(如果你的密钥有 secret)。

GET https://instamarket.pro/api/v1/health
🔒 请求直接从你的浏览器发往 https://instamarket.pro/api/v1. 密钥不会保存在服务器上。

12. SDK 示例

Python (requests)

import hashlib, hmac, json, time, uuid
import requests
KEY = "YOUR_API_KEY"
SECRET = "YOUR_HMAC_SECRET"
BASE = "https://instamarket.pro/api/v1"
headers = {"X-API-Key": KEY}

def post_signed(path, payload, idem_key=None):
    body = json.dumps(payload, separators=(",", ":"))
    ts = str(int(time.time()))
    sig = hmac.new(SECRET.encode(), f"{ts}\n{body}".encode(), hashlib.sha256).hexdigest()
    h = {**headers, "Content-Type": "application/json", "X-Timestamp": ts, "X-Signature": sig}
    if idem_key:
        h["Idempotency-Key"] = idem_key
    return requests.post(f"{BASE}{path}", data=body, headers=h, timeout=15)

# 1. Fast-delivery items (from 1 pc)
instant = requests.get(f"{BASE}/instant", headers=headers, timeout=15).json()

# 2. Check balance
bal = requests.get(f"{BASE}/balance", headers=headers, timeout=15).json()
print(f"Balance: {bal['balance_usdt']} USDT")

# 3. Create order (balance-debit, signed). Keep order_key: a retry with it returns the same order
order_key = str(uuid.uuid4())
order = post_signed("/orders", {
    "product_id": instant["items"][0]["id"],
    "quantity": 1,
    "payment_method": "balance",
}, idem_key=order_key).json()
print(f"Order #{order['order_id']} {order['status']}")

# 4. Fast delivery: the accounts are already here. Otherwise poll until final.
o = order
while o["status"] == "processing":
    time.sleep(3)
    o = requests.get(f"{BASE}/orders/{order['order_id']}", headers=headers, timeout=15).json()
print(f"Final: {o['status']}, refunded={o.get('refunded')}")
if o.get("items"):
    print(o["items"][0]["raw"])

Node.js (axios)

import axios from "axios";
import crypto from "node:crypto";

const KEY = process.env.API_KEY;
const SECRET = process.env.API_SECRET;
const api = axios.create({
  baseURL: "https://instamarket.pro/api/v1",
  headers: { "X-API-Key": KEY },
  timeout: 15000,
});

function signed(payload, orderKey) {
  const body = JSON.stringify(payload);
  const ts = String(Math.floor(Date.now() / 1000));
  const sig = crypto.createHmac("sha256", SECRET).update(`${ts}\n${body}`).digest("hex");
  return { body, headers: { "Content-Type": "application/json", "X-Timestamp": ts, "X-Signature": sig, "Idempotency-Key": orderKey } };
}

// 1. Fast-delivery items (from 1 pc)
const { data: instant } = await api.get("/instant");

// 2. Create order (signed). Keep orderKey: a retry with it returns the same order
const orderKey = crypto.randomUUID();
const req = signed({ product_id: instant.items[0].id, quantity: 1, payment_method: "balance" }, orderKey);
let { data: o } = await api.post("/orders", req.body, { headers: req.headers });

// 3. Fast delivery: the accounts are already in o.items. Otherwise poll.
while (o.status === "processing") {
  await new Promise(r => setTimeout(r, 3000));
  o = (await api.get(`/orders/${o.order_id}`)).data;
}
console.log("Final:", o.status, o.items?.[0]?.raw);

Go (net/http)

package main

import (
  "bytes"; "crypto/hmac"; "crypto/sha256"; "encoding/hex"; "encoding/json"
  "fmt"; "io"; "net/http"; "strconv"; "time"
)

func main() {
  body, _ := json.Marshal(map[string]any{
    "product_id": 12345, "quantity": 1, "payment_method": "balance",
  })
  ts := strconv.FormatInt(time.Now().Unix(), 10)
  mac := hmac.New(sha256.New, []byte("YOUR_HMAC_SECRET"))
  mac.Write([]byte(ts + "\n")); mac.Write(body)
  req, _ := http.NewRequest("POST", "https://instamarket.pro/api/v1/orders", bytes.NewReader(body))
  req.Header.Set("X-API-Key", "YOUR_KEY")
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("X-Timestamp", ts)
  req.Header.Set("X-Signature", hex.EncodeToString(mac.Sum(nil)))
  req.Header.Set("Idempotency-Key", "order-2026-0001")
  resp, err := (&http.Client{Timeout: 15 * time.Second}).Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  b, _ := io.ReadAll(resp.Body); fmt.Println(string(b))
}

curl

# Full flow: fast-delivery list, balance, signed order, status
KEY=YOUR_API_KEY
SECRET=YOUR_HMAC_SECRET
BASE=https://instamarket.pro/api/v1

curl -H "X-API-Key: $KEY" "$BASE/instant?page_size=5"
curl -H "X-API-Key: $KEY" "$BASE/balance"
BODY='{"product_id":12345,"quantity":1,"payment_method":"balance"}'
TS=$(date +%s)
SIG=$(printf '%s\n%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -r | cut -d' ' -f1)
curl -X POST -H "X-API-Key: $KEY" -H "Content-Type: application/json" \
  -H "X-Timestamp: $TS" -H "X-Signature: $SIG" -H "Idempotency-Key: order-2026-0001" -d "$BODY" "$BASE/orders"
curl -H "X-API-Key: $KEY" "$BASE/orders/789"

合作伙伴 API —— 适用于分销商店

面向分销商店的简化 API:地址 https://instamarket.pro/api/v1/,密钥通过 key 参数传递,目录、余额和订单均为简单的 GET/POST 请求,返回格式为 {"success", "data"}。

  • 密钥由您自行创建:个人中心 → «API 密钥» → «创建密钥»(需在通过机器人验证码登录后 15 分钟内操作)。服务器 IP 只能由我们的客服为密钥绑定:请用创建密钥的账号联系客服并发送 IP。未绑定 IP 时只能查看目录和余额;绑定后该密钥只能从这些地址使用(整个 API)。
  • 密钥为 key 参数:放在查询字符串(GET)或请求体(POST,JSON 或表单)中。始终返回 HTTP 200:{"success": true, "data": …};出错时 success=false,错误码和说明在 data.status 和 data.message 中。
  • 目录中仅包含当前有现货的快速发货商品,1 件起购。下单后立即完成,并返回含账号的 .txt 文件链接;若仍在发货中,返回 status: pending,可通过 order/download 获取链接。
  • 价格和余额以 USD 计(1 USDT = 1 美元)。仅可使用账户通用余额支付 —— 与网站和机器人为同一钱包。
  • idempotence_id:使用相同的值重复下单将返回同一订单,不会重复购买。频率限制 —— 每个密钥每分钟 120 次请求。
  • 订单状态(order/status → data.status):unpaid、in_process、completed、error、canceled、refund。若订单未能完成且款项未发生任何支出,金额将自动退回余额——状态为 refund;此类订单调用 order/download 会返回错误「Заказ имеет статус возврат.」(订单状态为退款)。

方法

GET  /api/v1/category/list
GET  /api/v1/group/list            ?category_id= &ids[]= &name=
GET  /api/v1/attribute/list
POST /api/v1/product/list          {"key", "ids":[…], "category_id", "group_id", "price_from", "price_to", "quantity_from", "page", "per-page"}
GET  /api/v1/product/view          ?id=
GET  /api/v1/product/top
GET  /api/v1/user/balance
GET  /api/v1/order/create          ?product= &quantity= &idempotence_id=
GET  /api/v1/order/status          ?id=
GET  /api/v1/order/download        ?id=

示例

curl "https://instamarket.pro/api/v1/user/balance?key=$KEY"
# {"success":true,"data":{"balance":25.4,"currency":"USD"}}

curl "https://instamarket.pro/api/v1/order/create?key=$KEY&product=37&quantity=10&idempotence_id=my-order-1"
# {"success":true,"data":{"status":"ok","id":11130,"link":"https://instamarket.pro/api/v1/order/file/11130/….txt"}}

# 错误 —— 始终返回 HTTP 200;错误码见 data.status,说明文字(俄语)见 data.message:
# {"success":false,"data":{"name":"Bad request","message":"Недостаточно средств на балансе.","code":0,"status":400}}
# 此处 data.message 的意思是:“余额不足。”

FAQ

13. Postman / Changelog / 支持

Postman 集合

下载所有 endpoints 的现成 Postman 集合: 下载 .postman_collection.json

变更日志

  • v1.10 (2026-11-22) — 自动退款:若订单未能发货且款项未发生任何支出,金额自动退回余额(status: "refunded",refunded: true,webhook)。重试键——Idempotency-Key 请求头或 idempotence_id 字段:使用相同的键重复请求不会创建第二个订单,键保留 30 天。
  • v1.9 (2026-11-21) — 快速发货:instant_delivery=true 商品的账号直接在 POST /v1/orders 的响应中返回(服务器最多等待约 4.5 秒,否则为 processing);GET /v1/instant 列出所有快速发货商品,1 件起购。
  • v1.8 (2026-11-07) —— 新增合作伙伴 API(/api/v1/category/list、product/list、user/balance、order/create、order/status、order/download):密钥通过 key 参数传递,仅限即时发货商品,仅接受由客服绑定的 IP 发出的订单。
  • v1.7 (2026-07-18) —— 新增 GET /v1/instant —— 仅返回可即时发货(instant_delivery=true)且当前有现货的商品。与 /v1/products 相同,但只包含快速发货商品;instant_stock 为实时库存,min_quantity=1。用现有的 POST /v1/orders 下单(商品有现货时同步返回 status=completed + items[])。
  • v1.6 (2026-07-16) — 新增 GET /v1/orders —— 分页列出该密钥的订单,支持 ?status= 筛选。此前只能凭自行保存的 order_id 查询单笔订单。列表不返回凭据 —— 凭据仅通过 GET /v1/orders/{id} 获取。
  • v1.5 (2026-07-09) — /v1/products 响应新增 instant_delivery(bool — 快速发货标记:商品有现货并立即发货)与 instant_stock(int — 可秒发数量)。此类商品即时交付,否则 30 秒 – 10 分钟。
  • v1.4 (2026-05-23) — 最低批量限制(600₽ 或商品 min_quantity);自动入账 cron 120s→5s;跨平台动态定价 +1%/15分钟 同样适用于 API;Webhook HMAC 签名(X-Webhook-Signature header);/api/docs 中加入 Try-it playground。
  • v1.3 (2026-05-23) — failed/expired/cancelled 自动退款(已取消:不再自动退款,改为联系客服人工退款),新增 refunded 字段,paid→processing 映射,响应含 created_at/updated_at。
  • v1.2 (2026-05-23) — 余额系统,POST /orders 余额扣款,webhook cron。
  • v1.1 (2026-05-23) — 限流 60/min/key,按密钥统计。
  • v1.0 (2026-05-23) — 只读目录接口(products/categories/health)。

支持

API 问题:Telegram 客服。SLA:工作时段 30 分钟(08:00-22:00 MSK)。 Telegram.