---
updatedAt: 2026-09-30T02:03:15.000Z
---

# Cancel order lines

Call this endpoint to cancel one or more order lines for a specific order. Use this action when you are unable to fulfill certain items or need to cancel an order partially or entirely. This endpoint updates the order line status to `Cancelled` and returns the updated order details.

> **Note:**
>
> * Make sure you only cancel order lines that have not been shipped.
> * Orders fulfilled by Walmart Fulfillment Services (WFS) can't be cancelled using this endpoint. Use the [Cancel customer order for WFS item](/us-marketplace/docs/cancel-customer-order-for-wfs-item) endpoint instead.

# Endpoint

```Text Bash
POST https://marketplace.walmartapis.com/v3/orders/{purchaseOrderId}/cancel
```

# Sample request

```curl
curl --request POST \
     --url https://marketplace.walmartapis.com/v3/orders/purchaseOrderId/cancel \
     --header 'accept: application/problem+json' \
     --header 'content-type: application/json' \
     --data '
{
  "orderCancellation": {
    "orderLines": {
      "orderLine": [
        {
          "lineNumber": "1",
          "orderLineStatuses": {
            "orderLineStatus": [
              {
                "status": "Cancelled",
                "cancellationReason": "CUSTOMER_REQUESTED_SELLER_TO_CANCEL",
                "statusQuantity": {
                  "unitOfMeasurement": "EA",
                  "amount": "1"
                }
              }
            ]
          }
        }
      ]
    }
  }
}
'
```

> **Note**: You can cancel specific order lines by specifying their `orderLine`. For a full order cancellation, include all order lines in the request.

# Modify your code

* Replace `{purchaseOrderId}` in the endpoint URL with the actual order ID you want to cancel.
* Substitute `<Base64EncodedClientID:ClientSecret>` with your Base64-encoded credentials.
* Update `WM_QOS.CORRELATION_ID` with a unique value for tracking your request.
* Adjust the `orderCancellation` payload if you need to cancel additional order lines or specify a different cancellation reason.

### Cancellation reason codes

To cancel an order line, you must include a valid `cancellationReason` value. The reason you choose helps Walmart understand why the item cannot be fulfilled and may affect future item visibility or fraud evaluation.

Refer to the [Cancel order lines API reference](/us-marketplace/reference/cancelorderlines) for the full list.

| `cancellationReason`                    | When to use it                                                                                                                     |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `CUSTOMER_REQUESTED_SELLER_TO_CANCEL`   | The customer asked to cancel the item.                                                                                             |
| `SELLER_CANCEL_OUT_OF_STOCK`            | The item is out of stock. Walmart may hide the item from listings until inventory is replenished.                                  |
| `SELLER_CANCEL_PRICING_ERROR`           | There’s a pricing error, such as a mismatch between the listed price and what was intended.                                        |
| `SELLER_CANCEL_ADDRESS_NOT_SERVICEABLE` | You or your carrier can’t deliver to the customer’s address.                                                                       |
| `SELLER_CANCEL_FRAUD_STOP_SHIPMENT`     | You’ve confirmed the order is fraudulent. If you're unsure, contact the Walmart Risk Prevention team (refer to the API Reference). |

> **Note**: If the cancellation reason does not match the situation, Walmart may restrict or flag your listings.

# Sample responses

## application/json

## 200

