Deliveries
Write Deliveries
As a shipping provider, a delivery is the representation of one ot more parcels that you are delivering to a recipient. Often deliveries are created for you when a sender, including yourself, creates a shipment.
You can, however, create a delivery manually which will also create a complimentary shipment for the sender.
As the shipping provider, you are able to update the status and location properties of the delivery, which will update the sender and recipient via webhooks and notifications.
Create Delivery
Creating a delivery is pretty straight forward. Like for a shipment, you'll provide information about the sender, recipient, parcels, and the location_id that will initially be assigned the shipment.
Addresses
When you provide an address for the sender and recipient, you have a few options:
- Provide the full address as a string in the
address
property. If there is a unit number in the address and you collected it separately, you can provide that via theaddress_line2
property. - Provide the address as an object with the following properties
- line1
- line2 (optional)
- city
- state
- postal_code
- country (optional)
- Provide a PackageX address ID in the
address
property. PackageX address IDs are prefixed withaddr_
- Provide a PackageX location ID in the
location_id
property. PackageX location IDs are prefixed withloc_
Once the delivery has been created, you're able to update the status and location of the delivery. Notifications and webhooks will be sent to the sender and recipient as the delivery progresses.
When creating the delivery, you can additionally specify whether it is inbound or outbound by adding the following optional property in the request body (defaults to outbound):
- type
"outbound" | "inbound"
Update Delivery
When you are ready to update a delivery, you can update the status of the delivery which will typically send notifications to the sender and recipient, depending on what notifications they have enabled. You can also update the coordinates of the delivery without updating the status for a better user experience.
Update Status
Update Coordinates
You can update the coordinates for the delivery at any time. This will not create a tracking update but can be used to show the live location on a map.
Update Delivery Date & Time
You may also want to update the estimated delivery date and time for the delivery - especially as the delivery date approaches.
You can submit the estimated delivery date and time in the following formats:
- ISO Date string
- JS Date object
- Seconds from epoch
- Milliseconds from epoch
Update Delivery Type
You may also want to update the delivery type from outbound to inbound or vice versa.