Shipment Booking API

Creates a new shipment booking for either Small Parcel or LTL (Less Than Truckload) delivery

POST/api/shipments/book-shipmentSmall Parcel & LTL

Description

This endpoint allows you to book a shipment after obtaining rates from the rates API. The booking process differs based on the shipment type:

  • Small Parcel: For packages under 150 lbs, typically handled by carriers like UPS, USPS
  • LTL (Less Than Truckload): For larger freight shipments over 150 lbs, handled by freight carriers like SAIA, ABF, Ward, XPO, Estes

Authentication

headers: {
  "Authorization": "Bearer {YOUR_API_KEY}",
  "Content-Type": "application/json"
}

Request Parameters

Common Parameters

ParameterTypeRequiredDescription
shopstringNoShop identifier
shipment_fromobjectYesOrigin address details
shipment_toobjectYesDestination address and recipient details
pickup_datestringYesPickup date in YYYY-MM-DD format
pickup_windowobjectYesPickup time window configuration
from_detailsobjectYesShipper contact information
to_detailsobjectYesConsignee contact information
packagesarrayYesArray of package details
optionsarrayNoAdditional shipping options
order_idstringNoExternal order identifier
rate_idstringYesRate ID obtained from rates API
service_codestringYes*Service code (required for Small Parcel)
uuidstringYesUnique identifier from rates API
rate_typestringYesType of rate: shipengine_rates or shipengine_ltl_rates
company_namestringYesCarrier company name from rates API
rate_pricenumberYesRate price from rates API
rate_currencystringYesCurrency code (e.g., "USD")
estimate_daysstringYesEstimated delivery time
currencystringYesOrder currency
order_fulfilled_statusbooleanYesFulfillment status flag
service_typestringYesService type description
order_reference_codestringNoReference code for the order

Shipment From Object

ParameterTypeRequiredDescription
address_line1stringYesPrimary address line
address_line2stringNoSecondary address line
citystringYesCity name
stateCodestringYesState/province code
postalCodestringYesPostal/ZIP code
countryCodestringYesISO country code

Shipment To Object

ParameterTypeRequiredDescription
destinationstringYesFull destination address string
companystringNoRecipient company name
namestringYesRecipient name
emailstringYesRecipient email address
phonestringNoRecipient phone number
address_line1stringYesPrimary address line
address_line2stringNoSecondary address line
citystringYesCity name
statestringYesState/province name
countrystringYesCountry name
postalCodestringYesPostal/ZIP code
countryCodestringYesISO country code
stateCodestringYesState/province code
weightnumberYesTotal shipment weight
weight_unitstringYesWeight unit ("pound", "kg")
descriptionstringYesShipment description

Shipper Details (from_details)

ParameterTypeRequiredDescription
pickup_window.start_atstringYesPickup window start time (HH:MM:SS format)
pickup_window.end_atstringYesPickup window end time (HH:MM:SS format)
pickup_window.closing_atstringYesFacility closing time (HH:MM:SS format)
company_namestringYesShipper company name
contact_namestringYesShipper contact person name
contact_nostringYesShipper contact phone number
contact_emailstringYesShipper contact email address
is_residentialbooleanYesWhether the pickup location is residential

Consignee Details (to_details)

ParameterTypeRequiredDescription
destination_window.start_atstringYesPickup window start time (HH:MM:SS format)
destination_window.end_atstringYesPickup window end time (HH:MM:SS format)
destination_window.closing_atstringYesFacility closing time (HH:MM:SS format)
company_namestringYesConsignee company name
contact_namestringYesConsignee contact person name
contact_nostringYesConsignee contact phone number
contact_emailstringYesConsignee contact email address
is_residentialbooleanYesWhether the delivery location is residential

Package Object

