1. API v1 - 已弃用,请勿使用
ShipNitro CN
  • 身份验证
  • API v1 - 已弃用,请勿使用
    • 获取运输标签
      POST
    • 获取运费报价
      POST
    • 创建运输标签
      POST
    • 获取当前信用余额
      GET
  • API v2
    • 获取货件运费报价
      POST
    • 获取货件详情
      GET
    • 创建货件运输标签
      POST
    • 获取当前信用余额
      GET
    • 获取运单跟踪状态
      POST
    • 地址校验
      POST
  • 回调
    • v1 - 已弃用,请勿使用
      • 回调第 1 部分
    • v2
      • 客户创建运输标签回调
  • Schema
    • 运单号错误消息
  1. API v1 - 已弃用,请勿使用

创建运输标签

已棄用
预发布环境
https://staging.shipnitro.com/
预发布环境
https://staging.shipnitro.com/
POST
api/create/label
创建配送用的运输标签
请求体:
customer_shipment_id(字符串,可选):唯一字段。留空时,系统会自动生成 ID。如果此前已使用相同的 customer_shipment_id 发起调用,且状态为待处理或成功,则后续调用不会被处理。如果此前的货件处理失败,可使用相同的 customer_shipment_id 再次调用 API。
recipient(对象,必填):货件收件人信息。
company_name(字符串,可选):接收包裹的公司名称。
person_name(字符串,必填):收件人姓名。
phone_number(字符串,必填):收件人电话号码(10 个字符)。
address_line1(字符串,必填):收件人地址第 1 行。
address_line2(字符串,可选):收件人地址第 2 行。
state_code(字符串,必填):收件人所在地的州代码(例如,"IN" 表示印第安纳州)。
city(字符串,必填):收件人所在城市。
postal_code(字符串,必填):收件人所在地的邮政编码。
country_code(字符串,必填):收件人所在地的国家代码(例如,"US" 表示美国)。
parcels(数组,必填):包含包裹详情的数组。
weight(数字,必填):包裹重量。
width(数字,必填):包裹宽度。
height(数字,必填):包裹高度。
length(数字,必填):包裹长度。
weight_unit(字符串,必填):重量单位(例如,"LB" 表示磅)。
dimension_unit(字符串,必填):尺寸单位(例如,"IN" 表示英寸)。
count(数字,必填):相同规格的包裹数量。
reference_codes(对象,可选):货件的附加参考编号。
ref_1、ref_3(字符串):参考编号(ref_2 保留用于组织 ID)。
callback_url(字符串,可选):接收货件通知的 URL。
{
 "customer_shipment_id" :"1234555",
 "recipient": {
 		"company_name": "Shipnitro",
    "person_name" :"Test User",
    "phone_number":"9125929406",
    "address_line1": "1151 S GRAHAM RD",
    "state_code": "IN",
    "city": "GREENWOOD",
    "postal_code": "46143",
    "country_code": "US"
  },
  "parcels": [
    {
      "weight": 1,
      "width": 5,
      "height": 20,
      "length": 10,
      "weight_unit": "LB",
      "dimension_unit": "IN",
      "count": 2
    }
  ],
  "reference_codes": {
    "ref_1": "2333",
    "ref_3": "111"
  },
  "callback_url": "http://192.168.1.6:3001/"
}
批量发货时 PDF 数量较多,因此 PDF 会分块发送。
响应详情:
第一批数据包含 PDF 的相关信息,包括净费用和主运单号。
hash = 整个 PDF 的 MD5 哈希值,可在接收完成后用于校验 PDF 的完整性。
body = 包含经过 Base64 编码的 PDF 数据。
box_id = 请求的唯一 ID。
totalNumberOfPdf = 预计接收的 PDF 数量。
{
	'hash' : '------------',
	'body' :  [
			'masterTrackingNumber' => ,
			'netCharge' => null,
			'masterPDF' => null,
			'results' => [],
		]
	'box_id' : 'unique box id'
	'totalNumberOfPdf' : ''
}
第二批数据包含实际的 PDF 信息(系统将重复发送此类数据,直到所有 PDF 发送完毕)。
box_id - 与第一批数据中的请求唯一标识符相同。
contents - 经过 Base64 编码的 PDF 数据。
{
	'box_id': '',
	'contents' : ''
}
最后收到的回调响应为确认响应。收到此响应即表示所有 PDF 均已发送完毕,后续不会再发送数据:
{
	'box_id' : ''
	'finished' : true
}

請求

標頭參數

主體參數application/json

範例

回應

🟢200成功
application/json
主體application/json

請求請求範例
Shell
JavaScript
Java
Swift
curl --location 'https://staging.shipnitro.com/api/create/label' \
--header 'Authorization: Basic {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
    "recipient": {
        "address_line1": "100 Factory St, Ste C1",
        "address_line2": " ",
        "city": "Nashua",
        "country_code": "US",
        "state_code": "NH",
        "postal_code": "03060",
        "email": "",
        "person_name": "LISHU LIANG Andy60018",
        "company_name": "fengniao",
        "phone_number": "6468810775",
        "residential": false
    },
    "parcels": [
        {
            "length": 58,
            "width": 38,
            "height": 43,
            "weight": 13.78,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 57,
            "width": 37,
            "height": 43,
            "weight": 13.73,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 58,
            "width": 37,
            "height": 43,
            "weight": 13.75,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 57,
            "width": 37,
            "height": 43,
            "weight": 13.67,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 58,
            "width": 37,
            "height": 43,
            "weight": 13.77,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 58,
            "width": 37,
            "height": 43,
            "weight": 13.67,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 57,
            "width": 38,
            "height": 43,
            "weight": 13.76,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        },
        {
            "length": 57,
            "width": 37,
            "height": 43,
            "weight": 13.75,
            "count": 1,
            "weight_unit": "KG",
            "dimension_unit": "CM"
        }
    ],
    "reference_codes": {
        "ref_1": "BR88888006764K",
        "ref_2": "FL069785"
    },
    "callback_url":"127.0.0.1:"
}'
回應回應範例
{
    "box_id": "api_66675c95791e88f6c2019ab2",
    "message": "Label is generated label will be send later",
    "masterTrackingNumber": null
}
修改時間 2026-09-04 21:54:55
上一頁
获取运费报价
下一頁
获取当前信用余额
Built with