> ## Documentation Index
> Fetch the complete documentation index at: https://developer.hct.com.tw/llms.txt
> Use this file to discover all available pages before exploring further.

# 1、上傳修改託運資料 - TransData

> **版本**：v1.0.1 \
>
> **狀態**：最終版 \
>
> **最後更新日期**：2026-11-24

## 文件概述

### 文件目的

* 上傳託運資料
* 取得可直接列印的標籤圖檔
* 取得貨號以及標籤資訊
* 修改上傳的託運資料

> **注意：**
>
> * 呼叫修改方式：帶相同的物流單號以及訂單編號。可以修改物流單號、訂單編號以外的欄位
> * 若公司有多個客戶代號（一般、冷藏、小物件...等），每筆託運資料請自行依照對應的客戶代號 、外箱件數 、重量、商品種類、出貨人相關訊息 輸入
> * 每次上傳多筆的託運資料，每一筆可以是不同的客戶代號
> * 要請司機收貨前，需準備託運總表(一式兩份）：[請參考【託運總表】說明](https://developer.hct.com.tw/files/logistics-share-docs/other/zh/logistics-shipping-manifest.md)

## 前置需求

* [ ] 公司帳號 (company)、公司密碼 (password)：向營業所申請
* [ ] 客戶代號 (escsno)：請洽詢營業所
* [ ] 每個客戶代號對應的資訊：請洽詢營業所，有客戶代號對應的重量...等資訊
* [ ] 出貨站 (esstno)：依簽約時約定內容設定，請洽詢營業所

## 身分驗證

本 API 目前不提供身份驗證機制，使用者可直接依 API Specification 進行呼叫。

## API 規格總覽

* SOAP Envelope、HTTP Request Header 及 Namespace 定義請參考 **[SOAP規格](https://developer.hct.com.tw/files/logistics-share-docs/protocol-specifications/zh/soap-specification.md)**

### 支援格式

| 環境 | 網址 |
| - | - |
| 測試環境 | [https://hctrt.hct.com.tw/edi\_webservice2\_test/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx) |
| 正式環境 | [https://hctrt.hct.com.tw/edi\_webservice2/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2/service1.asmx) |

| 規範項目 | 設定值 | 備註 |
| - | - | - |
| 回應逾時時間 | 60s | 伺服器處理並回傳資料的最大等待時間 |

### 資料格式

* 若為不需要回傳標籤圖檔，一次不可超過20筆
* 若為需要回傳標籤圖檔，每次上限5筆
* 欄位禁止輸入：`&"><'`（雙引號、單引號）
* 文字請使用utf-8

### API 端點

| 請求方法 | 端點 | SOAP 動作 | 驗證方式 | 說明 |
| - | - | - | - | - |
| POST | `/service1.asmx` | TransData\_Json | X | 支援JSON格式 |

## API 規格

### 請求格式

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | Body | SOAP Body | Y | SOAP Request Body | `<soap12:Body> </soap12:Body>` |
| 2 | TransData\_Json | Object | Y | SOAPAction:TransData\_Json Request 物件 | `<TransData_Json  xmlns="http://tempuri.org/"></TransData_Json >` |

* TransData\_Json 定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | company | String | Y | 公司帳號 | |
| 2 | password | String | Y | 公司密碼 | |
| 3 | json | Object | Y | 託運資料 | |

* json Object 定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | epino | String(30) | Y | 訂單編號 規則： 1.最長30字元 2.僅接受英文跟數字 3.未帶物流單號，單日不可重複 | 20260812000000000002 |
| 2 | ercsig | String(40) | Y | 收貨人名稱，僅可輸入中文 | 王小明 |
| 3 | ertel1 | String(20) | Y | 收貨人電話，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 4 | ertel2 | String(20) | N | 收貨人電話，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 5 | eraddr | String(100) | Y | 收件人地址  [請參考【送貨地址輸入規則-規則](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eraddr.md) | [請參考【送貨地址輸入規則-範例】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eraddr.md) |
| 6 | ejamt | String(4) | Y | 外箱件數，此筆託運資料所需使用的外箱件數，請填整數  [ 請參考【商品重量-件數】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/package-weight.md) | 1 |
| 7 | eqamt | String(5) | N | 重量，此筆託運資料所需使用的重量，請填整數 [請參考【商品重量-重量單位】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/package-weight.md) | 5 |
| 8 | esdate | String(8) | N | 出貨日期，預計給新竹物流包裹的時間(時區：UTC+8) 格式：yyyymmdd。若未帶入值，預設為當天日期（UTC+8） | |
| 9 | escsno | String(11) | N | 客戶代號，此筆託運資料所需使用的客戶代號 | 12345678901 |
| 10 | esstno | String(4) | N | 出貨站，不清楚請洽詢營業所 | 0001 |
| 11 | edelno | String(10) | N | 新竹貨號 若未帶入值，系統將自行配號 若需要自行上傳貨號請向開立帳號站所申請區間 規則：物流單號(9碼)+檢查碼(1碼) 檢查碼規則：前9碼除 以7的餘數=MOD(9位數,7) | 1234567891 |
| 12 | etcsig | String(40) | N | 出貨人名稱，僅可輸入中文 | 王大明 |
| 13 | ettel1 | String(15) | N | 出貨人電話1，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 14 | ettel2 | String(15) | N | 出貨人電話2，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 15 | etaddr | String(100) | N | 出貨地址，請填寫中文地址 | 臺北市中正區建國里重慶南路一段122號 |
| 16 | eddate | String(8) | N | 指定配送日期(時區：UTC+8) 格式：yyyymmdd。若未帶入值，表示未指定(週一至週四是隔日配，週五是下週一配，若碰到連假則會順延) **注意**： 1.配送日期最晚可指定至 D+10（含假日) 2.不可指定週日配送 3.星期一至星期四：日期需要大於D+1 4.星期五：固定於下週一配送；如需指定於週六配送，請輸入「D+1」。 | |
| 17 | eqmny | String(5) | N | 代收貨款，預設為0 | 1000 |
| 18 | eprdct | String(2) | N | 傳票類別 [請參考【傳票區分-說明】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eprdct.md) | [請參考【傳票區分-列舉值】vaule](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eprdct.md) |
| 19 | emark | String(100) | N | 備註，若取貨地在[請參考【備註-列舉值】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/emark.md)內請帶入對應關鍵字 | 易碎品(全家) |
| 20 | eprdcl2 | String(3) | N | 商品種類  [請參考【商品種類-說明】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eprdcl2.md) | [請參考【商品種類-列舉值】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eprdcl2.md) |
| 21 | egamt | String(5) | N | 報值金額。如有填寫，會依報值金額加收報值費 | 5000 |
| 22 | erenum | String(2) | N | 回單張數，需客戶代號已設定回單功能 | 1 |
| 23 | HAWB | String(50) | N | 小提單號（跨境業務必填） | HAWB123456789 |
| 24 | boxNo | String(50) | N | 報關箱號（跨境業務必填） | BOX001 |
| 25 | MAWB | String(50) | N | 大提單號（跨境業務必填） | MAWB987654321 |
| 26 | Declare | String(50) | N | 報單號碼（跨境業務必填） | DEC20260806001 |

### 回應規格

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 |
| - | - | - | - | - |
| 1 | Num | String(2) | 序號 | |
| 2 | success | String(1) | 結果  (Y:新增成功/R：修改成功/N：失敗) | |
| 3 | edelno | String(10) | 新竹貨號 | |
| 4 | epino | String(30) | 訂單編號 | |
| 5 | erstno | String(3) | 到著站號碼 | |
| 6 | eqamt | String(5) | 重量 | |
| 7 | image | | 標籤圖片Hex（十六進位）字串 | |
| 8 | ErrMsg | String(200) | 異常錯誤訊息 | |
| 9 | NewOutArea | String(20) | 新集貨註區 | |
| 10 | eqmny | String(5) | 代收貨款 | |
| 11 | CODE1 | String(1) | 類別 | |
| 12 | CODE2 | String(3) | 到著簡碼 | |
| 13 | CODE3 | String(1) | 衛星區 | |
| 14 | CODE4 | String(3) | 註區 | |
| 15 | CODE5 | String(5) | 疊區 | |
| 16 | CODE7 | String(11) | QRcode | |
| 17 | AREAS | String(5) | 聯運區提醒 | |
| 18 | MDCODE1 | String(5) | MD到著碼衛星區 | |
| 19 | MDCODE2 | String(3) | MD到著碼註區 | |
| 20 | MDCODE3 | String(1) | MD到著碼疊區 | |

#### HTTP 狀態碼

| 狀態碼 | 說明 |
| - | - |
| 200 | 成功 |

#### 業務錯誤代碼

| 錯誤代碼 | 說明 |
| - | - |
| 公司名稱或密碼錯誤 | |
| 貨號重複 | edelno欄位有誤 |
| 貨號錯誤 | edelno欄位有誤 |
| 貨號檢查碼錯誤 | edelno欄位有誤 |
| 訂單編號錯誤 | epino欄位有誤 |
| 客代錯誤 | escsno欄位有誤 |
| 件數錯誤 | ejamt欄位有誤 |
| 重量錯誤 | eqamt欄位有誤 |
| 收貨人名稱錯誤 | ercsig欄位有誤 |
| 收貨人電話錯誤 | ertel1欄位有誤 |
| 收貨人地址錯誤 | eraddr欄位有誤 |
| 出貨站錯誤 | esstno欄位有誤 |
| 代收貨款錯誤 | eqmny欄位有誤 |
| 報值金額錯誤 | egamt欄位有誤 |
| 總長請輸入重量60、90、120、150、151\~999 | eqamt欄位有誤 |
| 總長件數只能為1件 | ejamt欄位有誤 |
| 回單只能填入兩位數字 | erenum欄位有誤 |
| 外島綠島.蘭嶼.琉球.金門.連江等，沒有做低溫配送業務，只澎湖有做低溫配送業務 | |
| 資料錯誤請確認 | |
| 資料處理中，無法更新資料 | |
| 三個月內貨號重複 | |
| 訂單編號重複 | |

## SDK 與範例程式碼

### C#將image字串轉回圖片 範例

```csharp theme={null}
//字串轉byte
byte[] GetBytes(string HexString)
{
    int byteLength = HexString.Length / 2;
    byte[] bytes = new byte[byteLength];
    string hex;
    int j = 0;
    for (int i = 0; i < bytes.Length; i++)
    {
        hex = new String(new Char[]
        {
            HexString[j], HexString[j + 1]
        });
        bytes[i] = HexToByte(hex);
        j = j + 2;
    }
    return bytes;
}
byte HexToByte(string hex)
{
    if (hex.Length > 2 || hex.Length <= 0) throw new ArgumentException("hex must be 1 or 2 characters in length");
    byte newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
    return newByte;
}
//byte 轉成圖片
Bitmap image(byte[] b)
{
    //將byte 讀進MemoryStream
    MemoryStream ms = new MemoryStream(b);
    //轉回成圖片
    Bitmap bmp = (Bitmap) Bitmap.FromStream(ms);
    BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format1bppIndexed);
    //畫完圖, 把圖轉為1bit索引色(黑白單色)
    bmp = new Bitmap(bmp.Width, bmp.Height, bmpData.Stride, PixelFormat.Format1bppInd exed, bmpData.Scan0);
    return bmp;
}
```

### 範例

#### Request

```bash theme={null}
curl --location 'https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx' \
--header 'Content-Type: application/soap+xml; charset=utf-8' \
--data '<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <TransData_Json xmlns="http://tempuri.org/">
            <company>company</company>
            <password>password</password>
            <json>
            [
                {
                    "epino"  : "20260812000000000002",
                    "ercsig" : "王小明",
                    "ertel1" : "0912345678",
                    "ertel2" : "0223456789",
                    "eraddr" : "台北市信義區松仁路100號",
                    "ejamt"  : "1",
                    "eqamt"  : "10",
                    "esdate" : "20260815",
                    "escsno" : "",
                    "esstno" : "",
                    "edelno" : "",
                    "etcsig" : "王大明",
                    "ettel1" : "0912345678",
                    "ettel2" : "0223456789",
                    "etaddr" : "台北市信義區松仁路100號",
                    "eddate" : "20260812",
                    "eqmny"  : "0",
                    "eprdct" : "11",
                    "emark"  : "易碎",
                    "eprdcl2": "001",
                    "egamt"  : "5000",
                    "erenum" : "",
                    "HAWB"   : "",
                    "boxNo"  : "",
                    "MAWB"   : "",
                    "Declare": ""
                }
            ]
            </json>
        </TransData_Json>
    </soap12:Body>
</soap12:Envelope>'
```

#### Response

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <TransData_JsonResponse xmlns="http://tempuri.org/">
            <TransData_JsonResult>[
  {
    "Num": "1",
    "success": "Y",
    "edelno": "1004374792",
    "epino": "20260812000000000002",
    "erstno": "131",
    "eqamt": "10",
    "image": "89504E470...省略",
    "ErrMsg": "",
    "NewOutArea": " -131- -931-1  9311",
    "eqmny": "0",
    "CODE1": " ",
    "CODE2": "131",
    "CODE3": " ",
    "CODE4": "931",
    "CODE5": "1",
    "CODE7": "^131931931^",
    "AREAS": "*",
    "MDCODE1": " ",
    "MDCODE2": "931",
    "MDCODE3": "1"
  }
]</TransData_JsonResult>
        </TransData_JsonResponse>
    </soap:Body>
</soap:Envelope>
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.