```json
{
  "order": {
    "purchaseOrderId": "1577914061094",
    "customerOrderId": "5571600820432",
    "customerEmailId": "VBayana@walmartlabs.com",
    "orderType": "PREORDER",
    "orderDate": 1476387173000,
    "shippingInfo": {
      "phone": "6502248603",
      "estimatedDeliveryDate": 1479798000000,
      "estimatedShipDate": 1476424800000,
      "methodCode": "Standard",
      "postalAddress": {
        "name": "Madhukara  PGOMS",
        "address1": "860 W Cal Ave",
        "address2": "Seat # 860C.2.176",
        "city": "Sunnyvale",
        "state": "CA",
        "postalCode": "94086",
        "country": "USA",
        "addressType": "RESIDENTIAL"
      }
    },
    "orderLines": {
      "orderLine": [
        {
          "lineNumber": "1",
          "item": {
            "productName": "Ozark Trail 4-Person Dome Tent",
            "sku": "NJ_WITHOUT_RCA_003"
          },
          "charges": {
            "charge": [
              {
                "chargeType": "PRODUCT",
                "chargeName": "ItemPrice",
                "chargeAmount": {
                  "currency": "USD",
                  "amount": 0
                },
                "tax": {
                  "taxName": "Tax1",
                  "taxAmount": {
                    "currency": "USD",
                    "amount": 0
                  }
                },
                "taxAndOtherFees": {
                  "taxName": "Tax1",
                  "taxAmount": {
                    "currency": "USD",
                    "amount": 0
                  }
                }
              },
              {
                "chargeType": "SHIPPING",
                "chargeName": "Shipping",
                "chargeAmount": {
                  "currency": "USD",
                  "amount": 0
                },
                "tax": {
                  "taxName": "Tax2",
                  "taxAmount": {
                    "currency": "USD",
                    "amount": 0
                  }
                },
                "taxAndOtherFees": {
                  "taxName": "Tax2",
                  "taxAmount": {
                    "currency": "USD",
                    "amount": 0
                  }
                }
              }
            ]
          },
          "orderLineQuantity": {
            "unitOfMeasurement": "EACH",
            "amount": "1"
          },
          "statusDate": 1481755720000,
          "orderLineStatuses": {
            "orderLineStatus": [
              {
                "status": "Cancelled",
                "statusQuantity": {
                  "unitOfMeasurement": "EACH",
                  "amount": "1"
                }
              }
            ]
          }
        }
      ]
    }
  }
}
```

## 400

```json
{
  "errors": [
    {
      "code": "INVALID_REQUEST_CONTENT.GMP_ORDER_API",
      "description": "Invalid request content.",
      "info": "Request content is not valid.",
      "severity": "ERROR",
      "category": "DATA"
    }
  ]
}
```

## 401

```json
{
  "errors": [
    {
      "code": "UNAUTHORIZED.GMP_ORDER_API",
      "description": "Unauthorized request.",
      "info": "Authentication failed. Verify your credentials.",
      "severity": "ERROR",
      "category": "APPLICATION"
    }
  ]
}
```

## 403

```json
{
  "errors": [
    {
      "code": "FORBIDDEN.GMP_ORDER_API",
      "description": "Access denied.",
      "info": "You do not have permission to perform this action.",
      "severity": "ERROR",
      "category": "APPLICATION"
    }
  ]
}
```

## 404

```json
{
  "errors": [
    {
      "code": "NOT_FOUND.GMP_ORDER_API",
      "description": "Resource not found.",
      "info": "The requested purchase order was not found.",
      "severity": "ERROR",
      "category": "DATA"
    }
  ]
}
```

## 429

```json
{
  "errors": [
    {
      "code": "RATE_LIMIT_EXCEEDED.GMP_ORDER_API",
      "description": "Too many requests.",
      "info": "Rate limit exceeded. Retry after the specified time.",
      "severity": "ERROR",
      "category": "APPLICATION"
    }
  ]
}
```

## 500

```json
{
  "errors": [
    {
      "code": "INTERNAL_SERVER_ERROR.GMP_ORDER_API",
      "description": "An internal server error occurred.",
      "info": "Retry the request. If the issue persists, contact support.",
      "severity": "ERROR",
      "category": "SYSTEM"
    }
  ]
}
```

## application/problem+json

## 400

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

## 401

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

## 403

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

## 404

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

## 429

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

## 500

```json
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}
```

An order response can include multiple `miscAttribute` groups when an item belongs to more than one program. For example, a virtual pack can include a `VIRTUAL_PACK` group alongside any other applicable metadata groups.

# Result

If successful, the API returns an `HTTP status: 200 OK` along with a JSON object showing the updated order details. The specified order lines will now have a `Cancelled `status, indicating that those items will no longer be fulfilled.