准备请求
创建清单需要将货物数据组织成适当的结构。该 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 将准备全面的海关清单,其中包括所有必要信息,用于邮政货物入境美国。