Skip to content
MothershipDevelopers

GuidesBooking a shipment

Booking the shipment

Pick a rate from the quote and purchase it with Create a shipment.

1 min read

We now have enough information to book our shipment! Let's take a look at the rates that were returned in the response to our last request to create a quote.

Ratesjson
[
  {
    "id": "VDWLA0",
    "creditsApplied": 0,
    "estimatedPickupDate": "2019-03-26T23:45:40.000Z",
    "estimatedDeliveryDate": "2019-03-28T05:00:40.000Z",
    "price": 79,
    "provider": "mothership",
    "providerScac": "mhpg",
    "services": [],
    "transitDays": {
      "minimum": 1,
      "maximum": 1
    },
    "warnings": [],
    "coveragePrice": 0,
    "coveredValue": 0
  },
  {
    "id": "G6EMET",
    "creditsApplied": 0,
    "estimatedPickupDate": "2019-03-26T23:45:40.000Z",
    "estimatedDeliveryDate": "2019-03-27T05:00:40.000Z",
    "price": 108,
    "provider": "mothership",
    "providerScac": "mhpg",
    "services": ["guaranteed"],
    "transitDays": {
      "minimum": 0,
      "maximum": 0
    },
    "warnings": [],
    "coveragePrice": 0,
    "coveredValue": 0
  },
  {
    "id": "W7MG4A",
    "creditsApplied": 0,
    "estimatedPickupDate": "2019-03-26T23:45:40.000Z",
    "estimatedDeliveryDate": "2019-03-28T05:00:40.000Z",
    "price": 279,
    "provider": "mothership",
    "providerScac": "mhpg",
    "services": ["dedicated"],
    "transitDays": {
      "minimum": 1,
      "maximum": 1
    },
    "warnings": [],
    "coveragePrice": 0,
    "coveredValue": 0
  },
  {
    "id": "6FFQO0",
    "creditsApplied": 0,
    "estimatedPickupDate": "2019-03-26T23:45:40.000Z",
    "estimatedDeliveryDate": "2019-03-27T05:00:40.000Z",
    "price": 358,
    "provider": "mothership",
    "providerScac": "mhpg",
    "services": ["dedicated", "guaranteed"],
    "transitDays": {
      "minimum": 0,
      "maximum": 0
    },
    "warnings": [],
    "coveragePrice": 0,
    "coveredValue": 0
  }
]

We want to utilize Mothership's same-day service in this example, so we'll use the second rate (the one with the ID G6EMET). It has guaranteed service with zero transit days, in other words same-day delivery. Rate services lists every value services can hold.

Let's use the ID of the quote we requested in the last step (-LawNN52lCcvj6T5qiEp) and the ID of the rate we want to use (G6EMET) to make the request to purchase a shipment.

curl --request POST \
  --url https://sandbox.api.mothership.com/beta/shipments \
  --header "Authorization: Bearer $MOTHERSHIP_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "quoteId": "-LawNN52lCcvj6T5qiEp",
  "rateId": "G6EMET"
}'

And with that request, our shipment has been booked! The response holds the shipment, including its id, such as MS5016101. Use that ID to track the shipment, fetch its documents and find its invoices.