API Documentation
  1. API Documentation - Version 3
API Documentation
  • API Documentation - Version 3
    • Getrate API
      POST
    • Purchase API
      POST
    • Get All Orders API
      POST
    • Get Order Detail API
      POST
    • Cancel Orders API
      POST
    • Get PodInfo API
      POST
    • Get Label API
      POST
    • Get TrackingInfo API
      POST
    • Create Manifest
      POST
    • Get Manifest
      POST
    • GetBreakdown
      POST
  1. API Documentation - Version 3

Purchase API

POST
/api/v3/shipment/purchase
Please replace the accessToken to the one in your batchship.com user settings.
Please replace the requestToken from getRate response.
Please replace the rateId from the getRate response.(only amazon required)
Mode can be 'sandbox' or 'production'

Request

Body Params application/json

Example
{
    "accessToken": "***********",
    "mode": "sandbox",
    "requestToken": "DHLExpress8A68FF00097011F1B3F45BC77106DED7",
    "rateId": "",
    "requestedDocumentSpecification": {
        "format": "PDF",
        "size": {
            "width": 4,
            "length": 6,
            "unit": "INCH"
        },
        "dpi": 300
    },
    "referenceId1": "",
    "referenceId2": "",
    "referenceId3": ""
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.batchship.com/api/v3/shipment/purchase' \
--header 'Content-Type: application/json' \
--data-raw '{
    "accessToken": "***********",
    "mode": "sandbox",
    "requestToken": "DHLExpress8A68FF00097011F1B3F45BC77106DED7",
    "rateId": "",
    "requestedDocumentSpecification": {
        "format": "PDF",
        "size": {
            "width": 4,
            "length": 6,
            "unit": "INCH"
        },
        "dpi": 300
    },
    "referenceId1": "",
    "referenceId2": "",
    "referenceId3": ""
}'

Responses

🟢200成功
application/json
Body

Example
{
    "success": true,
    "payload": {
        "orderId": "ORDER_ID",
        "packageDocumentDetails": [
            {
                "packageClientReferenceId": "SWA_US_SmartP_Test",
                "packageDocuments": [
                    {
                        "type": "LABEL",
                        "contents": "LABEL_IMAGE",
                        "format": "PNG"
                    }
                ],
                "trackingId": "9031322607088"
            }
        ],
        "promise": {
            "pickupWindow": {
                "start": "2024-03-26T07:19:46.809Z",
                "end": "2024-03-26T08:19:46.809Z"
            },
            "deliveryWindow": {
                "start": "2024-03-27T09:19:46.809Z",
                "end": "2024-03-27T09:19:46.809Z"
            }
        },
        "totalCharge": {
            "unit": "USD",
            "value": 5.47
        },
        "referenceId1": "",
        "referenceId2": "",
        "referenceId3": ""
    }
}
Modified at 2026-02-28 08:29:44
Previous
Getrate API
Next
Get All Orders API
Built with