Mediloop
DocsAPIsDelivery APICancel delivery
Delivery API

Cancel delivery

Cancel a delivery that has not yet reached a final completed state.

POST/v1/deliveries/{id}/cancelOAuth 2.0 (PKCE)Scopes: delivery.write

Description

Cancel an eligible delivery

Access

Authorized organization

Scopes

delivery.write

Rate limit

100 requests / min

Endpoint summary

Cancellation is permitted only while the delivery remains in a cancellable state. Final delivered or confirmed records remain immutable.

Path parameters

ParameterTypeRequiredDescription
idstring (uuid)YesID of the delivery to cancel

Request body

FieldTypeRequiredDescriptionExample
reasonstringNoCancellation reasonRecipient unavailable
notesstringNoAdditional operational contextReturn to origin
refund_requiredbooleanNoWhether related payment workflow should be evaluatedtrue

Cancellation rules

Current statusCancellation
pendingAllowed
in_transitPolicy dependent
out_for_deliveryPolicy dependent
deliveredNot allowed
confirmedNot allowed
cancelledAlready final

Example request

Cancel delivery

curl -X POST "https://api.mediloop.com/v1/deliveries/del_01H.../cancel" \
 -H "Authorization: Bearer $MEDILOOP_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"reason":"Recipient unavailable","notes":"Return to origin"}'

Example response

200 OK
{ "data": { "id":"del_01H...", "status":"cancelled", "cancellation_reason":"Recipient unavailable" } }

Example response

Cancellation does not silently delete the delivery. The resource remains available for audit with a final cancelled state.

Responses

HTTPDescription
200Delivery cancelled
400Invalid cancellation body
403Insufficient write scope
404Delivery not found
409Cancellation not allowed in current state

Delivery model

FieldMeaning
idDelivery identifier
order_idRelated order
statusCurrent delivery lifecycle state
carrierCarrier / delivery provider
tracking_numberExternal tracking reference
shipped_atDispatch timestamp
estimated_delivery_atEstimated arrival
delivered_atActual delivery time
notesOperational notes

Status values

StatusMeaning
pendingDelivery created and awaiting dispatch
in_transitShipment has left origin
out_for_deliveryCarrier is completing final mile
deliveredItems delivered
confirmedRecipient confirmed receipt
cancelledDelivery cancelled

Common use cases

Use caseTypical reason
Recipient unavailableReschedule / return to origin
Order cancelledStop shipment before completion
Carrier exceptionOperational failure
Address issueCannot complete delivery

Next steps