{
  "name": "DeepXRoute - Invoice and receipt PDFs (HTTP)",
  "active": false,
  "nodes": [
    {
      "id": "read-me",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "parameters": {
        "content": "## One page of private PDFs\n\nChoose the same Header Auth credential on BOTH HTTP nodes: Authorization = Bearer followed by a space and a management credential with billing-documents:read. Ordinary inference keys cannot read these documents. Change kind to invoice, receipt or credit_note. This workflow makes no payments or document changes.\n\nList documents returns at most 10 items. If hasMore is true, add nextCursor as the cursor query parameter with unchanged filters for the next manual run. It does not fetch every page. PDFs appear in binary field document. Protect buyer details and files. Template execution saving is off; host logs, live output and downstream storage still need retention controls.",
        "width": 1000,
        "height": 210
      },
      "position": [
        0,
        -30
      ]
    },
    {
      "id": "start",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "parameters": {},
      "position": [
        0,
        240
      ]
    },
    {
      "id": "list-documents",
      "name": "List documents",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "parameters": {
        "method": "GET",
        "url": "https://api.deepxroute.com/v1/billing/documents",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          },
          "timeout": 30000,
          "response": {
            "response": {
              "responseFormat": "json",
              "neverError": false
            }
          }
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "kind",
              "value": "invoice"
            },
            {
              "name": "limit",
              "value": "10"
            }
          ]
        }
      },
      "position": [
        300,
        240
      ],
      "retryOnFail": false
    },
    {
      "id": "one-item-per-document",
      "name": "One item per document",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "parameters": {
        "fieldToSplitOut": "items",
        "include": "noOtherFields",
        "options": {}
      },
      "position": [
        600,
        240
      ]
    },
    {
      "id": "download-pdf",
      "name": "Download PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "parameters": {
        "method": "GET",
        "url": "={{ 'https://api.deepxroute.com/v1/billing/documents/' + encodeURIComponent($json.id) + '/pdf' }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "redirect": {
            "redirect": {
              "followRedirects": false
            }
          },
          "timeout": 30000,
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "document",
              "neverError": false
            }
          }
        }
      },
      "position": [
        900,
        240
      ],
      "retryOnFail": false
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "List documents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List documents": {
      "main": [
        [
          {
            "node": "One item per document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per document": {
      "main": [
        [
          {
            "node": "Download PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveExecutionProgress": false,
    "saveManualExecutions": false,
    "saveDataSuccessExecution": "none",
    "saveDataErrorExecution": "none"
  },
  "pinData": {},
  "tags": []
}
