---
title: Generate Invoice PDF
slug: generate-invoice-pdf
docTags: 
createdAt: 2026-08-25T19:28:59.170Z
---

{
  "id": "Q5NmGdwWllxbDT83u5PRw",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.nue.io/billing/invoices/{id}/pdf:generate",
    "servers": [
      {
        "url": "https://api.nue.io/billing/invoices/{id}/pdf:generate",
        "description": "Nue Production API Endpoint"
      },
      {
        "url": "https://api.sandbox.nue.io/billing/invoices/{id}/pdf:generate",
        "description": "Nue Sandbox API Endpoint"
      }
    ],
    "name": "Generate Invoice PDF",
    "description": "Generate an invoice PDF using the specified template ID.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "id",
          "type": "string<uuid>",
          "description": "The invoice ID. The invoice cannot be in Draft or Canceled statuses.",
          "format": "uuid"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/pdf",
            "application/json",
            "*/*"
          ],
          "default": "application/pdf"
        }
      ],
      "queryParameters": [
        {
          "kind": "optional",
          "name": "templateId",
          "type": "string",
          "description": "<p>The invoice template ID used to generate the invoice PDF.  If not provided, the default invoice template will be used.</p>"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKeyAuth",
          "name": "nue-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "default response",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "schema": [
              {
                "name": "title",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "errorCode",
                "kind": "optional",
                "type": "string",
                "description": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Vl_90R6ElykZD_XknPJhC",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.nue.io/billing/invoices/{id}/pdf:generate \\\n     --header 'accept: application/pdf'"
        },
        {
          "id": "51WrVy-Pnf8rSFtjmvkaO",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/pdf\");\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/billing/invoices/{id}/pdf:generate\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "CD1F6hgMLIDWRru6_57x4",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.nue.io/billing/invoices/{id}/pdf:generate\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/pdf\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "1FmVm-nVOunXpJ27ofwQW",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.nue.io/billing/invoices/{id}/pdf:generate\"\n\npayload = {}\nheaders = {\n   'accept': 'application/pdf',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Vl_90R6ElykZD_XknPJhC"
    },
    "results": {
      "languages": [
        {
          "id": "hltxr5jnZnd5jprTpNV78",
          "language": "200",
          "code": "// default response\n"
        },
        {
          "id": "d92NsfyIMSYP8WgeZDjDd",
          "language": "400",
          "code": "// Bad Request\n{\n  \"title\": \"\",\n  \"message\": \"\",\n  \"errorCode\": \"\"\n}"
        },
        {
          "id": "A39XZR92Mb3_x0wu7-A2K",
          "language": "404",
          "code": "// Not Found\n"
        }
      ],
      "selectedLanguageId": "hltxr5jnZnd5jprTpNV78"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}