---
title: Create Quote From Template
slug: create-quote-from-template
docTags: 
createdAt: 2026-09-19T04:28:50.328Z
---

{
  "id": "Pa2I37FmY09jQzcquCJuO",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.nue.io/cpq/quotes:createFromTemplate",
    "servers": [
      {
        "url": "https://api.nue.io/cpq/quotes:createFromTemplate",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/cpq/quotes:createFromTemplate",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Create Quote From Template",
    "description": "<p>Creates a new quote on an opportunity from a <strong>template quote</strong>, copying the template's line items, applied line price tags and price tiers in a single call.</p>\n<p><strong>A template carries the SHAPE of a deal, never a locked price.</strong> The copied result is ALWAYS repriced against the new quote's OWN account, so a discount whose tier depends on the customer (headcount, volume, segment) re-resolves to the new customer's band rather than the template's. Expect the money to differ from the template whenever the two accounts resolve differently.</p>\n<p><strong>Key behaviors:</strong></p>\n<ul>\n<li>The source <strong>must</strong> be flagged as a template quote. A non-template source is refused with 400 and nothing is created</li>\n<li>The new quote is <strong>Draft</strong> and never primary, and inherits the template's <strong>price book, subscription term and start date</strong>. There is no <code>priceBookId</code> parameter: the copy rejects any quote whose price book differs from the template's</li>\n<li>The endpoint accepts no name, date or term overrides — follow with <code>POST /cpq/quotes/{quoteId}:update</code></li>\n<li><strong>Header</strong> custom fields are NOT inherited from the template; a template supplies line items, not header values. Set them yourself on the follow-up update. <strong>Line-level</strong> custom fields DO copy</li>\n<li>Tax is recalculated for the new quote's own account and shipping jurisdiction. This is <strong>best effort and is not reported back</strong>: a tenant with taxation off, or a tax engine that rejects the address, still returns 200. Read the quote back if the tax figure matters</li>\n<li><strong>Not idempotent</strong> — each call creates another quote</li>\n</ul>\n<p>Use <code>POST /cpq/quotes/{targetQuoteId}:copyFromTemplate</code> when the target quote already exists, and <code>POST /cpq/quotes/{quoteId}:clone</code> to duplicate an ordinary, non-template quote.</p>\n<p>Salesforce-integrated tenants only.</p>\n<p>Apex equivalent: <code>Ruby.GlobalQuoteService.createQuoteFromTemplate(String templateQuoteId, String opportunityId)</code>.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "CreateQuoteFromTemplateRequest",
          "schema": [
            {
              "name": "templateQuoteId",
              "kind": "required",
              "type": "string",
              "description": "<p>Id of the template quote to create from. It must be flagged as a template quote (<code>Ruby__Is_Template_Quote__c = true</code>); an ordinary quote is refused.</p>"
            },
            {
              "name": "opportunityId",
              "kind": "required",
              "type": "string",
              "description": "Id of the opportunity the new quote belongs to."
            }
          ],
          "modelRef": "#/components/schemas/CreateQuoteFromTemplateRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "ApiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "The quote was created from the template.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "CreateQuoteFromTemplateResponse",
            "schema": [
              {
                "name": "quote",
                "kind": "optional",
                "type": "map",
                "description": "The created quote record.",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "lineItemsCopied",
                "kind": "optional",
                "type": "integer",
                "description": "Number of line items copied from the template quote."
              },
              {
                "name": "priceTagsCopied",
                "kind": "optional",
                "type": "integer",
                "description": "Number of applied line price tags copied from the template quote."
              }
            ],
            "modelRef": "#/components/schemas/CreateQuoteFromTemplateResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>Invalid request, the source is not a template quote, or the template has no price book. Nothing was created.</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": "404",
        "description": "The template quote was not found.",
        "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": "500",
        "description": "<p>Internal server error. The outcome is unknown — check the opportunity for a new Draft quote 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": "f_1A6_hjczMhmzANhRZVS",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.nue.io/cpq/quotes:createFromTemplate \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"templateQuoteId\": \"\",\n     \"opportunityId\": \"\"\n     }'"
        },
        {
          "id": "YTK7IIldxLjpDRVrSKDmt",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"templateQuoteId\": \"\",\n   \"opportunityId\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/cpq/quotes:createFromTemplate\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "up60k1iUFThVXKvOoF1OM",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/cpq/quotes:createFromTemplate\")\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\"\nrequest.body = JSON.dump({\n   \"templateQuoteId\": \"\",\n   \"opportunityId\": \"\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "wVNg-qg6LxUomZC8B2iaJ",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/cpq/quotes:createFromTemplate\"\n\npayload = json.dumps({\n   \"templateQuoteId\": \"\",\n   \"opportunityId\": \"\"\n})\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": "f_1A6_hjczMhmzANhRZVS"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// The quote was created from the template.\n{\n  \"quote\": \"\",\n  \"lineItemsCopied\": 0,\n  \"priceTagsCopied\": 0\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid request, the source is not a template quote, or the template has no price book. Nothing was created.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// The template quote was not found.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        },
        {
          "id": "response-3-500",
          "language": "500",
          "code": "// Internal server error. The outcome is unknown — check the opportunity for a new Draft quote before retrying.\n{\n  \"code\": 400,\n  \"message\": \"Bad Request\",\n  \"details\": \"Required field 'name' is missing\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}