Shipments
Truy vấn sản phẩm trả dữ liệu thật. Xem trước đơn và báo giá vận chuyển chỉ ước tính chi phí, không tạo hoặc thanh toán đơn. Tạo đơn mua là tạo đơn kinh doanh thật; thanh toán mua hàng và vận đơn có thể trừ tiền thật. Thông báo nhập kho tạo bản ghi, tạo vận đơn yêu cầu kho xử lý. Kiểm tra kích hoạt, đơn, số tiền và tài khoản. Lưu mã nghiệp vụ, dùng
Idempotency-Keytheo tài liệu; khi kết quả chưa rõ, truy vấn thao tác cũ trước khi trả tiền lần nữa.
Create, pay, cancel, intercept, list, and fetch international outbound shipments (/v1/fulfillment/shipments/*).
Lifecycle
Public status codes: PENDING → WAIT_PAYMENT → WAIT_SHIP → SHIPPED → SIGNED. Cancel → CANCELLED.
Create / pay still return a summary total (freight / services / discount / payment). List is lightweight; detail is the full view (split boxes, packing media, first/last-mile relabel, charge lines, warehouse timeline). Scan events stay on International tracking. Field reference: response models.
Retired: POST /v1/fulfillment/shipments/preview, POST /v1/fulfillment/shipments/logistics/trace, POST /v1/fulfillment/shipments/cancel, POST /v1/fulfillment/shipments/detail. Use {id}/tracking, {id}/cancel, and GET {id} instead. Exact freight is returned on create.
POST /v1/fulfillment/shipments/create
Required: tracking_numbers[], receiver, shipping_channel_code. Optional:
external_shipment_id— stable business/reconciliation id; it is not theIdempotency-Keyretry headerremarkreceiver.personal_code— optional personal customs clearance code (e.g. Korea PCCC). Pass when the shipping lane requires it; Gateway forwards the value as-is and does not validate format or presence.
Điền số kiện nào vào tracking_numbers[]?
Điểm đến Hoa Kỳ (địa chỉ minh họa và mã kênh cần thay):
{
"tracking_numbers": [
"YOUR_RECEIVED_PACKAGE_TRACKING_NUMBER"
],
"shipping_channel_code": "YOUR_US_CHANNEL_CODE",
"receiver": {
"name": "Alex Morgan",
"mobile": "+12025550123",
"country_code": "US",
"postal_code": "10001",
"address_line1": "123 Example Ave, Apt 4B",
"province": "New York",
"city": "New York"
},
"external_shipment_id": "your-shipment-us-001",
"remark": "Example consolidation request"
}Điểm đến Trung Quốc (ví dụ chuyển tiếp nội địa HIOBuy): API cũng hỗ trợ các khu vực Trung Quốc nằm trong phạm vi phục vụ của kênh. Với country_code: "CN", hãy ghi tên người nhận và province, city, address_line1, cùng address_line2 nếu dùng, bằng tiếng Trung. Ghi quận/huyện vào address_line1 vì API tạo đơn không chuyển tiếp trường receiver.district riêng. Chỉ dùng CN001 khi kênh khả dụng cho ứng dụng và điểm đến này.
{
"tracking_numbers": [
"YOUR_RECEIVED_PACKAGE_TRACKING_NUMBER"
],
"shipping_channel_code": "CN001",
"receiver": {
"name": "测试收件人",
"mobile": "+8613800000000",
"country_code": "CN",
"postal_code": "200000",
"province": "上海市",
"city": "上海市",
"address_line1": "浦东新区示例路88号3楼"
},
"external_shipment_id": "your-shipment-cn-001",
"remark": "中国境内转运示例"
}Shipment identifier rule
Detail, tracking, cancel, and pay accept the HioBuy shipment id or the external_shipment_id supplied at create time. Numeric-only path values are internal IDs; any value containing a non-digit is an external_shipment_id. Prefix developer identifiers, for example shp_MY-ORDER-001.
total.payment is the amount charged on pay:
{
"total": {
"freight": {
"amount": 8900,
"currency": "CNY"
},
"services": {
"amount": 1500,
"currency": "CNY"
},
"discount": {
"amount": 200,
"currency": "CNY"
},
"payment": {
"amount": 10200,
"currency": "CNY"
}
}
}Returns id, order_sn, and status (typically PENDING). Public id is the warehouse numeric PK as a string (e.g. "115"); order_sn is the warehouse order number (e.g. JIYUNRI1349). Subsequent pay / cancel / detail / tracking paths use this id.
Create errors (live warehouse → 4xx error object):
| HTTP | error.code | Warehouse upstream_code | Typical message |
|---|---|---|---|
| 404 | PARCEL_NOT_FOUND | SHIPMENT_PACKAGE_NOT_FOUND | 部分包裹不存在 |
| 400 | SHIPMENT_CREATE_EXCEPTION | SHIPMENT_CREATE_EXCEPTION | 请先更新包裹…物品属性信息 / 有包裹不是已入库,下单失败 |
| 400 | SHIPMENT_CREATE_FAILED | SHIPMENT_CREATE_FAILED | 创建订单失败 |
| 409 | EXTERNAL_ORDER_ID_ALREADY_EXISTS | EXTERNAL_ORDER_ID_ALREADY_EXISTS | 外部订单号已存在 |
POST /v1/fulfillment/shipments/{shipment_id}/pay
POST /v1/fulfillment/shipments/115/pay
Authorization: Bearer <API_KEY>Path {shipment_id} follows the identifier rule above. Body may be empty. Numeric-only values are sent as shipment_id; prefixed/non-numeric values are sent as external_shipment_id.
Charges fulfillment wallet. Successful pay → WAIT_SHIP.
Pay errors:
| HTTP | error.code | Warehouse upstream_code | Typical message |
|---|---|---|---|
| 404 | NOT_FOUND | SHIPMENT_NOT_EXISTS | 订单不存在 |
| 409 | SHIPMENT_NOT_READY_FOR_PAYMENT | SHIPMENT_NOT_READY_FOR_PAYMENT | 该批货物尚未达到可结算状态… |
| 409 | SHIPMENT_ALREADY_PAID | SHIPMENT_ALREADY_PAID | 订单已支付 |
| 402 | INSUFFICIENT_BALANCE | INSUFFICIENT_BALANCE | 余额不足 |
POST /v1/fulfillment/shipments/{shipment_id}/cancel
cancel_reason is required. The warehouse body contains the resolved shipment_id or external_shipment_id plus cancel_reason.
{
"cancel_reason": "buyer_request"
}Cancellable while PENDING or WAIT_PAYMENT. Success → CANCELLED.
POST /v1/fulfillment/shipments/{shipment_id}/intercept
v1 requests a hold after outbound has started. This does not change shipment lifecycle status. Warehouse upstream: POST /api/gateway-worker/v1/shipments/set-exceptional with { shipment_id, reason, remark }.
{
"reason": "CUSTOMER_REQUEST",
"remark": "Customer requested to stop the shipment before dispatch."
}reason is a fixed CODE: CUSTOMER_REQUEST / ADDRESS_ISSUE / ORDER_CHANGE / PAYMENT_ISSUE / COMPLIANCE_ISSUE / PACKAGE_ISSUE / OTHER. remark is required when reason is OTHER.
Success:
{
"shipment_id": "107",
"interception": {
"status": "REQUESTED",
"reason": "ADDRESS_ISSUE",
"remark": "Customer address needs to be corrected.",
"requested_at": "2026-08-20T12:30:00Z"
}
}interception.status: REQUESTED → PROCESSING → INTERCEPTED / FAILED. Detail can show status: "SHIPPED" with interception.status: "REQUESTED".
WAIT_SHIP / SHIPPED → Giao nhận; SHIPMENT_NOT_INTERCEPTABLE → Lỗi.
| HTTP | error.code |
|---|---|
| 404 | SHIPMENT_NOT_FOUND |
| 409 | SHIPMENT_NOT_INTERCEPTABLE |
| 409 | SHIPMENT_INTERCEPTION_ALREADY_REQUESTED |
| 422 | INVALID_INTERCEPTION_REASON |
| 422 | INTERCEPTION_REMARK_REQUIRED |
GET /v1/fulfillment/shipments
GET /v1/fulfillment/shipments?status=WAIT_SHIP&created_from=2026-08-01&page=1&page_size=20
Authorization: Bearer <API_KEY>Lightweight rows. Split boxes, packing files, legs, charge lines, timeline, and interception stay on detail. Warehouse upstream: POST /api/gateway-worker/v1/shipments/index.
| Query | Notes |
|---|---|
status | Comma-separated or repeated. PENDING / WAIT_PAYMENT / WAIT_SHIP / SHIPPED / SIGNED / CANCELLED |
created_from | Lower bound (YYYY-MM-DD or datetime) |
created_to | Upper bound |
page | Default 1 |
page_size | Default 20, max 100 |
Each row has id (warehouse numeric PK as a string), order_sn, external_shipment_id, status, international_tracking, receiver, shipping_channel, services, total, payment_status, and times. Empty warehouse strings become null. Amounts are fen.
International tracking lives only on international_tracking — there is no top-level tracking_number. List times omit updated_at / packing_started_at (those stay on detail).
{
"data": [
{
"id": "107",
"order_sn": "JIYUNRI1338",
"status": "WAIT_SHIP",
"external_shipment_id": "MY-INTL-ORDER-001",
"international_tracking": {
"tracking_number": null,
"carrier": null
},
"receiver": {
"name": "John Doe",
"mobile": "+12025550123",
"email": "john@example.com",
"country_code": "US",
"province": "California",
"city": "Los Angeles",
"district": null,
"postal_code": "90001",
"address_line1": "123 Main St",
"address_line2": "Apt 4B",
"personal_code": null
},
"shipping_channel": {
"code": "PUHUO",
"name": "General Cargo Air Line"
},
"services": [
{
"id": "2",
"service_code": "2",
"name": "Package Reinforcement",
"quantity": 1,
"status": "PENDING"
}
],
"total": {
"charges": {
"amount": 2000,
"currency": "CNY"
},
"discount": {
"amount": 0,
"currency": "CNY"
},
"payable": {
"amount": 2000,
"currency": "CNY"
},
"paid": {
"amount": 0,
"currency": "CNY"
},
"outstanding": {
"amount": 2000,
"currency": "CNY"
}
},
"payment_status": "UNPAID",
"times": {
"created_at": "2026-08-20T09:41:36Z",
"packed_at": "2026-08-20T10:20:00Z",
"paid_at": null,
"shipped_at": null,
"delivered_at": null,
"cancelled_at": null
}
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total": 1,
"total_pages": 1
},
"monetary_unit": "CNY_minor",
"request_id": "req_xxx"
}GET /v1/fulfillment/shipments/{shipment_id}
GET /v1/fulfillment/shipments/107?language=en
Authorization: Bearer <API_KEY>Path {shipment_id} follows the identifier rule above. Optional language is for display names (shipping_channel.name, services[].name, charges[].name). Do not expect status_name.
Warehouse upstream receives the resolved shipment_id or external_shipment_id. Public id is the warehouse numeric PK as a string (e.g. "107"); order_sn is the warehouse order number.
This shape covers warehouse facts create/pay cannot express:
| Problem | Where to look |
|---|---|
| Split outbound cartons | boxes[]; multi_box: true when more than one carton |
| International tracking number | international_tracking; per carton boxes[].tracking |
| Warehouse business events | timeline[] (created / packed / paid). Not scan events |
| Packing photos / video | files[]: PACKING_IMAGE / PACKING_VIDEO |
| Relabel (first mile ≠ last mile) | shipping_legs[] when the warehouse sends first/last-mile numbers |
| Block | Meaning |
|---|---|
source_packages | Inbound domestic packages before consolidation (pkg_* + China tracking number) |
boxes | Packed outbound cartons; empty [] until packed |
international_tracking | Shipment-level last-mile { tracking_number, carrier }; both null before outbound |
timeline | Warehouse business events using { code, status, title, occurred_at, details }. Codes are stable and never empty or null |
shipping_legs | Line-haul vs destination last mile after relabel; [] until numbers exist |
files | Packing media (not inbound VAS photos on the package) |
charges | Line items. Discount rows are negative |
total | charges / discount (positive) / payable / paid / outstanding |
payment_status | UNPAID / PAID / PARTIAL |
times | Timestamps; unused nodes are null |
interception | Intercept handling, or null. Independent of shipment status |
Amounts are fen (monetary_unit: CNY_minor). Empty arrays are [], not omitted.
Timeline contract
Shipment status follows PENDING → WAIT_PAYMENT → WAIT_SHIP → SHIPPED → SIGNED; cancellation is CANCELLED. Every timeline[] item requires code, status, title, occurred_at, and details. Codes are stable and non-null, timestamps are timezone-aware ISO 8601, details is {} when empty, and events are newest first. Use code and status for program logic; title is localized display copy.
| Event code | Meaning | Shipment status after event | Required details |
|---|---|---|---|
SHIPMENT_CREATED | Shipment created | PENDING | — |
SHIPMENT_PACKED | Packing completed | WAIT_PAYMENT | — |
SHIPMENT_PAID | Shipment paid | WAIT_SHIP | — |
SHIPMENT_DISPATCHED | Dispatched from warehouse | SHIPPED | — |
SHIPMENT_SIGNED | Delivered and signed for | SIGNED | — |
SHIPMENT_CANCELLED | Shipment cancelled | CANCELLED | — |
SHIPMENT_INTERCEPTION_REQUESTED | Interception requested | Unchanged: WAIT_SHIP or SHIPPED | reason; optional remark |
SHIPMENT_INTERCEPTION_PROCESSING | Interception processing | Unchanged: WAIT_SHIP or SHIPPED | reason; optional remark |
SHIPMENT_INTERCEPTION_SUCCEEDED | Interception succeeded | Unchanged: WAIT_SHIP or SHIPPED | reason; optional remark |
SHIPMENT_INTERCEPTION_FAILED | Interception failed | Unchanged: WAIT_SHIP or SHIPPED | reason; optional failure_code, failure_message |
PICKUP_STATION_ARRIVED | Arrived at pickup station | SHIPPED | station_name |
PICKUP_STATION_SHELVED | Shelved at pickup station | SHIPPED | station_name |
PICKUP_STATION_CHECKED_OUT | Checked out from pickup station | SHIPPED | station_name |
PICKUP_STATION_TRANSFERRED_OUT | Transferred out from pickup station | SHIPPED | station_name |
DISTRIBUTION_CENTER_SORTED | Sorted at distribution center | SHIPPED | Optional facility_name |
Interception is independent: interception.status follows REQUESTED → PROCESSING → INTERCEPTED or FAILED and never overwrites top-level shipment status. Pickup-station names are returned both in rendered title and details.station_name.
{
"id": "107",
"order_sn": "JIYUNRI1338",
"status": "SHIPPED",
"external_shipment_id": "MY-INTL-ORDER-001",
"source_packages": [
{
"id": "pkg_01K2ABC001",
"tracking_number": "SF2026082001"
},
{
"id": "pkg_01K2ABC002",
"tracking_number": "YT2026082002"
}
],
"receiver": {
"name": "John Doe",
"mobile": "+12025550123",
"email": "john@example.com",
"country_code": "US",
"province": "California",
"city": "Los Angeles",
"district": null,
"postal_code": "90001",
"address_line1": "123 Main St",
"address_line2": "Apt 4B",
"personal_code": null
},
"shipping_channel": {
"code": "PUHUO",
"name": "General Cargo Air Line"
},
"multi_box": true,
"international_tracking": {
"tracking_number": "1Z999999999",
"carrier": "UPS"
},
"timeline": [
{
"code": "SHIPMENT_PAID",
"status": "WAIT_SHIP",
"title": "Shipment paid",
"occurred_at": "2026-08-20T10:30:00Z",
"details": {}
},
{
"code": "SHIPMENT_PACKED",
"status": "WAIT_PAYMENT",
"title": "Shipment packed",
"occurred_at": "2026-08-20T10:20:00Z",
"details": {}
},
{
"code": "SHIPMENT_CREATED",
"status": "PENDING",
"title": "Shipment created",
"occurred_at": "2026-08-20T09:41:36Z",
"details": {}
}
],
"boxes": [
{
"id": "box_01K2BOX001",
"box_no": "JIYUNRI1338-1",
"status": "SHIPPED",
"source_package_ids": [
"pkg_01K2ABC001",
"pkg_01K2ABC002"
],
"weight": {
"value": 4.25,
"unit": "kg"
},
"dimensions": {
"length": 45,
"width": 35,
"height": 30,
"unit": "cm"
},
"chargeable_weight": {
"value": 4.73,
"unit": "kg"
},
"tracking": {
"tracking_number": "1Z999999001",
"carrier": "UPS"
}
}
],
"shipping_legs": [
{
"type": "FIRST_MILE",
"carrier": "HioBuy Linehaul",
"tracking_number": "HB202608200001",
"origin_country": "CN",
"destination_country": "US",
"status": "DELIVERED",
"shipped_at": "2026-08-20T12:00:00Z",
"delivered_at": "2026-08-22T04:30:00Z"
},
{
"type": "LAST_MILE",
"carrier": "UPS",
"tracking_number": "1Z999999999",
"origin_country": "US",
"destination_country": "US",
"status": "IN_TRANSIT",
"shipped_at": "2026-08-22T08:00:00Z",
"delivered_at": null
}
],
"files": [
{
"id": "file_01K2ABC001",
"type": "PACKING_IMAGE",
"url": "https://cdn.hiobuy.com/shipments/JIYUNRI1338/packing-01.jpg",
"created_at": "2026-08-20T10:20:00Z"
}
],
"charges": [
{
"type": "FREIGHT",
"code": "FREIGHT",
"name": "Shipping Fee",
"amount": {
"amount": 3200,
"currency": "CNY"
}
},
{
"type": "COUPON_DISCOUNT",
"code": "COUPON",
"name": "Coupon Discount",
"amount": {
"amount": -300,
"currency": "CNY"
}
}
],
"total": {
"charges": {
"amount": 3200,
"currency": "CNY"
},
"discount": {
"amount": 300,
"currency": "CNY"
},
"payable": {
"amount": 2900,
"currency": "CNY"
},
"paid": {
"amount": 2900,
"currency": "CNY"
},
"outstanding": {
"amount": 0,
"currency": "CNY"
}
},
"payment_status": "PAID",
"times": {
"created_at": "2026-08-20T09:41:36Z",
"updated_at": "2026-08-22T08:10:00Z",
"packing_started_at": "2026-08-20T10:00:00Z",
"packed_at": "2026-08-20T10:20:00Z",
"paid_at": "2026-08-20T10:30:00Z",
"shipped_at": "2026-08-20T12:00:00Z",
"delivered_at": null,
"cancelled_at": null
},
"interception": null,
"monetary_unit": "CNY_minor",
"request_id": "req_xxx"
}See response models for charge type values.
Get Support
Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days