Conventions
This page describes the response format, data types, pagination, time, idempotency, and rate-limit rules shared by all endpoints of the new protocol /open-api/v1. For format differences in the legacy protocol, see Legacy-Compatible Protocol.
Response Format
Single object or list:
{ "code": 200, "msg": "操作成功", "data": { } }Paginated:
{ "total": 125, "rows": [ { } ], "code": 200, "msg": "查询成功" }How to interpret a response:
| Case | HTTP status | code | Notes |
|---|---|---|---|
| Success | 200 | 200 | Some endpoints include a message in msg, such as "Order placed" (下单成功) or "Order already exists (idempotent response)" (订单已存在(幂等返回)) |
| Business failure | 200 | 500 / 404 / 400, etc. | msg is the reason and data is null |
| Authentication, permission, read-only, or rate-limit failure | 401 / 403 / 429 | Same as the HTTP status | The body is also {code, msg, data:null} |
Always check code
On a business failure the HTTP status is still 200, so checking only the HTTP status treats failures as successes. Always use code == 200 to determine success. For some paginated endpoints msg is null on success, so do not rely on msg.
Data Types
| Type | How it is output | Example |
|---|---|---|
| System IDs (order ID, SKU ID, etc.) | Output as strings when they exceed the JS safe-integer range; system IDs are generally strings | "wmsOrderId": "1800000000000000002" |
| Quantities, amounts, dimensions, weights | Always output as strings | "availableQty": "12.0000" |
| Time | yyyy-MM-dd HH:mm:ss string | "2026-11-20 10:00:00" |
| Null values | Output as null |
Recommendations: store IDs as strings; parse quantities and amounts with a decimal type, not floating point.
Date fields in requests accept 2026-11-20, 2026-11-20 10:00:00, and ISO format.
Pagination
| Parameter | Description |
|---|---|
pageNum | Page number, starting at 1; defaults to 1 |
pageSize | Rows per page. By default all rows are returned, so always pass it explicitly; the limit for /open-api/v1/sku/list is 1000 |
orderByColumn / isAsc | Optional; sort field and asc / desc |
When to stop paging
If the page number exceeds the total number of pages, the first page is returned instead of an empty list. Compute the total number of pages from total to stop paging; do not use "an empty page is returned" as the end condition.
import math
page_size, page_num, all_rows = 100, 1, []
while True:
body = call("GET", "/open-api/v1/oms/orders",
params={"pageNum": page_num, "pageSize": page_size, "status": 4})
all_rows += body["rows"]
if page_num >= math.ceil(body["total"] / page_size):
break
page_num += 1Units and Date Queries
- Dimension / weight units
sizeUnitandctnSizeUnit:1= KG/CM (default),2= LB/INCH. - The date query parameters
startDate/endDateuse the formatyyyy-MM-ddand filter by creation time from00:00:00to23:59:59of the day.
Idempotency
Retrying after a network timeout is common. The following endpoints do not create duplicate documents when the same business number is submitted again:
| Endpoint | Idempotency key | On duplicate submission |
|---|---|---|
POST /open-api/v1/oms/orders | externalOrderNo | If a non-canceled order already exists, it is returned as is, with msg "Order already exists (idempotent response)" (订单已存在(幂等返回)). Canceled orders are not blocked, so the same number can be placed again |
POST /open-api/v1/oms/inbound | packingNo | If a non-canceled shipment already exists, it is returned as is, with msg "Inbound forecast already exists (idempotent response)" (预约入库已存在(幂等返回)); a repeat submission for the same container number within 1 second is blocked |
POST /open-api/v1/oms/products | skuCode | If it already exists, the existing SKU is returned with msg "Product already exists (idempotent response)" (商品已存在(幂等返回)) and is not updated; use PUT to update |
Order creation in the legacy protocol is not idempotent; it returns an error instead. See Legacy-Compatible Protocol.
Rate Limits
| Dimension | Rule | When exceeded |
|---|---|---|
| Per Key | Fixed one-minute window; 600 calls by default, adjustable when creating the Key (up to 6000) | HTTP 429 "Too many requests; the API Key's limit of N per minute has been exceeded" (请求过于频繁,已超过该 API Key 每分钟 N 次的上限) |
| Authentication failures per IP | 30 per minute | HTTP 429 "Too many authentication failures, please try again later" (鉴权失败次数过多,请稍后再试) |
Successfully authenticated responses carry the following response headers, which you can use to pace your calls:
| Response header | Description |
|---|---|
X-RateLimit-Limit | The Key's per-minute limit |
X-RateLimit-Remaining | Calls remaining in the current minute |
X-Request-Id | The request ID; provide it when troubleshooting |
Polling recommendations:
- Poll document status no more often than every 60 seconds, and stop once it reaches a final state (Shipped, Canceled).
- Where possible, use a Webhook instead.
- After a 429, wait until the next minute before retrying; do not retry immediately.
Data Scope
A customer Key can only see its own data, and the warehouse parameter can only be a warehouse currently available to you. Querying someone else's document and querying a nonexistent document return the same result (code 404 "Data does not exist" (数据不存在), or an empty list), so the existence of other data is never revealed.
FAQ
Why is HTTP 200 returned but the operation did not succeed?
On a business failure the HTTP status is also 200, and the reason is in msg. Use code == 200 to determine success.
Why are quantities strings?
To avoid floating-point precision loss, all quantities, amounts, dimensions, and weights are output as strings, such as "12.0000". Parse them with a decimal type.
Why does paging never end?
If the page number exceeds the total number of pages, the first page is returned, so using an empty page as the end condition loops forever. Compute the total pages as total ÷ pageSize, rounded up.
Why is it slow when I do not pass pageSize?
Without pageSize, all data is returned. Always pass pageSize explicitly (100 to 500 recommended).
