---
title: Generate Draft Order Magic Link with Custom Template
slug: generate-draft-order-magic-link-with-custom-template
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "C0aEL5cEpd48j6epciJ9A",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId}",
    "servers": [
      {
        "url": "https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId}",
        "description": "**Production Environment** - Live production server for all customer-facing operations. Use this for production integrations with real customer data and transactions."
      },
      {
        "url": "https://api.sandbox.nue.io/orders/magiclink/order/{orderId}/template/{templateId}",
        "description": "**Sandbox Environment** - Safe testing environment with sample data for development and integration testing. No rate limits apply. Data is reset weekly. Perfect for prototyping and QA testing."
      }
    ],
    "name": "Generate Draft Order Magic Link with Custom Template",
    "description": "This endpoint generates a magic link that can be used to create a PDF quote from a draft order using a custom template for branding.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "orderId",
          "type": "string<uuid>",
          "example": "123e4567-e89b-12d3-a456-426614174000",
          "description": "The ID of the draft order to generate a quote for.",
          "format": "uuid"
        },
        {
          "kind": "required",
          "name": "templateId",
          "type": "string",
          "example": "custom-branded-template",
          "description": "The template ID for custom branding of the PDF quote."
        }
      ],
      "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": "Successful response",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Successful response\n{\n  \"magicLink\": \"\"\n}"
          },
          {
            "label": "customTemplateResponse",
            "code": "// Response for custom template request\n{\n  \"magicLink\": \"https://quotes.nue.io/order/123e4567-e89b-12d3-a456-426614174000/template/custom-branded-template\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "magicLink",
                "kind": "required",
                "type": "string<url>",
                "description": "A URL that can be used to generate and view a PDF quote of the draft order with custom branding.",
                "format": "url"
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>Bad Request - The request was malformed or contained invalid parameters.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "FAILURE"
              },
              {
                "name": "errorType",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "VALIDATION_ERROR"
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "INVALID_TEMPLATE_ID"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "The specified template ID is invalid or not accessible."
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "<p>Unauthorized - Authentication information is missing or invalid</p>",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "<p>Not Found - The specified order ID or template ID does not exist.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "FAILURE"
              },
              {
                "name": "errorType",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "NOT_FOUND"
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "ORDER_NOT_FOUND"
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "",
                "example": "The specified order ID or template ID does not exist."
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "VbSVJAsxnpbWA8z3g5tfl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "tfRRNKHurxVKggw9fyreu",
          "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: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "fuVm3C-r1ksjGRL-oSXFD",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "e2Qe9n1Whm_v_H2LdPWlF",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/orders/magiclink/order/{orderId}/template/{templateId}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "VbSVJAsxnpbWA8z3g5tfl"
    },
    "results": {
      "languages": [
        {
          "id": "WcsvmZN0hHnJOxhlyspyf",
          "language": "200",
          "code": "// Successful response\n{\n  \"magicLink\": \"\"\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Successful response\n{\n  \"magicLink\": \"\"\n}"
            },
            {
              "label": "customTemplateResponse",
              "code": "// Response for custom template request\n{\n  \"magicLink\": \"https://quotes.nue.io/order/123e4567-e89b-12d3-a456-426614174000/template/custom-branded-template\"\n}"
            }
          ]
        },
        {
          "id": "_i75mVt8ohJzbY2FJB9xB",
          "language": "400",
          "code": "// Bad Request - The request was malformed or contained invalid parameters.\n{\n  \"status\": \"FAILURE\",\n  \"errorType\": \"VALIDATION_ERROR\",\n  \"errorCode\": \"INVALID_TEMPLATE_ID\",\n  \"message\": \"The specified template ID is invalid or not accessible.\"\n}"
        },
        {
          "id": "72Uq9-1xwDxWSOG2uv9bS",
          "language": "401",
          "code": "// Unauthorized - Authentication information is missing or invalid\n"
        },
        {
          "id": "SRSy237FQOvwXIHey-FHz",
          "language": "404",
          "code": "// Not Found - The specified order ID or template ID does not exist.\n{\n  \"status\": \"FAILURE\",\n  \"errorType\": \"NOT_FOUND\",\n  \"errorCode\": \"ORDER_NOT_FOUND\",\n  \"message\": \"The specified order ID or template ID does not exist.\"\n}"
        }
      ],
      "selectedLanguageId": "WcsvmZN0hHnJOxhlyspyf"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}