---
title: Turn the buckets of a quote into orders
slug: turn-the-buckets-of-a-quote-into-orders
docTags: 
createdAt: 2026-10-25T21:00:19.009Z
---

{
  "id": "E3bxvJe0ccvR834oqFg8i",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize",
    "servers": [
      {
        "url": "https://api.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Turn the buckets of a quote into orders",
    "description": "<p>Turn a quote's line buckets into orders.</p>\n<p>Convert buckets into orders, one order per NON-EMPTY bucket. Each bucket stands alone: a bucket that fails comes back FAILED with its reason while the others still become orders, a bucket that already has an order is reported ALREADY_FINALIZED rather than converted again, so repeating a call cannot create a second order, and a bucket holding no lines comes back SKIPPED_EMPTY and makes no order -- there is nothing to put in it, so that is the right outcome and not a failure. A large request may not fit in one call -- a bucket the call ran out of capacity before reaching comes back with outcome NOT_REACHED, and the buckets already finalized are safe, so call again until no NOT_REACHED comes back. On each later call send bucketRefs listing the buckets still to do: every NOT_REACHED one, and none that came back FAILED. The two are different and the difference matters -- NOT_REACHED was never tried, while FAILED was tried and refused, usually by one of the org's own validation rules, so it fails again every time and with allDraft each call pays to find it before it reaches new work (QA measured 60 buckets with two bad ones: 6 calls repeating allDraft, 3 when the failed ones were left out). Tell the user which buckets failed and why, rather than retrying them. asyncJobIds lists background jobs (start-date recalculation) that must finish before the orders are settled. activateOrders activates the orders this call creates, as it creates them; leave it off unless the user asked for that. It does NOT activate an order that an earlier call already made: that bucket is ALREADY_FINALIZED and its order stays as it was, so activating it afterwards is a separate step on the order itself.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "quoteId",
          "type": "string",
          "description": "The Quote id."
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "*/*"
          ],
          "default": "*/*"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Which buckets to finalize",
          "customType": "FinalizeLineBucketsRequest",
          "schema": [
            {
              "name": "bucketRefs",
              "kind": "optional",
              "type": "array",
              "description": "<p>The buckets to finalize, by bucketKey or id. Leave empty and set allDraft to take every draft bucket on the first call; on a follow-up call list the buckets still to do here -- every one that came back NOT_REACHED, and none that came back FAILED.</p>",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "allDraft",
              "kind": "optional",
              "type": "boolean",
              "description": "Finalize every draft bucket on this quote or order."
            },
            {
              "name": "activateOrders",
              "kind": "optional",
              "type": "boolean",
              "description": "<p>false (default) = create the orders as Draft. true = also activate them, which generates subscriptions, assets and entitlements that cannot be un-created, only cancelled.</p>",
              "default": false
            }
          ],
          "modelRef": "#/components/schemas/FinalizeLineBucketsRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "ApiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "One outcome per bucket",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "3ugePOxv2ZNlK4jIeFmkB",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize \\\n     --header 'accept: */*'"
        },
        {
          "id": "OvHJM6dtf7nCaQ_aWuPkV",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"*/*\");\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/quotes/{quoteId}/line-buckets:finalize\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "-S6AzrnR8WB1QyIY_QpWQ",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"*/*\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Ch1eyOSwzjW-pFmcnnPJy",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/cpq/quotes/{quoteId}/line-buckets:finalize\"\n\npayload = {}\nheaders = {\n   'accept': '*/*',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "3ugePOxv2ZNlK4jIeFmkB"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// One outcome per bucket\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}