购买面单
详细字段参考以英文显示;字段名和 API 值保持不变。
POST
/api/shipping/buy请求
client_reference_idString · No | Customer Unique Reference ID. |
|---|---|
shipping_account_nameString · Yes | Name of the shipping account. |
carrier_typeString · Yes | Type of shipping carrier, e.g., 'usps'. |
service_typeString · Yes | Type of shipping service, e.g., 'usps_priority_mail'. |
confirmation_typeString · No | Type of delivery confirmation required, if any. |
insurance_provider_typeString · No | Insurance provider type, if insurance is required. |
dimension_unitString · Account default | Unit of measurement for package dimensions, e.g., 'in' for inches. When omitted, the checked controller uses the account setting; sending the unit explicitly is recommended. |
weight_unitString · Account default | Unit of weight for packages, e.g., 'oz' for ounces. When omitted, the checked controller uses the account setting; sending the unit explicitly is recommended. |
rate_idString · No | Unique identifier for a specific rate quote, if applicable. |
from.companyString · No | Sender's company name, if applicable. |
from.nameString · Yes | Full name of the sender. |
from.phoneString · No | Sender's phone number. |
from.emailString · No | The historical documentation lists this field, but the checked V1 shipping controller does not forward it. Do not rely on it reaching the carrier. |
from.street1String · Yes | Primary street address of the sender. |
from.street2String · No | Secondary street address of the sender. |
from.cityString · Yes | City of the sender's address. |
from.stateString · Yes | State of the sender's address. |
from.zipString · Yes | Postal code of the sender's address. |
from.countryString · Yes | Country code of the sender's address. |
from.residentialBoolean · Yes | Indicates if the sender's address is residential. |
to.companyString · No | Recipient's company name, if applicable. |
to.nameString · Yes | Full name of the recipient. |
to.phoneString · No | Recipient's phone number. |
to.emailString · No | The historical documentation lists this field, but the checked V1 shipping controller does not forward it. Do not rely on it reaching the carrier. |
to.street1String · Yes | Primary street address of the recipient. |
to.street2String · No | Secondary street address of the recipient. |
to.cityString · Yes | City of the recipient's address. |
to.stateString · Yes | State of the recipient's address. |
to.zipString · Yes | Postal code of the recipient's address. |
to.countryString · Yes | Country code of the recipient's address. |
to.residentialBoolean · Yes | Indicates if the recipient's address is residential. |
packages[].package_typeString · No | Type of package. |
packages[].lengthNumber · Yes | Length of the package. |
packages[].widthNumber · Yes | Width of the package. |
packages[].heightNumber · Yes | Height of the package. |
packages[].weightNumber · Yes | Weight of the package. |
packages[].insurance_amountNumber · No | Amount of insurance for the package. |
options.ship_dateDate String · Yes | The date the shipment is to be made. |
options.print_custom1String · No | Custom printing field 1. |
options.print_custom2String · No | Custom printing field 2. |
options.label_formatString · No | png or pdf, png as default |
options.label_data_typeString · No | url or raw, url as default |
customs.contents_typeString · Yes | Type of contents, e.g., 'merchandise'. |
customs.contents_explanationString · Yes | Explanation of the contents. |
customs.non_delivery_optionString · Yes | Action to take if delivery is not possible, e.g., 'return'. |
customs.eel_pfcString · No | Electronic Export Information or Proof of Filing Citation. |
customs.certifyBoolean · No | Indicates whether the sender certifies the information. |
customs.signerString · Yes | Name of the person signing the customs declaration. |
customs.items[].descriptionString · Yes | Description of the item. |
customs.items[].quantityNumber · Yes | Quantity of the item. |
customs.items[].valueNumber · Yes | Value of the item. |
customs.items[].currencyString · Yes | Currency of the item's value. |
customs.items[].weightNumber · Yes | Weight of the item. |
customs.items[].weight_unitString · Yes | Unit of weight for the item. |
customs.items[].tariff_numberString · No | Harmonized Tariff Schedule number for the item. |
customs.items[].origin_countryString · Yes | Country of origin for the item. |
{
"shipping_account_name": null,
"dimension_unit": "in",
"weight_unit": "lb",
"from": {
"name": "Sender",
"street1": "100 Example St",
"city": "Los Angeles",
"state": "CA",
"zip": "90001",
"country": "US"
},
"to": {
"name": "Recipient",
"street1": "200 Example Ave",
"city": "San Diego",
"state": "CA",
"zip": "92101",
"country": "US",
"residential": true
},
"packages": [
{
"length": 10,
"width": 8,
"height": 6,
"weight": 2
}
],
"rate_id": "<returned-rate-id>",
"client_reference_id": "<your-stable-reference>",
"options": {
"label_format": "pdf",
"label_data_type": "url"
}
}返回结果
idInteger | Unique identifier for the shipping label. |
|---|---|
tracking_numberString | Tracking number of the shipping label. |
shipping_account_nameString | Name of the shipping account used. |
carrier_typeString | Type of shipping carrier (e.g., 'usps'). |
service_typeString | Type of shipping service (e.g., 'usps_ground_advantage'). |
insurance_provider_typeString or Null | Insurance provider type, if applicable. |
insurance_costNumber | Cost of the insurance, if any. |
shipping_costNumber | Cost of shipping. |
currencyString | Currency of the shipping cost (e.g., 'usd'). |
dimension_unitString | Unit of dimension for packages (e.g., 'in'). |
weight_unitString | Unit of weight for packages (e.g., 'oz'). |
delivery_daysInteger | Estimated number of days for delivery. |
delivery_dateString or Null | Estimated delivery date, if available. |
ship_dateString | Date when the shipment was made. |
from.nameString | Sender's full name. |
from.companyString or Null | Sender's company name. |
from.phoneString or Null | Sender's phone number. |
from.emailString or Null | Sender's email address. |
from.street1String | Primary street address of the sender. |
from.street2String or Null | Secondary street address of the sender. |
from.cityString | City of the sender's address. |
from.stateString | State of the sender's address. |
from.zipString | Postal code of the sender's address. |
from.countryString | Country code of the sender's address. |
from.residentialBoolean | Indicates if the sender's address is residential. |
to.nameString | Recipient's full name. |
to.companyString or Null | Recipient's company name. |
to.phoneString or Null | Recipient's phone number. |
to.emailString or Null | Recipient's email address. |
to.street1String | Primary street address of the recipient. |
to.street2String or Null | Secondary street address of the recipient. |
to.cityString | City of the recipient's address. |
to.stateString | State of the recipient's address. |
to.zipString | Postal code of the recipient's address. |
to.countryString | Country code of the recipient's address. |
to.residentialBoolean | Indicates if the recipient's address is residential. |
packages[].package_typeString or Null | Type of package. |
packages[].insurance_amountNumber | Amount of insurance for the package. |
packages[].lengthNumber | Length of the package. |
packages[].widthNumber | Width of the package. |
packages[].heightNumber | Height of the package. |
packages[].weightNumber | Weight of the package. |
packages[].tracking_numberString | Tracking number for the package. |
packages[].label_urlString | URL for the shipping label of the package. |
forms[].typeString | Type of the form, e.g., 'commercial_invoice'. |
forms[].urlString | URL to access the form. |
created_atString | Timestamp of when the label was created. |
V1 responses use the original endpoint-specific JSON structure. Do not wrap them in the V2 code/message/data envelope.
接入说明
Send the same shipping plan with the selected rate_id. A client_reference_id allows the existing V1 controller to return a matching shipment rather than buy again. If another purchase holds the lock, it returns HTTP 202 with status purchasing and retry_after. For an uncertain result, preserve the same reference and confirm the existing shipment before creating a new purchase. Default label_format is png and label_data_type is url; pdf/raw are explicit options. This V1 behavior is not V2 Idempotency-Key.