身份驗證
所有 Flex Forward API 端點都需要在 Authorization 標頭中使用 Bearer 令牌 進行身份驗證。
取得 API 令牌
- 登入 Flex Forward 控制台
- 前往 設定 > API 金鑰
- 產生新的 API 金鑰
- 複製令牌(僅顯示一次)
請妥善保管您的 API 令牌。請勿在客戶端程式碼、公開儲存庫或不安全的管道中分享。
發送已驗證的請求
在每個請求的 Authorization 標頭中包含令牌:
curl -X POST https://api.flexforward.com/labels \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"idempotencyKey": "ord-20250301-abc123",
"courier": "yunexpress",
"service": {
"shipperAccountId": "your-account-id",
"productCode": "YEXP01"
},
"shipment": { ... }
}'