このページは英語から翻訳されています。英語版が正式な情報源です。翻訳内容に不一致がある場合は、英語版を参照してください。
国際出荷を作成する
このガイドでは、YunExpressを使用して日本からアメリカへの越境出荷を作成する手順を説明します。同じフローは、サポートされているすべての配送業者および配送ルートに適用できます。始める前に
- オンボーディングで取得したAPIキーとAPIトークンがあること(認証を参照)
- 配送業者のslugとプロダクトコードを把握していること(配送業者とプロダクトコードを参照)
1. 出荷データを準備する
国際出荷には以下が必要です:- 発送元住所 — 倉庫またはフルフィルメントセンター
- 届け先住所 — お客様の配送先住所
- 荷物の詳細 — 重量およびアイテムレベルの税関申告(英語の説明、数量、単価、単位重量)
税関申告(
descriptionEn、unitPrice、unitWeight)は越境出荷に必須です。税関データが不足していたり不正確な場合、通関手続きに遅延が生じる可能性があります。curl -X POST https://api.flexforward.com/labels \
-H "x-rr-apikey: YOUR_API_KEY" \
-H "x-rr-apitoken: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"idempotencyKey": "unique-key-per-request",
"courier": "yunexpress",
"service": {
"productCode": "HKMUZXR"
},
"label": {
"format": "PDF"
},
"units": {
"weight": "KG",
"dimension": "CM"
},
"order": {
"customerOrderNumber": "N-2026-05-27-TEST-03",
"orderNumbers": {
"platformOrderNumber": "platform-order-number",
"referenceNumbers": [
"ref-number-1",
"ref-number-2"
]
}
},
"shipment": {
"shipTo": {
"contact": {
"firstName": "Alex",
"lastName": "Smith",
"phone": "8554377467",
"email": "[email protected]"
},
"address": {
"streetLines": [
"18 Distribution Blvd"
],
"city": "Edison",
"state": "New jersey",
"postalCode": "08817",
"countryCode": "US"
}
},
"shipFrom": {
"contact": {
"firstName": "John",
"lastName": "Doe",
"phone": "886900676877",
"email": "[email protected]"
},
"address": {
"streetLines": [
"Habucho"
],
"city": "Kishiwada-Shi",
"state": "Osaka",
"postalCode": "596-0825",
"countryCode": "JP"
}
},
"parcels": [
{
"weight": 0.5,
"dimension": {
"length": 30,
"width": 20,
"height": 10
},
"items": [
{
"descriptionEn": "Muji Ink pen",
"descriptionLocal": "文具",
"quantity": 1,
"unitPrice": {
"amount": 29.99,
"currency": "USD"
},
"unitWeight": 0.5
}
]
}
]
},
"serviceOptions": [
{
"code": "V1",
"value": "云途预缴"
}
],
"courierOptions": {
"yunexpress": {
"sourceCode": "YT",
"sensitiveType": "D"
}
}
}'
const response = await fetch('https://api.flexforward.com/labels', {
method: 'POST',
headers: {
'x-rr-apikey': 'YOUR_API_KEY',
'x-rr-apitoken': 'YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
{
idempotencyKey: 'unique-key-per-request',
courier: 'yunexpress',
service: {
productCode: 'HKMUZXR'
},
label: {
format: 'PDF'
},
units: {
weight: 'KG',
dimension: 'CM'
},
order: {
customerOrderNumber: 'N-2026-05-27-TEST-03',
orderNumbers: {
platformOrderNumber: 'platform-order-number',
referenceNumbers: [
'ref-number-1',
'ref-number-2'
]
}
},
shipment: {
shipTo: {
contact: {
firstName: 'Alex',
lastName: 'Smith',
phone: '8554377467',
email: '[email protected]'
},
address: {
streetLines: [
'18 Distribution Blvd'
],
city: 'Edison',
state: 'New jersey',
postalCode: '08817',
countryCode: 'US'
}
},
shipFrom: {
contact: {
firstName: 'John',
lastName: 'Doe',
phone: '886900676877',
email: '[email protected]'
},
address: {
streetLines: [
'Habucho'
],
city: 'Kishiwada-Shi',
state: 'Osaka',
postalCode: '596-0825',
countryCode: 'JP'
}
},
parcels: [
{
weight: 0.5,
dimension: {
length: 30,
width: 20,
height: 10
},
items: [
{
descriptionEn: 'Muji Ink pen',
descriptionLocal: '文具',
quantity: 1,
unitPrice: {
amount: 29.99,
currency: 'USD'
},
unitWeight: 0.5
}
]
}
]
},
serviceOptions: [
{
code: 'V1',
value: '云途预缴'
}
],
courierOptions: {
yunexpress: {
sourceCode: 'YT',
sensitiveType: 'D'
}
}
}
})
});
const label = await response.json();
import requests
response = requests.post(
'https://api.flexforward.com/labels',
headers={
'x-rr-apikey': 'YOUR_API_KEY',
'x-rr-apitoken': 'YOUR_API_TOKEN',
},
json={
'idempotencyKey': 'unique-key-per-request',
'courier': 'yunexpress',
'service': {
'productCode': 'HKMUZXR'
},
'label': {
'format': 'PDF'
},
'units': {
'weight': 'KG',
'dimension': 'CM'
},
'order': {
'customerOrderNumber': 'N-2026-05-27-TEST-03',
'orderNumbers': {
'platformOrderNumber': 'platform-order-number',
'referenceNumbers': [
'ref-number-1',
'ref-number-2'
]
}
},
'shipment': {
'shipTo': {
'contact': {
'firstName': 'Alex',
'lastName': 'Smith',
'phone': '8554377467',
'email': '[email protected]'
},
'address': {
'streetLines': [
'18 Distribution Blvd'
],
'city': 'Edison',
'state': 'New jersey',
'postalCode': '08817',
'countryCode': 'US'
}
},
'shipFrom': {
'contact': {
'firstName': 'John',
'lastName': 'Doe',
'phone': '886900676877',
'email': '[email protected]'
},
'address': {
'streetLines': [
'Habucho'
],
'city': 'Kishiwada-Shi',
'state': 'Osaka',
'postalCode': '596-0825',
'countryCode': 'JP'
}
},
'parcels': [
{
'weight': 0.5,
'dimension': {
'length': 30,
'width': 20,
'height': 10
},
'items': [
{
'descriptionEn': 'Muji Ink pen',
'descriptionLocal': '文具',
'quantity': 1,
'unitPrice': {
'amount': 29.99,
'currency': 'USD'
},
'unitWeight': 0.5
}
]
}
]
},
'serviceOptions': [
{
'code': 'V1',
'value': '云途预缴'
}
],
'courierOptions': {
'yunexpress': {
'sourceCode': 'YT',
'sensitiveType': 'D'
}
}
}
)
label = response.json()
3. レスポンスを確認する
201 Created
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"status": "created",
"courier": "yunexpress",
"courierOrderNumber": "YT2503010001",
"courierTrackingNumber": "YT2503010001CN",
"error": null
}
statusがcreatedであれば、ラベルの準備は完了です。idを保存してください。ラベルドキュメントの取得や出荷の追跡に使用します。
statusがfailedの場合は、errorオブジェクトで配送業者の却下理由を確認してください。詳しくはエラーハンドリングを参照してください。
4. 次のステップ
ラベルドキュメントを取得する
荷物に貼付するエアウェイビルPDFをダウンロードします。
出荷を追跡する
正規化された追跡データで出荷状況を監視します。
国際出荷のヒント
- HSコード — HSコード(
hsCode)を含めることで、通関手続きが迅速になります。各国の税関当局のサイトでコードを検索できます。 - 現地語の説明 —
descriptionLocalフィールドは、仕向国の言語でアイテムの説明を提供し、通関処理に役立ちます。 - べき等性 — 常に意味のある
idempotencyKey(例:注文ID)を使用して、リトライを安全に行えるようにしてください。べき等性とリトライを参照してください。