Create or update a delivery leg for a trackable item

A delivery leg is a stage of the parcel journey defined by a single tracking identifier.

It contains the necessary information for the delivery of a parcel and the information about the carrier delivering the parcel.

A delivery leg can be used to support a tracking experience after the trackable item has been allocated a tracking identifier.

A delivery leg can be linked to a delivery if they share the same delivery reference.

Multiple delivery legs can be linked to one another if they share the same parcel reference.

A delivery leg is identified by its tracking identifier only or its tracking identifier in combination with its parcel reference when both are provided.

Note: Each time you update a delivery leg, you must resubmit the mandatory information of the delivery leg in addition to any other data that you have added or modified.

SecurityBasicAuth
Request
header Parameters
User-Agent
string

The name of the client that interacts with the API.

Example: REPLACE-WITH-YOUR-USER-AGENT
Request Body schema: application/json
trackingIdentifier
required
string

The external identifier used to track the parcel. This can be the tracking identifier used by carriers or any barcode that identifies the parcel.

carrierCode
string

The carrier code (Metapack code).

carrierDisplayName
string

The name of the carrier.

carrierServiceCode
string

The service code (Metapack code).

carrierTrackingURL
string <uri> ^https://

The link to the carrier website for tracking the parcel.

deliveryRef
string

The unique delivery reference.

finalDeliveryLeg
boolean

Indicates that the parcel delivery leg is the final stage in the delivery journey. Default to true.

object (Collection)

Collection information for pickup point or store collection delivery.

object (DeliveryInformation)

Information about the type of delivery.

object (Order)

An order contains information about the seller and the customer. It is used to provide the full overview of the deliveries for all the parcels within this order by using the order reference (orderRef).

object (DeliveryLegParcel)
object (Recipient)

The person receiving the parcel(s) in an order. The recipient is used to provide the destination time zone (Recipient.timeZone), which is used to process tracking events received from carriers when they do not provide time zone information with their events.

object (Sender)

Sender contains the information about the location from where the parcels for a delivery will ship. It contains the source time zone (Sender.timeZone), which is used to process tracking events received from carriers when they do not provide time zone information with their events.

Responses
204

The delivery leg information has been processed successfully

400

Bad request.

The request failed validation due to missing required information in the parameters or the body of the request.

Error code: PS-0400.

401

Unauthorized.

The request did not provide the credentials required to authorize access to the API.

Error code: PS-0401.

403

Forbidden.

The API user is not authorized to proceed with the processing of the request.

Error code: PS-0403.

415

Unsupported media format.

The request failed due to an unsupported media type in the request.

Error code: PS-0415.

500

Internal Server Error.

The processing of the request failed due to an internal problem. The request needs to be retried.

Error code: PS-0500.

post/delivery-legs
Request samples
application/json
{
  • "trackingIdentifier": "REPLACE-WITH-YOUR-TRACKING-IDENTIFIER",
  • "carrierCode": "DPD_UK",
  • "carrierDisplayName": "DPD UK",
  • "carrierServiceCode": "DPD_UK_CLASSIC",
  • "deliveryRef": "REPLACE-WITH-YOUR-DELIVERY-REF",
  • "finalDeliveryLeg": true,
  • "collection": {
    },
  • "delivery": {
    },
  • "order": {
    },
  • "parcel": {
    },
  • "recipient": {
    },
  • "sender": {
    }
}
Response samples
application/json
{
  • "message": "This is an error message",
  • "errorCode": "PS-XXXX",
  • "systemMessage": "This is a system message related to the error",
  • "traceId": "4d1544c7-1977-4c03-82fa-ecacd1837532",
  • "timestamp": "2019-08-24T14:15:22Z"
}