ParameterTypeRequiredDescription
quantitynumberYesNumber of packages
typestringYesPackage type ("Box", "Pallet", etc.)
classstringYesFreight class (e.g., "60", "175")
nmfcstringNoNMFC code (required for LTL)
nmfc_substringNoNMFC Sub code (required for LTL)
weightstringYesPackage weight
weight_unitstringYesWeight unit ("pound", "kg")
lengthstringYesPackage length
widthstringYesPackage width
heightstringYesPackage height
dimension_unitstringYesDimension unit ("inch", "cm")
descriptionstringYesPackage description
piecesnumberYesNumber of pieces
stackablebooleanYesWhether package is stackable
hazardous_materialsbooleanYesWhether contains hazardous materials
hazardous_materials_un_nastringNoUN/NA identification number for hazardous materials (e.g., 'UN1203', 'NA1993')
hazardous_materials_shipping_namestringNoOfficial shipping name of the hazardous material (e.g., 'Gasoline', 'Combustible liquid, n.o.s.')
hazardous_materials_hazard_classstringNoHazard class classification (e.g., '3', '8', '9' for flammable liquids, corrosive, misc dangerous goods)
hazardous_materials_packaging_groupstringNoPackaging group level indicating danger level ('I', 'II', 'III' - I being most dangerous)
hazardous_materials_emergncy_namestringNoEmergency contact person's name responsible for hazardous materials handling and incident response
hazardous_materials_emergncy_phonestringNo24/7 emergency contact phone number for hazardous materials incidents, spills, or transportation emergencies
API Configuration
Request Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
  "shop": "",
  "shipment_from": {
    "address_line1": "8825 Perimeter Park Boulevard",
    "city": "Jacksonville",
    "stateCode": "FL",
    "postalCode": "32216",
    "countryCode": "US"
  },
  "shipment_to": {
    "destination": "91283 Grinnell Ln, Coos Bay, Oregon, United States - 97420",
    "name": "test",
    "email": "[email protected]",
    "address_line1": "91283 Grinnell Ln",
    "city": "Coos Bay",
    "state": "Oregon",
    "country": "United States",
    "postalCode": "97420",
    "countryCode": "US",
    "stateCode": "OR",
    "weight": 220,
    "weight_unit": "pound",
    "description": "Acai Juice Powder (Fruit) - 100 Kilograms Enterprise( X 1)"
  },
  "pickup_date": "",
  "pickup_window": {
    "start_at": "08:00:00",
    "end_at": "17:00:00",
    "closing_at": "17:00:00"
  },
  "from_details": {
    "pickup_window": {
      "start_at": "02:00:00",
      "end_at": "04:30:00",
      "closing_at": "10:30:00"
    },
    "company_name": "shipper",
    "contact_name": "shipper",
    "contact_no": "+1 330-899-5862",
    "contact_email": "[email protected]",
    "is_residential": false
  },
  "to_details": {
    "destination_window": {
      "start_at": "02:00:00",
      "end_at": "04:30:00",
      "closing_at": "10:30:00"
    },
    "company_name": "D4W-Solutions",
    "contact_name": "Nick",
    "contact_no": "+1 330-931-5863",
    "contact_email": "[email protected]",
    "is_residential": false
  },
  "packages": [
    {
      "quantity": 1,
      "type": "Box",
      "class": "60",
      "weight": "10",
      "weight_unit": "pound",
      "length": "5",
      "width": "5",
      "height": "5",
      "dimension_unit": "inch",
      "description": "Test",
      "pieces": 1,
      "stackable": false,
      "hazardous_materials": true,
      "hazardous_materials_un_na": "UN1203",
      "hazardous_materials_shipping_name": "Gasoline",
      "hazardous_materials_hazard_class": "3",
      "hazardous_materials_packaging_group": "I",
      "hazardous_materials_emergncy_name": "Test",
      "hazardous_materials_emergncy_phone": "+1 330-899-5862"
    }
  ],
  "options": [],
  "order_id": null,
  "rate_id": "983e7780-954d-4824-a96e-69359cdfbf06",
  "service_code": "58b38efc-ecbe-428e-95e4-0b5d68223939",
  "uuid": "bac3cbc4-3bf9-4d70-b977-c27173d40ceb",
  "rate_type": "shipengine_rates",
  "company_name": "UPS",
  "rate_price": 29.84,
  "rate_currency": "USD",
  "estimate_days": "4 DAY",
  "currency": "USD",
  "order_fulfilled_status": true,
  "service_type": "UNITED PARCEL SERVICE",
  "order_reference_code": "PO#123456"
}

Code Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import fetch from "node-fetch";

