身份验证
所有 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": { ... }
}'