O2M Logo
One to Many
Cancel an order
Was this page helpful?

Cancel an order

Cancel an order you created through the API, before it ships.

Overview

Cancels an order made through the API before it ships, and puts its units back on sale.

Request

POST/orders/{id}/cancel

Needs the permission orders:write

cURL
curl -X POST "https://api.o2m.in/api/v1/orders/4410/cancel" \
  -H "X-Access-Key: $O2M_ACCESS_KEY" \
  -H "X-Secret-Key: $O2M_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "Customer changed their mind"
}'
ParameterTypeRequiredDescription
idstringYesO2M's ID for the order, in the path.
reasonstringNoWhy it was cancelled, up to 500 characters.

When an order can be cancelled

  • It was created through the API.
  • Its status is placed or processing.

The order's units go back on sale. Cancelling an order that is already cancelled changes nothing and answers 200.

Response

200 with the order, now cancelled, in the shape described in List orders.

Response
{
  "id": "4410",
  "order_id": "SO-1001",
  "channel": "mysite",
  "status": "cancelled",
  "channel_status": "Cancelled through the API",
  "ordered_at": "2026-10-02T10:00:00.000Z",
  "updated_at": "2026-10-02T10:30:00.000Z",
  "dispatch_by": null,
  "shipped_at": null,
  "delivered_at": null,
  "cancelled_at": "2026-10-02T10:30:00.000Z",
  "total": 200,
  "tax": 30.51,
  "customer": {
    "name": "Ravi",
    "email": "ravi@example.com"
  },
  "shipping_address": {
    "name": "Ravi",
    "phone": "9800000000",
    "address1": "12 MG Road",
    "address2": null,
    "city": "Pune",
    "state": "Maharashtra",
    "pincode": "411001",
    "country": "IN"
  },
  "client": null,
  "lines": [
    {
      "id": "9001",
      "sku": "MUG-BLUE",
      "title": "Blue mug",
      "quantity": 2,
      "unit_price": 100,
      "total": 200,
      "tax": 30.51,
      "reserved": 0,
      "backordered": 0,
      "dispatched": 0,
      "delivered": 0,
      "returned": 0
    }
  ],
  "shipments": []
}

Errors

StatusCodeMessageWhat to do
404—Order not foundCheck the id.
404—Not foundThe id is not a valid ID.
409—This order came from Shopify: cancel it thereCancel the order on its channel.
409—The order is already shipped: it can no longer be cancelled hereHandle it as a return.

Every endpoint can also return the common errors: a missing or invalid key, a missing permission, the rate limit, or a temporary failure.