async function bookShipment() {
  const response = await fetch("https://api.shipduo.com/api/shipments/book-shipment", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer ",
    },
    body: JSON.stringify({
      // Request body from the example above
      {
  "shop": "",
  "shipment_from": {
    "address_line1": "8825 Perimeter Park Boulevard",
    "city": "Jacksonville",
    "stateCode": "FL",
    "postalCode": "32216",
    "countryCode": "US"
  },
  "shipment_to": {
    "destination": "91283 Grinnell Ln, Coos Bay, Oregon, United States - 97420",
    "name": "test",
    "email": "[email protected]",
    "address_line1": "91283 Grinnell Ln",
    "city": "Coos Bay",
    "state": "Oregon",
    "country": "United States",
    "postalCode": "97420",
    "countryCode": "US",
    "stateCode": "OR",
    "weight": 220,
    "weight_unit": "pound",
    "description": "Acai Juice Powder (Fruit) - 100 Kilograms Enterprise( X 1)"
  },
  "pickup_date": "",
  "pickup_window": {
    "start_at": "08:00:00",
    "end_at": "17:00:00",
    "closing_at": "17:00:00"
  },
  "from_details": {
    "pickup_window": {
      "start_at": "02:00:00",
      "end_at": "04:30:00",
      "closing_at": "10:30:00"
    },
    "company_name": "shipper",
    "contact_name": "shipper",
    "contact_no": "+1 330-899-5862",
    "contact_email": "[email protected]",
    "is_residential": false
  },
  "to_details": {
    "destination_window": {
      "start_at": "02:00:00",
      "end_at": "04:30:00",
      "closing_at": "10:30:00"
    },
    "company_name": "D4W-Solutions",
    "contact_name": "Nick",
    "contact_no": "+1 330-931-5863",
    "contact_email": "[email protected]",
    "is_residential": false
  },
  "packages": [
    {
      "quantity": 1,
      "type": "Box",
      "class": "60",
      "weight": "10",
      "weight_unit": "pound",
      "length": "5",
      "width": "5",
      "height": "5",
      "dimension_unit": "inch",
      "description": "Test",
      "pieces": 1,
      "stackable": false,
      "hazardous_materials": true,
      "hazardous_materials_un_na": "UN1203",
      "hazardous_materials_shipping_name": "Gasoline",
      "hazardous_materials_hazard_class": "3",
      "hazardous_materials_packaging_group": "I",
      "hazardous_materials_emergncy_name": "Test",
      "hazardous_materials_emergncy_phone": "+1 330-899-5862"
    }
  ],
  "options": [],
  "order_id": null,
  "rate_id": "983e7780-954d-4824-a96e-69359cdfbf06",
  "service_code": "58b38efc-ecbe-428e-95e4-0b5d68223939",
  "uuid": "bac3cbc4-3bf9-4d70-b977-c27173d40ceb",
  "rate_type": "shipengine_rates",
  "company_name": "UPS",
  "rate_price": 29.84,
  "rate_currency": "USD",
  "estimate_days": "4 DAY",
  "currency": "USD",
  "order_fulfilled_status": true,
  "service_type": "UNITED PARCEL SERVICE",
  "order_reference_code": "PO#123456"
}
    }),
  });

  if (!response.ok) {
    throw new Error(`Error: ${response.status}`);
  }

  const data = await response.json();
  console.log(data);
}

bookShipment().catch(console.error);

Response Examples

Small Parcel Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
  "status": "success",
  "message": "Operation succeeded.",
  "data": {
    "company_name": "UPS",
    "title": "UPS (UPS Ground)",
    "pdf_link": "https://testing-project.nyc3.digitaloceanspaces.com/d4w/684d418a39bde.pdf",
    "price": "$29.84",
    "estimate_days": "4 DAY",
    "is_custom_order": true,
    "tracking_url": "https://www.ups.com/track?loc=en_US&tracknum=1ZV017145308553722&requester=ST/trackdetails",
    "tracking_number": "1ZV017145308553722"
  }
}

Response Format

Success Response Structure

ParameterTypeDescription
statusstringResponse status ("success" or "error")
messagestringResponse message
dataobjectBooking confirmation data

Response Data Object

ParameterTypeDescription
company_namestringCarrier company name
titlestringService title with carrier details
pdf_linkstringURL to shipping label/BOL PDF
pricestringFormatted shipping cost
estimate_daysstringEstimated delivery time
is_custom_orderbooleanWhether this is a custom order
tracking_urlstringTracking URL for track order
tracking_numberstringTracking Number for track order

Error Response

1
2
3
4
5
{
  "status": "error",
  "message": "Error description here",
  "data": null
}

HTTP Status Codes

200OK - Successful booking
400Bad Request - Invalid request parameters
401Unauthorized - Authentication failed
422Unprocessable Entity - Validation errors
500Internal Server Error - Server error

Important Notes

  • Prerequisites: Before booking, you must first call the rates API to obtain the required rate information (rate_id, uuid, service_code, etc.).
  • Rate Types:
    • Use shipengine_rates for Small Parcel shipments
    • Use shipengine_ltl_rates for LTL shipments
  • Service Code: Required for Small Parcel shipments, not used for LTL shipments.
  • NMFC Code: Required for LTL shipments to classify freight type.
  • PDF Documents:
    • Small Parcel bookings return shipping labels
    • LTL bookings return Bill of Lading (BOL) documents
  • Weight Limits:
    • Small Parcel: Typically under 150 lbs
    • LTL: Over 150 lbs up to full truckload
  • Pickup Windows: Ensure pickup times are within carrier service hours and allow sufficient time for pickup scheduling.

Workflow

  1. Get shipping rates using the rates API
  2. Select desired rate and service
  3. Extract required rate information (rate_id, uuid, service_code, etc.)
  4. Submit booking request with complete shipment details
  5. Receive confirmation with tracking information and shipping documents