# API General Instructions ### Obtain API Key(apiName) and API Token(apiToken) - Register as a user in the customer center——>Log in to the system——>Account Management——>API Intergration Information ![image](https://f.sendatek.com/settings/api_guide_en.png) ---------- ---------- # Last-Mile Delivery API > #### *Instructions > All requests need to include the header:Content-Type:application/json ## 1. Query Customer's Product List - Use the following parameters in JSON format for online querying of the customer's product list via HTTPS. - Request URL: https://open.sendatek.com/openapi/api-order/requestCustomerProducts - Request Type: POST #### 1. Input Parameters ```json { "apiName": "YS21094", "apiToken": "73fd527d0d91dbd2e243ddb61dbff157", "destinationNo": "" } ``` #### 2. Input Parameter Explanation - apiName: (String, Required) Name of the authenticated API. - apiToken: (String, Required) Token corresponding to the name of the authenticated API. - destinationNo:(String, Optional) Two-letter code for the destination. #### 3. Response Result Set ```json { "flag": true, "rows": [ { "code": "GGCP", "id": "a7505646a43a4f528dc60d7a4be6298c", "name": "Public Product Test" }, { "code": "SWBG", "id": "0baeb728ca464f3eac045f8d2b6ba053", "name": "Business Package" }, { "code": "GZ4", "id": "4537d76dafe0445ca8c5c33aebcc1ec5", "name": "Rule 4" }, { "code": "MPZX1", "id": "46deccb61c1341a5b024ab1bb76c79a5", "name": "Dim-weight Free Special Line" } ], "total": 4 } ``` #### 4. Response Parameter Explanation - flag: Request result identifier。true indicates a successful response. false indicates a failed request. - rows: Array of objects containing retrieved product information. - code:Product or rule code. - id:Product or rule ID. - name:Product or rule name. - total: Number of products or rules retrieved. ## 2. Place an Order (including Modification) - Use JSON format in HTTPS requests with the following parameters for online ordering. - Request URL: https://open.sendatek.com/openapi/api-order/order - equest Type: POST > #### *Modification Explanation > Automatically activate modification logic based on whether the reference number (referenceNo) is the same. The order created by the reference number is in the pre-recorded state and has not been printed delivery label to be eligible for modification. #### 1. Input Parameters Provided for reference (see parameter explanation for detailed fields) ```json { "apiName": "YS211151", "apiToken": "d47bcfd45790fe3ab4c833867bfb5ec8", "order": { "destinationNo": "US", "productCode": "ZHUIZONG", "referenceNo": "test11108", "boxList": [ { "goodsList": [ { "name": "apple", "nameEn": "apple", "quantity": 1, "reportPrice": 1.23, "weight": 1.345 } ], "height": 3, "length": 2, "weight": 1, "width": 1, "referenceNo": "BOX00000001" } ], "deliveryAddress": { "consignee": "Valérie Roxo", "cellphoneNo": "13352414568", "email": "53062555@qq.com", "province": "789", "city": "Andelnans", "address": "23 rue des orchidées", "postcode": "90400" }, "senderAddress": { "sender": "123", "cellphoneNo": "+8618610415717", "province": "789", "countryCode": "CN", "city": "wuhan", "address": "address", "postcode": "441100" } } } ``` #### 2. Input Parameter Explanation - apiName: (String, Required) Name of the authenticated API. - apiToken: (String, Required) Token corresponding to the name of the authenticated API. - order: (Object, Required) Order object. - destinationNo: (String, Required) Destination two-letter code. - productCode: (String, Required) Product or rule code. - referenceNo: (String, Required) Reference number (when the reference number is the same, it indicates modifying the order information) (if you currently have a system, it usually represents your system's business number). - boxList: (Array, Required) List of boxes, package list. - goodsList: (Array, Required) List of items. - name: (String, Required) Chinese name of the product. - nameEn: (String, Required) English name of the product. - quantity: (Integer, Required > 0) Quantity of the product. - reportPrice: (Float, Required) Declared value of a single product (unit: USD). - weight: (Float, Required) Weight of a single product (unit: kg). - brand: (String, Optional) Brand. - elements: (String, Optional) Declaration elements. - hsCode: (String, Optional) HS code. - material: (String, Optional) Material. - purpose: (String, Optional) Purpose. - sku: (String, Optional) SKU customer product distribution information. - url: (String, Optional) URL product link (or ASIN code). - height: (Integer, Required) Height of the box in centimeters (cm). - length: (Integer, Required) Length of the box in centimeters (cm). - weight: (Float, Required) Weight of the box (unit: kg). - width: (Integer, Required) Width of the box in centimeters (cm). - referenceNo: (String, Optional) Reference number of the box. - deliveryAddress: (Object, Required) Recipient's address information. - consignee: (String, Required) Consignee in the delivery address cannot be empty. - cellphoneNo: (String, Required) Phone number in the delivery address. - province: (String, Required) (Area/province/state) in the delivery address cannot be empty. - city: (String, Required) City in the delivery address cannot be empty. - address: (String, Required) Address in the delivery address cannot be empty. - postcode: (String, Required) Postal code in the delivery address. - district: (String, Optional) District. - address2: (String, Optional) Address 2. - houseNo: (String, Optional - Mandatory for DE) House number. - companyName: (String, Optional) Company name. - phoneNo: (String, Optional) Landline number. - customsClearanceNo: (String, Optional - Mandatory for KR) PCC Code (Korea). - email: (String, Optional - Depending on the product) Email in the delivery address. - senderAddress: (Object, Required) Shipper's information in the shipment. - sender: (String, Required) Shipper in the sender address cannot be empty. - cellphoneNo: (String, Required) Cellphone number in the sender address. - countryCode: (String, Required) Departure two-letter code in the sender address cannot be empty. - province: (String, Required) (Area/province/state) in the sender address cannot be empty. - city: (String, Required) City in the sender address cannot be empty. - address: (String, Required) Address in the sender address cannot be empty. - postcode: (String, Required) Postal code in the sender address cannot be empty. - address2: (String, Optional) Address 2. - companyName: (String, Optional) Company name. - phoneNo: (String, Optional) Phone number. - email: (String, Optional) Email in the sender address. - codPrice: (String, Optional) COD amount. - eoriNo: (String, Optional) EORI number. - hmrcNo: (String, Optional) HMRC number. - ioss: (String, Optional) IOSS number. - vatNo: (String, Optional) VAT number. #### 3. Response Result Set ```json { "flag": true, "obj": { "id": "1d9e746a3d0a4ca78d02d675bc22d9ae", "insideNumber": "FEIYQ0000017603YQ", "referenceNo": "340669", "labelStatus": "REQUEST_OK", "deliveryNumber": "6b93f015a3034f21826d6fe14c6b5984" "labelPdfUrl": "https://open.sendatek.com/api/label/internal/order/1d9e746a3d0a4ca78d02d675bc22d9ae/pdf" }, "total": 0 } ``` #### 4. Response Parameter Explanation - flag: Request result identifier. True indicates successful order placement, and false indicates order placement failure. - obj: Details object returned when the order is successfully placed. - id:ID. - insideNumber:Order Number. - referenceNo:Reference number when the customer places an order. - labelStatus:Obtain label status. When the value is 'REQUEST_OK', the deliveryNumber and labelPdfUrl fields have values. When it is not 'REQUEST_OK', the labelErrorMsg field has a value. - deliveryNumber:Tracking Number. - labelPdfUrl:Path to the PDF label. - labelErrorMsg:Description of label acquisition exception. - msg: Exception error message when the request fails. ## 3. Cancel Order Interface - Use the following parameters in JSON format for the cancel order interface. - Request Link: https://open.sendatek.com/openapi/api-order/cancelOrder - Request Type: POST > #### *Cancellation Prerequisites > 1. Own order status: Not shippable, shippable, and not online > 2. Contract order status: Not shippable #### 1. Input Parameters ```json { "apiName": "YS21094", "apiToken": "24759d96b6afdf132df9486367f93705", "orderNo": "FEIYQ0000298059YQ", "reason": "test" } ``` #### 2. Input Parameter Explanation - apiName: (String, Required) Name of the authenticated API. - apiToken: (String, Required) Token corresponding to the name of the authenticated API. - orderNo: (String, Required) System order number. - reason: (String, Required) Explanation of the cancellation reason. #### 3. Response Result Set ```json { "flag": true, "rows": [], "total": 0 } ``` #### 4. Response Parameter Explanation - flag: Request result identifier. true indicates success. false indicates request failure. - msg: When the request flag is false, it describes the failure. ## 4. Query Delivery Label Interface - Use the following parameters in JSON format for online query of the delivery label interface. - Request Link: https://open.sendatek.com/openapi/api-order/requestPdfUrl - Request Type: POST #### 1. Input Parameters ```json { "apiName": "YS21095", "apiToken": "1684ae8837d356fe61bf6df02801c21a", "orderNumbers": ["FEIYQ0000015989YQ"] } ``` #### 2. Input Parameter Explanation - apiName: (String, Required) Name of the authenticated API. - apiToken: (String, Required) Token corresponding to the name of the authenticated API. - orderNumbers: (Array, Required, up to 40) Collection of system order numbers. #### 3. Response Result Set ```json { "flag": true, "pdfUrls": [ { "orderNumber": "FEIYQ0000015989YQ", "deliveryNumber": "12312326892884990", "url": "https://open.sendatek.com/api/label/internal/order/c3cd45c6226544158bdbc7ff5064df20/pdf" } ] } ``` #### 4. Response Parameter Explanation - flag: Request result identifier. true indicates success. false indicates request failure. - msg: When the request flag is false, it describes the failure. - pdfUrls: Description of information for a successful request. - orderNumber: System Order Number. - deliveryNumber: Tracking Number. - url:Returned PDF address. - deliveryNumbers: (String, Optional) Multiple tracking numbers returned for multi-piece, concatenated with ','. ## 5. Query Order Tracking Information - Use the following parameters in JSON format for online query of order tracking information using HTTPS. - Request link: https://open.sendatek.com/openapi/api-order/requestTrackInfo - Request type: POST #### 1. Input Parameters ```json { "apiName": "YS21095", "apiToken": "1684ae8837d356fe61bf6df02801c21a", "orderNumbers": ["FEIYQ0000015989YQ"] } ``` #### 2. Input Parameter Explanation - apiName: (String, Required) Name of the authenticated API. - apiToken: (String, Required) Token corresponding to the name of the authenticated API. - orderNumbers: (Array, Required, up to 10) Collection of system order numbers. #### 3. Response Result Set ```json { "flag": true, "trackingInformations": [ { "insideNumber": "FEIYQ0000015989YQ", "deliveryCompany": "US-dpd", "deliveryNumber": "12312326892884990", "trackingInfoDetails": [ { "createTime": "2021-09-15 17:15:39", "description": "Item information received.", "location": "", "statusDesc": "", "trackingStatus": "" } ] } ] } ``` #### 4. Response Parameter Explanation - flag: Request result identifier. true indicates success, false indicates failure. - msg: Description of failure when the request flag is false. - trackingInformations: List of information objects for successful requests. - deliveryNumber:Tracking Number - deliveryCompany:Delivery Courier - insideNumber:System Order Number. - trackingInfoDetails:List of tracking information details. - createTime:Creation time. - description:Description. - location:Location information. - trackingStatus:Tracking status:NOT_ONLINE("No Tracking"),ONLINE("First scan"),NO_RESULT("Not Found"),TAKE_DELIVERY("Warehouse Receipt"),IN_TRANSIT("In transit"),WAIT_TO_PICKUP("Arrived for pickup"),DELIVERY_FAILED("投递失败"),POSSIBLE_ABNORMALITY("Possible abnormalities"),SIGNING_SUCCESS("Delivered"),LONG_TRANSPORT("Transport for a long time"),FOREIGN_RETURN("Overseas returns"),LOST("Parcel lost"),TRACKING_ENDED("Tracking ended"),OTHER("Other")。 - statusDesc:状态描述。 ---------- ---------- # Overseas Customs Clearance API ## 1.Clearance B/L template download * Request Link: * Request Type:GET #### 1.Usage Example Simple template: General template: #### 2. Explanation of Input Parameters * **apiName**: (String, Required) Name of the authenticated API. * **apiToken**: (String, Required) Token corresponding to the authenticated API name. * **isSimple**: (String, Required) Whether it is a simple template. **true**:Simple template,**false**:General template。 ## 2. Order Declaration for Customs Clearance - Request Link:https://open.sendatek.com/openapi/clearance/aviation - Request Type:POST - Content-Type:multipart/form-data #### 1. Parameters and Usage Example ![image](https://f.sendatek.com/settings/api_aviOrder.png) #### 2. Explanation of Input Parameters - **apiName**: (String, Required) Name of the authenticated API. - **apiToken**: (String, Required) Token corresponding to the authenticated API name. - **productCode**: (String, Required) Customs clearance product code. - **orderType**: (String, Required) Order type: 1 for own order, 2 for purchase order. - **file**: (Excel, Required) Upload order Excel (download the template first, fill in the data according to the template requirements). #### 3. Error Result Example Example 1 ```json { "flag": false, "msg": "Product not available, consult customer service for details", "rows": [], "total": 0 } ``` Example 2 ```json { "flag": false, "msg": "Import failed, please check the details list.", "rows": [ { "errorInfo": "The order does not belong to the current user, bag number already exists", "location": "Line 6 Order number FYYQ0002700733YQ Bag number BAG001" }, { "errorInfo": "The order does not belong to the current user, bag number already exists", "location": "Line 7 Order number FYYQ0002700732YQ Bag number BAG002" } ], "total": 0 } ``` #### 4. Explanation of Response Parameters - flag: Request result identifier. true for success, false for failure. - msg: Status description of the call. - rows: List of abnormal descriptions during Excel processing (exists when msg is "Import failed, check the details list"). - errorInfo: Exception information. - location: Additional information about the location of the exception in the Excel. ## 3. Cancel Customs Declaration Order - Request Link: https://open.sendatek.com/openapi/clearance/aviation/cancel - Request Type: POST - Content-Type:application/json > #### *Cancellation conditions: Can be canceled if customs clearance data has not been uploaded and the consolidated bag has not been printed label. #### 1. Input Parameters ```json { "apiName": "YS2204203", "apiToken": "ca70f587a055a40a223c3e84045fb449", "aivaOrderNo": "GT100000000008" } ``` #### 2. Explanation of Input Parameters - **apiName**: (String, Required) Name of the authenticated API. - **apiToken**: (String, Required) Token corresponding to the authenticated API name. - **aivaOrderNo**: (String, Required) Customs clearance main order number. #### 3. Response Result ```json { "flag": true, "rows": [], "total": 0 } ``` #### 4. Explanation of Response Parameters - flag: Request result identifier. true for success, false for failure. - msg: Description of failure when the request flag is false. ## 4. Labeling of Consolidated Bag - Request Link:https://open.sendatek.com/openapi/clearance/aviation/label - Request Type:POST - Content-Type:application/json #### 1. Input Parameters ```json { "apiName": "YS2204203", "apiToken": "ca70f587a055a40a223c3e84045fb449", "bagNo": "BAG0B000030", "logisticsName": "fef", "destinationNo": "CN", "customName": "eee" } ``` #### 2. Explanation of Input Parameters - **apiName**: (String, Required) Name of the authenticated API. - **apiToken**: (String, Required) Token corresponding to the authenticated API name. - **bagNo**: (String, Required) Bag number. - logisticsName: (String, Optional) Warehouse code. - destinationNo: (String, Optional) Destination (two-letter code). - customName: (String, Optional) Custom name. #### 3. Response Result ```json { "flag": true, "obj": { "aviationOrderId": "63aeb64b2d1a1f36db505ad1", "aviationOrderNo": "JY00000000002", "bigShipId": "BAG0B000030", "destinationNo": "You", "errorMessage": "", "pbContainerId": "2023YOULUXAB12346", "pdfUrl": "http://static.sendatek.com/ex-label/2023/01/04/2023YOULUXAB12346.pdf", "productCode": "", "productName": "5uLU", "quantity": 1, "status": "true", "weight": 1.0 }, "rows": [], "total": 0 } ``` #### 4. Explanation of Response Parameters - flag:Request result identifier. true for success, false for failure. - msg: Description of failure when the request flag is false. - obj: Exist when the request flag is true, contains information related to labeling. - aviationOrderNo: B/L Number - bigShipId: Bag Number - pdfUrl:Download address in PDF format for the label. ## 5. Update Customs Clearance Order - Request Link:https://open.sendatek.com/openapi/clearance/order/update - Request Type:POST - Content-Type:application/json #### 1. Input Parameters ```json { "apiName": "YS2204203", "apiToken": "ca70f587a055a40a223c3e84045fb449", "avaitionOrderNo": "GT200000000001", "insideNumber": "CLE000000192915CO", "sender": "Zhang San", "sendAddress": "minggu kejiyuan", "sendAddress2": "222222", "sendCellphoneNo": "1689546263", "sendCity": "Shanghai", "sendCountryCode": "CN", "sendPostcode": "56984", "sendProvince": "Shanghai", "consignee": "Peter", "deliAddress": "Road 253111112", "deliAddress2": "111111", "deliCellphoneNo": "98466126162", "deliCity": "Los Angeles", "deliCountryCode": "US", "deliPostcode": "25962", "deliProvince": "CA", "clearanceBoxList": [ { "boxInsideNumber": "CLE000000192915CO-1", "boxReportPrice": 12, "clearanceGoodsList": [ { "originalGoodsNameEn": "fence", "goodsCount": 28, "goodsName": "fence", "goodsNameEn": "fence", "hsCode": "5608192090", "reportPrice": 0.43 } ], "deliveryNumber": "SZ17083585", "height": 1, "length": 1, "weight": 13.45, "width": 1 } ] } ``` #### 2. Explanation of Input Parameters - **apiName**: (String, Required) Name of the authenticated API. - **apiToken**: (String, Required) Token corresponding to the authenticated API name. - **avaitionOrderNo**: (String, Required) Customs Clearance B/L Number. - **insideNumber**: (String, Required) Customs clearance order number (update identifier). - sender: (String, Optional) Sender. - sendAddress: (String, Optional) Shipper's address. - sendAddress2: (String, Optional) Shipper's address 2. - sendCellphoneNo: (String, Optional) Shipper's phone number. - sendCity: (String, Optional) Shipper's city. - sendCountryCode: (String, Optional) Shipper's departure location (two-letter code). - sendPostcode: (String, Optional) Shipper's postal code. - sendProvince: (String, Optional) Shipper's region/province/state. - consignee: (String, Optional) Consignee. - deliAddress: (String, Optional) Delivery address. - deliAddress2: (String, Optional) Delivery address 2. - deliCellphoneNo: (String, Optional) Consignee's phone number. - deliCity: (String, Optional) Consignee's city. - deliCountryCode: (String, Optional) Consignee's destination (two-letter code). - deliPostcode: (String, Optional) Consignee's postal code. - deliProvince: (String, Optional) Consignee's region/province/state. - clearanceBoxList: (Array, Optional) List of customs clearance boxes. - **boxInsideNumber**: (String, Required) Customs clearance box number (update identifier). - boxReportPrice: (String, Optional) Declaration value of a single box. - clearanceGoodsList: (Array, Optional) List of items. - **originalGoodsNameEn**: (String, Required) Original English product name (update goods identifier). - goodsCount: (Integer, Optional) Quantity of goods. - goodsName: (String, Optional) Chinese product name. - goodsNameEn: (String, Optional) English product name. - hsCode: (String, Optional) HS code. - reportPrice: (Float, Optional) Declaration value of a single item. - deliveryNumber: (Array, Optional) Tracking Number. - length: (Array, Optional) Box length. - width: (Array, Optional) Box width. - height: (Array, Optional) Box height. - weight: (Float, Optional) Box weight. #### 3. Response Result ```json { "flag": true, "rows": [], "total": 0 } ``` #### 4. Explanation of Response Parameters - flag: Request result identifier. true for success, false for failure. - msg: Description of failure when the request flag is false. ## 6. Submit Forecast - Request Link:https://open.sendatek.com/openapi/clearance/aviation/forecast - Request Type:POST - Content-Type:application/json #### 1. Input Parameters ```json { "apiName": "YS2204203", "apiToken": "ca70f587a055a40a223c3e84045fb449", "aivaOrderNo": "GW1231230011" } ``` #### 2. Explanation of Input Parameters - **apiName**: (String, Required) Name of the authenticated API. - **apiToken**: (String, Required) Token corresponding to the authenticated API name. - **aivaOrderNo**: (String, Required) Customs Clearance B/L Number. #### 3. Response Result ```json { "flag": true, "rows": [], "total": 0 } ``` #### 4. Explanation of Response Parameters - flag: Request result identifier. true for success, false for failure. - msg: Description of failure when the request flag is false.