ParcelParcelAPI docs

API docs Endpoints

Cancel a pickup

Markdown

Cancel the carrier pickup of a shipment. The shipment stays booked.

DELETEhttps://services.parcelparcel.com/partners-api/v1/shipments/{shipmentId}/pickup

Example request

Cancel the pickup of a shipment

curl --request DELETE 'https://services.parcelparcel.com/partners-api/v1/shipments/1588448/pickup' \
  --header 'X-PP-API: {YourAPIKey}@{YourAPISecret}' \
  --header 'Content-Type: application/json'

Tip: copy the cURL and paste it in Postman under Import, or straight into the URL bar of a new request. Postman fills in the method, headers and body for you. Replace {YourAPIKey}@{YourAPISecret} with your own API key and secret (use your sandbox key while testing), or import the whole Postman Collection.

This endpoint cancels the pickup of a shipment. The shipment itself stays booked: you can drop the parcel off yourself, or schedule a new pickup.

Want to cancel the whole shipment? Use Cancel a (draft) shipment. That also cancels the pickup.

Replace {shipmentId} with the id that you got in the response when you created the shipment.

  • This works only while the carrier has not picked up the parcel.
  • You can only use shipments of your own account. A shipment of another account gives the same 404 as an unknown id.

Add the following headers:

NameValue
Content-Typeapplication/json
X-PP-API{YourAPIKey}@{YourAPISecret}

Don't have an API Key and API Secret yet? Check our Authentication page to see how to get them in under a minute.

Body

This endpoint does not need a request body.

Response

The response body is a JSON object with the following elements:

NameValueComments
shipmentId(int)The id of the shipment.
cancelled(bool)true if the pickup is cancelled.
carrierStatus(string)How the carrier handled the cancellation: confirmed, requested, not_supported or sandbox. See Carrier status values.
message(string)Tells you the result in plain English.

Errors have the same format as in Schedule a pickup.

Status codes

Status codeMeaning
200 OKThe pickup is cancelled. The shipment stays booked.
404 Not FoundWe could not find the shipment in your account. Make sure that the shipmentId is correct.
409 ConflictThe shipment has no pickup to cancel, the carrier already has the parcel, or the shipment is cancelled. See message.
422 Unprocessable EntityThe carrier refused the cancellation. Nothing changed. Read message for the reason.
502 Bad GatewayWe could not reach the carrier. Nothing changed: try again later.

Examples

Don't know how to test these requests? Check our guide.

Request example - Cancel the pickup of a shipment

curl --location --request DELETE 'https://services.parcelparcel.com/partners-api/v1/shipments/1588448/pickup' \
--header 'X-PP-API: {YourAPIKey}@{YourAPISecret}' \
--header 'Content-Type: application/json'

Don't forget to change the X-PP-API element in the header, or this request will not work.

Response example - Pickup cancelled (200)

JSON
{
  "shipmentId": 1588448,
  "cancelled": true,
  "carrierStatus": "confirmed",
  "message": "The carrier confirmed that the pickup is cancelled. The shipment stays booked: drop it off or schedule a new pickup."
}

Response example - No pickup to cancel (409)

JSON
{
  "error": "conflict",
  "message": "The shipment has no pickup to cancel."
}

Response example - Carrier not reachable (502)

JSON
{
  "error": "carrier_unavailable",
  "message": "The carrier could not be reached. Nothing was changed; try again later."
}

Response example - Shipment not found (404)

JSON
"Shipment not found"