代理 API 对接文档
面向代理 / 分销商:查询商品与库存、按代理价下单、自动发货、下载账号文件。全部走 HTTPS,使用 API 密钥鉴权。
1. 快速开始
- 在 本站 注册账号(邮箱 + 密码)
- 登录后点右上「安全」→「API 密钥」→ 生成,复制
cgyl_... 密钥(只显示一次)
- 用 USDT-TRC20 充值(站内「充值」,按页面显示的精确金额转账,自动到账)
- 调
GET /api/v1/products 取商品和库存
- 调
POST /api/v1/orders 下单,然后轮询订单状态,完成后下载
2. 鉴权
所有接口都要带请求头:
X-Api-Key: cgyl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
密钥与账号绑定,扣的是该账号的美元余额。密钥在「安全 → API 密钥」里生成,可生成多个、可随时删除(删除后立即失效)。
3. 商品列表
GET/api/v1/products?shop=tg|cg|baos
| shop | 说明 |
| tg | 商店一(session+json 协议号为主) |
| cg | 商店三(tdata 直登号) |
| baos | 商店二(多国协议号 / 会员号) |
GET /api/v1/products?shop=tg
X-Api-Key: cgyl_xxx
{
"ok": true, "shop": "tg", "total": 120,
"items": [
{
"sku": "tgd3f613de",
"name": "🇨🇴+58哥伦比亚(苹果协议)",
"category": "协议号 / 直登号(全区)",
"stock": 2418,
"price": 0.30, // 你的代理价(USD)
"format": "session_json",
"currency": "USD"
}
]
}
4. 余额
GET/api/v1/balance
{"ok": true, "balance": 25.00, "currency": "USD"}
5. 下单
POST/api/v1/orders
| 字段 | 类型 | 必填 | 说明 |
| shop | string | 是 | tg / cg / baos |
| sku | string | 是 | 商品编号(baos 用 uni) |
| count | int | 是 | 数量 1~50 |
POST /api/v1/orders
X-Api-Key: cgyl_xxx
{"shop":"tg","sku":"tgd3f613de","count":1}
200 {"ok":true,"order_id":"0472f567a8f74296","usd_total":0.30,"status":"pending","shop":"tg"}
400 {"ok":false,"error":"余额不足(需 $0.30,当前 $0.10)"}
409 {"ok":false,"error":"库存不足(当前剩 3 个),请刷新后重试"}
下单即扣余额(原子操作);发货失败/部分发货会自动退回差额。
6. 查询订单
GET/api/v1/orders/{order_id} 单个
GET/api/v1/orders?limit=50 列表
GET /api/v1/orders/0472f567a8f74296
X-Api-Key: cgyl_xxx
{"ok":true,"order":{
"order_id":"0472f567a8f74296","status":"delivered",
"product":"🇨🇴+58哥伦比亚(苹果协议)","count":1,"usd_total":0.30,
"created":1795175526,"error":null,
"download_path":"/api/v1/orders/0472f567a8f74296/download"}}
| status | 含义 |
| pending | 处理中(供应商发货中) |
| delivered | 已发货,可下载 |
| failed | 失败(已自动退款) |
| refunded | 已退款 |
建议每 3~5 秒查一次,直到 status 变成终态。
7. 下载账号文件
GET/api/v1/orders/{order_id}/download
GET /api/v1/orders/0472f567a8f74296/download
X-Api-Key: cgyl_xxx
→ 返回 zip 文件(Content-Disposition: attachment)
文件是供应商原始账号包:session+json 或 tdata 目录,按商品 format 字段判断。
8. 完整示例(Python)
import requests, time
KEY = "cgyl_xxxxxxxxxxxxxxxxxxxxxxxx"
B = "https://cgyinliu.vip"
H = {"X-Api-Key": KEY}
# 余额
print(requests.get(B + "/api/v1/balance", headers=H).json())
# 取商品
items = requests.get(B + "/api/v1/products", params={"shop": "tg"}, headers=H).json()["items"]
sku = items[0]["sku"]
# 下单
o = requests.post(B + "/api/v1/orders", headers=H,
json={"shop": "tg", "sku": sku, "count": 1}).json()
oid = o["order_id"]
# 轮询
while True:
d = requests.get(B + "/api/v1/orders/" + oid, headers=H).json()["order"]
if d["status"] in ("delivered", "failed", "refunded"):
break
time.sleep(4)
# 下载
if d["status"] == "delivered":
r = requests.get(B + "/api/v1/orders/" + oid + "/download", headers=H)
open("accounts.zip", "wb").write(r.content)
9. 价格与结算
- 计价单位:美元(USD),按
/api/v1/products 返回的 price 扣费(代理价固定)
- 充值:站内「充值」生成唯一金额(USDT-TRC20),转账后自动到账,10 分钟内有效
- 余额不足会直接拒绝下单,不会产生欠款
10. 错误码
| HTTP | error | 说明 |
| 401 | invalid_api_key | 密钥错误或已删除 |
| 400 | bad_shop / 参数错误 | 检查 shop、sku、count |
| 402 / 400 | 余额不足 | 充值后重试 |
| 409 | 库存不足 / not_ready | 刷新商品或等发货完成 |
| 404 | order_not_found | 订单不属于该密钥账号 |
| 429 | 下单太频繁 | 每账号 6 次/分钟 |
Reseller API
For resellers / distributors: browse products and stock, place orders at reseller price, auto-delivery and file download. HTTPS only, authenticated with an API key.
1. Quick start
- Create an account on the store (email + password)
- Sign in → top-right “Security” → “API keys” → Create, copy the
cgyl_... key (shown once)
- Top up with USDT-TRC20 (use the exact amount shown; credited automatically)
- Call
GET /api/v1/products to list products and stock
- Call
POST /api/v1/orders, poll the order, then download
2. Authentication
X-Api-Key: cgyl_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keys are bound to your account and spend that account's USD balance. Create or revoke keys under Security → API keys.
3. Products
GET/api/v1/products?shop=tg|cg|baos
| shop | Description |
| tg | Shop 1 · Daxi (API supplier, session+json mostly) |
| cg | Shop 3 · Chunge (tdata accounts) |
| baos | Shop 2 (protocol / membership accounts) |
GET /api/v1/products?shop=tg
X-Api-Key: cgyl_xxx
{
"ok": true, "shop": "tg", "total": 120,
"items": [
{"sku":"tgd3f613de","name":"🇨🇴+57 Colombia (Apple session)",
"category":"session+json / tdata","stock":2418,
"price":0.30,"format":"session_json","currency":"USD"}
]
}
4. Balance
GET/api/v1/balance
{"ok":true,"balance":25.00,"currency":"USD"}
5. Create order
POST/api/v1/orders
| Field | Type | Required | Notes |
| shop | string | yes | tg / cg / baos |
| sku | string | yes | Product id (baos uses uni) |
| count | int | yes | 1–50 |
POST /api/v1/orders
X-Api-Key: cgyl_xxx
{"shop":"tg","sku":"tgd3f613de","count":1}
200 {"ok":true,"order_id":"0472f567a8f74296","usd_total":0.30,"status":"pending","shop":"tg"}
400 {"ok":false,"error":"Insufficient balance (need $0.30, have $0.10)"}
409 {"ok":false,"error":"Out of stock (3 left), please refresh"}
Balance is deducted atomically at order time. Failures/partial deliveries are refunded automatically.
6. Order status
GET/api/v1/orders/{order_id} single
GET/api/v1/orders?limit=50 list
GET /api/v1/orders/0472f567a8f74296
X-Api-Key: cgyl_xxx
{"ok":true,"order":{"order_id":"0472f567a8f74296","status":"delivered",
"product":"🇨🇴+57 Colombia (Apple session)","count":1,"usd_total":0.30,
"created":1795175526,"error":null,
"download_path":"/api/v1/orders/0472f567a8f74296/download"}}
| status | Meaning |
| pending | Processing (supplier delivering) |
| delivered | Delivered, ready to download |
| failed | Failed (auto-refunded) |
| refunded | Refunded |
Poll every 3–5 seconds until a final status.
7. Download
GET/api/v1/orders/{order_id}/download
GET /api/v1/orders/0472f567a8f74296/download
X-Api-Key: cgyl_xxx
→ zip file (Content-Disposition: attachment)
Files are the supplier's original packages: session+json or tdata, per the product's format field.
8. Example (Python)
import requests, time
KEY = "cgyl_xxxxxxxxxxxxxxxxxxxxxxxx"
B = "https://cgyinliu.vip"
H = {"X-Api-Key": KEY}
print(requests.get(B + "/api/v1/balance", headers=H).json())
items = requests.get(B + "/api/v1/products", params={"shop": "tg"}, headers=H).json()["items"]
sku = items[0]["sku"]
o = requests.post(B + "/api/v1/orders", headers=H,
json={"shop": "tg", "sku": sku, "count": 1}).json()
oid = o["order_id"]
while True:
d = requests.get(B + "/api/v1/orders/" + oid, headers=H).json()["order"]
if d["status"] in ("delivered", "failed", "refunded"):
break
time.sleep(4)
if d["status"] == "delivered":
r = requests.get(B + "/api/v1/orders/" + oid + "/download", headers=H)
open("accounts.zip", "wb").write(r.content)
9. Pricing & billing
- Currency: USD; charged at the
price returned by the product API
- Top up via USDT-TRC20 with the exact amount shown (valid 10 minutes)
- Insufficient balance rejects the order — no negative balance
10. Errors
| HTTP | error | Notes |
| 401 | invalid_api_key | Key invalid or revoked |
| 400 | bad_shop / bad params | Check shop, sku, count |
| 402 / 400 | insufficient balance | Top up and retry |
| 409 | out of stock / not_ready | Refresh products or wait |
| 404 | order_not_found | Order belongs to another account |
| 429 | rate limited | 6 orders/minute per account |