Agent API
Agent API docs
Wholesale APIs for approved Agents: list supply, create orders at agent pricing, and poll fulfillment. Built for scripts, bots, and your own storefront.
Overview
Base URL is the site origin. All Agent routes live under /api/v1/agent/*. Only APPROVED products with supply-to-agents enabled are visible. Prices are agent prices (fixed or discount). Quantity per order is 1–5.
- Requires an approved Agent profile and API key
- Payments: USDT on TRC20 (default) or BEP20
- Create order returns pay address + amount; fulfillment follows payment
- Delivery payload via deliveryUrl with the same Agent auth
Replace https://YOUR_HOST with your origin (local: http://127.0.0.1:43321)
Authentication
Send your API key in either header. Keys are issued after Agent approval; the server stores only a SHA-256 hash.
Authorization: Bearer <api_key>x-api-key: <api_key>Missing/invalid key or non-approved Agent → HTTP 401 with {"error":"unauthorized"}.
Endpoints
/api/v1/agent/productsList products
Up to 100 in-stock supply products with listPrice and agentPrice.
Parameters
Authorization/x-api-key— required- Query: none
Sample response
{
"products": [
{
"id": "prod_xxx",
"slug": "x-account-sms",
"title": { "zh": "…", "en": "…", "ko": "…" },
"listPrice": "3.00",
"agentPrice": "2.40",
"stock": 73,
"deliveryType": "AUTO",
"category": "accounts"
}
]
}/api/v1/agent/ordersCreate order
Creates checkout + invoice at agent price. quantity 1–5; network TRC20 (default) or BEP20.
Request body
{
"productId": "prod_xxx",
"quantity": 1,
"network": "TRC20"
}productIdstring, requiredquantitynumber, 1–5 (default 1)networkTRC20|BEP20(default TRC20)
Sample response
{
"checkoutId": "chk_xxx",
"orderNumber": "XN123456",
"paymentId": "pay_xxx",
"amount": "2.40",
"address": "T…",
"payPath": "/pay/pay_xxx"
}/api/v1/agent/orders/:numberGet order
Fetch your order by number. When fulfilled, hasDelivery=true and deliveryUrl is set.
Parameters
numberpath — order number
Sample response
{
"number": "XN123456",
"status": "FULFILLED",
"deliveryType": "AUTO",
"quantity": 1,
"total": "2.40",
"hasDelivery": true,
"deliveryUrl": "/api/orders/XN123456/delivery",
"paymentStatus": "CONFIRMED"
}Error codes
- 401 unauthorized — missing or invalid API key
- 404 unavailable — product missing, not approved, or not for agents
- 404 not_found — order missing or not owned by this Agent
- 400 — business error (e.g. stock); error is a lowercase reason string
Agent pricing & supply
Products must have supplyToAgents enabled. Pricing modes:
- FIXED: unit price = agentPrice
- DISCOUNT: listPrice × (1 − agentDiscountPct) − agentDiscountAmt (floored at 0)
- If mode unset, falls back to listPrice
List returns only stock > 0. Create also checks supply flag and availability.
cURL examples
Replace https://YOUR_HOST with your origin (local: http://127.0.0.1:43321)
GET products
curl -sS "https://www.accsmkt.com/api/v1/agent/products" \
-H "Authorization: Bearer YOUR_API_KEY"POST orders
curl -sS -X POST "https://www.accsmkt.com/api/v1/agent/orders" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"productId":"prod_xxx","quantity":1,"network":"TRC20"}'GET order
curl -sS "https://www.accsmkt.com/api/v1/agent/orders/XN123456" \
-H "Authorization: Bearer YOUR_API_KEY"