準備請求
創建申報單需要將你的貨運數據組織成適當的結構。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 將準備全面的海關申報單,包含進口到美國的郵件貨運所需的所有必要信息。