---
title: Cancel Order
slug: cancel-order
docTags: 
createdAt: 2026-09-19T04:28:50.328Z
---

{
  "id": "FEAQyg58S0jqrvTs_q-Lo",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/cpq/orders/{orderId}:cancel",
    "servers": [
      {
        "url": "https://api.nue.io/cpq/orders/{orderId}:cancel",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/cpq/orders/{orderId}:cancel",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Cancel Order",
    "description": "<p>Cancels an <strong>activated</strong> order, unwinding its subscriptions, assets and entitlements to their previous version and reversing their daily and monthly ARR records.</p>\n<p><strong>This is irreversible.</strong> A canceled order cannot be reactivated.</p>\n<p><strong>Key behaviors:</strong></p>\n<ul>\n<li>Only <strong>Activated</strong> orders can be canceled. A Draft order has provisioned nothing — delete it instead</li>\n<li>The <code>CancelOrder</code> permission and the bundle-child dependency check are enforced <strong>server-side</strong></li>\n<li>An order with dependent orders, a split order, or one with superseding changes is refused with 400</li>\n<li>Salesforce-origin orders only</li>\n<li>Takes <strong>no request body</strong> and returns <strong>no content</strong> on success</li>\n<li>A 504 means the outcome could not be confirmed, not that the cancel failed — read the order's status before retrying</li>\n</ul>\n<p>To check eligibility first, call <code>POST /orders/cancelable</code> on the order service; note it reports only that no active invoice blocks the order, and does not check order status or dependent orders.</p>\n<p>Apex equivalent: <code>Ruby.GlobalOrderService.cancelActiveOrders(List&#x3C;Id> orderIds)</code>.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "orderId",
          "type": "string",
          "description": "The id of the activated order to cancel."
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "ApiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "The order was canceled. No response body.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "<p>Business refusal — the order has dependent orders, is already canceled, was never activated, or the caller lacks the CancelOrder permission.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Error response",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "integer",
                "description": "HTTP status code",
                "example": 400
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Bad Request"
              },
              {
                "name": "details",
                "kind": "optional",
                "type": "string",
                "description": "Detailed error information",
                "example": "Required field 'name' is missing"
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "409",
        "description": "Cancel via Apex is not enabled for this tenant.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Error response",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "integer",
                "description": "HTTP status code",
                "example": 400
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Bad Request"
              },
              {
                "name": "details",
                "kind": "optional",
                "type": "string",
                "description": "Detailed error information",
                "example": "Required field 'name' is missing"
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "504",
        "description": "<p>The cancel outcome could not be confirmed. The order may or may not have been canceled — read its status before retrying.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Error response",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "integer",
                "description": "HTTP status code",
                "example": 400
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": "Bad Request"
              },
              {
                "name": "details",
                "kind": "optional",
                "type": "string",
                "description": "Detailed error information",
                "example": "Required field 'name' is missing"
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "yFi5VZ_6ko7Ltn_ElzTED",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/cpq/orders/{orderId}:cancel \\\n     --header 'accept: application/json'"
        },
        {
          "id": "7QDLWrvRd4vSafX5J5DV3",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/cpq/orders/{orderId}:cancel\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Tl5ZkuQC8mDC3nJinu-Gq",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/cpq/orders/{orderId}:cancel\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "z18ydlCoafIIF5_xaKcaq",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/cpq/orders/{orderId}:cancel\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "yFi5VZ_6ko7Ltn_ElzTED"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// The order was canceled. No response body.\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Business refusal — the order has dependent orders, is already canceled, was never activated, or the caller lacks the CancelOrder permission.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        },
        {
          "id": "response-2-409",
          "language": "409",
          "code": "// Cancel via Apex is not enabled for this tenant.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        },
        {
          "id": "response-3-504",
          "language": "504",
          "code": "// The cancel outcome could not be confirmed. The order may or may not have been canceled — read its status before retrying.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}