Skip to content

Cancel a shipment

POST
/stores/{storeRef}/orders/{id}/shipments/{shipmentId}/cancel
curl --request POST \
--url https://apibase.ecomweb.app/api/v1/stores/example/orders/1/shipments/1/cancel \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '{ "reason": "example" }'

Cancels the shipment with the AllinGo carrier and resets the order so it can be booked again. Any refund the carrier reports is returned as refunded_amount. A shipment that has already ended (cancelled, failed or returned) is refused with 409. reason is sent to the carrier as the cancellation note.

Required scopes: write:orders

id
required
integer

The order ID.

shipmentId
required
integer

The shipment ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

Media typeapplication/json
object
reason

Why the merchant cancels; sent to AllinGo as the note

string
<= 500 characters

Example generated

{
"reason": "example"
}
Media typeapplication/json
object
shipment
required

The shipment after cancellation.

object
provider_code
required

Carrier platform that booked the shipment. Always allingo.

string
Allowed values: allingo
mode
required

Whether the booking was made on the carrier’s test or live environment.

string
Allowed values: test live
status
required

Normalized status of the shipment.

string
Allowed values: booked picked_up in_transit out_for_delivery delivered failed returned cancelled
id
required

Shipment ID.

number
provider_status
required

The carrier platform’s own status code.

string
track_id
required

Tracking ID of the shipment on the carrier platform, or null.

string
nullable
partner_track_id
required

Tracking ID issued by the delivery partner, or null until one is attached.

string
nullable
partner_code
required

Code of the delivery partner, such as ghn.

string
partner_name
required

Name of the delivery partner.

string
partner_logo_url
required

Logo URL of the delivery partner, or null.

string
nullable
service_id
required

ID of the carrier service that was booked.

string
service_name
required

Name of the carrier service.

string
track_link
required

Public tracking page on the carrier platform, or null.

string
nullable
partner_track_link
required

Public tracking page of the delivery partner, or null.

string
nullable
cod_amount
required

Amount the courier collects from the recipient; 0 for a prepaid order.

number
fee_total
required

Total carrier fee, or null while it is not known.

number
nullable
booked_at
required

When the shipment was booked, as an ISO 8601 timestamp.

string
cancelled_at
required

When the shipment was cancelled, or null.

string
nullable
cancel_reason
required

Why the shipment was cancelled, or null.

string
nullable
delivered_at
required

When the shipment was delivered, or null.

string
nullable
events
required

Tracking history, newest first.

Array<object>
object
source
required

What recorded the event: a carrier webhook, a manual change or the system.

string
Allowed values: webhook manual system
id
required

Event ID.

number
status
required

Normalized shipment status after this event.

string
status_name
required

The carrier’s name for the status, or null.

string
nullable
occurred_at
required

When the event happened, as an ISO 8601 timestamp.

string
location
required

Where the parcel was, or null.

string
nullable
note
required

A note from the carrier or the merchant, or null.

string
nullable
images
required

URLs of proof photos attached to the event.

Array<string>
refunded_amount
required

Amount the carrier refunded, or null when none was reported.

number
nullable

Example

{
"shipment": {
"provider_code": "allingo",
"mode": "test",
"status": "booked",
"events": [
{
"source": "webhook"
}
]
}
}

The request is malformed or failed validation.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The request conflicts with the resource’s current state.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}