準備請求
建立申報單需要將貨物資料組織成適當的結構。API 採用分層方法,首先建立申報單,然後新增包含個別貨物詳細資訊的申報單行。
每個元件都有特定的必填欄位,以確保海關合規性和準確的文件記錄。以下我們列出了基本資料結構和必填輸入。
關鍵輸入類型
申報單 API 使用多種輸入類型來組織貨物資料:
ManifestInput:高層級貨物資訊,包括機場、運單類型和飛行詳細資訊ManifestLineInput:連結至申報單的個別貨物詳細資訊ManifestLineItemInput:海關分類用的產品資訊CreatePartyInput:原產地和目的地的交易方和位置詳細資訊
檢視我們 GraphQL API 參考資料 中的完整欄位定義和選項。
透過 API 建立申報單
一旦您已組織好貨物資料,就可以傳送 GraphQL 變更以建立申報單。
步驟 1:建立申報單標題
1
mutation ManifestCreate($input: ManifestInput!) {2
manifestCreate(input: $input) {3
id4
amount5
arrivalDate6
awbNumber7
awbPrefix8
carrierCode9
createdAt10
createdBy11
destinationCode12
operatorDestination13
operatorOrigin14
originCode15
postalOperatorCode16
serviceNumber17
source18
transportationMode19
updatedAt20
updatedBy21
weight22
weightUnit23
statusTransitions {24
createdAt25
createdBy26
note27
source28
}29
lines(first: 5) {30
totalCount31
edges {32
cursor33
node {34
id35
trackingNumber36
endUse37
currencyCode38
createdAt39
createdBy40
updatedAt41
updatedBy42
landedCost {43
id44
}45
}46
}47
}48
}49
}RESPONSE
json
{
"data": {
"manifestCreate": {
"id": "manifest_abc123def456",
"amount": "0",
"arrivalDate": "2026-03-15T14:30:00.000Z",
"awbNumber": "1234",
"awbPrefix": "001",
"carrierCode": "AA",
"createdAt": "2026-01-06T12:00:00.000Z",
"createdBy": "organization_xyz789",
"destinationCode": "JFK",
"operatorDestination": "US",
"originCode": "LHR",
"postalOperatorCode": "J1CGBA",
"serviceNumber": "1234",
"source": "API",
"transportationMode": "AIR",
"updatedAt": "2026-01-06T12:00:00.000Z",
"updatedBy": "organization_xyz789",
"weight": "0",
"weightUnit": "KILOGRAM",
"statusTransitions": [],
"lines": {
"totalCount": 0,
"edges": []
}
}
}
}
步驟 2:新增申報單行
使用從 manifestCreate 變更傳回的 ID,現在可以將個別貨物連結至申報單。
1
mutation ManifestLineCreate($manifestId: ID!, $input: ManifestLineInput!) {2
manifestLineCreate(manifestId: $manifestId, input: $input) {3
id4
manifestId5
trackingNumber6
endUse7
currencyCode8
referenceNumber9
arrivalDate10
createdAt11
createdBy12
updatedAt13
updatedBy14
landedCost {15
id16
}17
}18
}RESPONSE
json
{
"data": {
"manifestLineCreate": {
"id": "manifest_line_def456ghi789",
"manifestId": "manifest_abc123def456",
"trackingNumber": "LX123456789GB",
"endUse": "NOT_FOR_RESALE",
"currencyCode": "USD",
"referenceNumber": "ORDER-2026-001",
"arrivalDate": "2026-03-15T14:30:00.000Z",
"createdAt": "2026-01-06T12:05:00.000Z",
"createdBy": "organization_xyz789",
"updatedAt": "2026-01-06T12:05:00.000Z",
"updatedBy": "organization_xyz789",
"landedCost": null
}
}
}
步驟 3:批量新增多個申報單行
為了提高效率,您可以使用 manifestLinesCreate 變更在單一請求中新增多個申報單行。每一行都需要其自己的 parties 陣列來定義貨物的原產地和目的地。
1
mutation ManifestLinesCreate($manifestId: ID!, $input: [ManifestLineInput!]!) {2
manifestLinesCreate(manifestId: $manifestId, input: $input) {3
id4
manifestId5
trackingNumber6
endUse7
currencyCode8
createdAt9
}10
}RESPONSE
json
{
"data": {
"manifestLinesCreate": [
{
"id": "manifest_line_aaa111bbb222",
"manifestId": "manifest_abc123def456",
"trackingNumber": "LX123456789GB",
"endUse": "NOT_FOR_RESALE",
"currencyCode": "USD",
"createdAt": "2026-01-06T12:10:00.000Z"
},
{
"id": "manifest_line_ccc333ddd444",
"manifestId": "manifest_abc123def456",
"trackingNumber": "LX987654321GB",
"endUse": "GIFT",
"currencyCode": "USD",
"createdAt": "2026-01-06T12:10:00.000Z"
}
]
}
}
步驟 4:更新申報單
如果飛行詳細資訊已變更,您可以使用下列變更來更新申報單詳細資訊。source 欄位為必填,並指示更新的資料來源。
1
mutation ManifestUpdate($id: ID!, $input: ManifestUpdateInput!) {2
manifestUpdate(id: $id, input: $input) {3
id4
amount5
arrivalDate6
awbNumber7
awbPrefix8
carrierCode9
createdAt10
createdBy11
destinationCode12
operatorDestination13
operatorOrigin14
originCode15
postalOperatorCode16
serviceNumber17
source18
transportationMode19
updatedAt20
updatedBy21
weight22
weightUnit23
statusTransitions {24
createdAt25
createdBy26
note27
source28
}29
}30
}RESPONSE
json
{
"data": {
"manifestUpdate": {
"id": "manifest_abc123def456",
"amount": "150.50",
"arrivalDate": "2026-03-16T10:00:00.000Z",
"awbNumber": "5678",
"awbPrefix": "001",
"carrierCode": "BA",
"createdAt": "2026-01-06T12:00:00.000Z",
"createdBy": "organization_xyz789",
"destinationCode": "JFK",
"operatorDestination": "US",
"originCode": "LHR",
"postalOperatorCode": "J1CGBA",
"serviceNumber": "5678",
"source": "RESDIT",
"transportationMode": "AIR",
"updatedAt": "2026-01-06T14:30:00.000Z",
"updatedBy": "organization_xyz789",
"weight": "25.5",
"weightUnit": "KILOGRAM",
"statusTransitions": [
{
"createdAt": "2026-01-06T14:30:00.000Z",
"createdBy": "organization_xyz789",
"note": "Flight rescheduled due to weather",
"source": "RESDIT"
}
]
}
}
}
資料來源值
ManifestUpdateInput 中的 source 欄位接受下列值:
| 值↕ | 描述↕ |
|---|---|
CARDIT | 承運商資料交換 |
PRECON | 預先託運通知 |
PREDES | 預先派遣通知 |
RESDIT | 派遣回應 |
為美國出貨準備海關申報單。
向 Zonos 提供進口郵寄貨物資料。Zonos 將準備包含郵寄貨物進入美國所需所有資訊的完整海關申報單。