{
  "name": "Docspout: Google Sheet → bulk certificates",
  "nodes": [
    {
      "parameters": {
        "content": "## Google Sheet → bulk certificates\n1. In Docspout, open a **Certificate** starter, click **Publish**, and copy its template id (`tpl_...`).\n2. Paste it over `tpl_REPLACE_ME` in the **Start the batch** node.\n3. Credentials → New → **Header Auth**: name `Authorization`, value `Bearer sk_test_...` (a test key while you try it; switch to a live key after). Call it `Docspout API key`.\n4. Connect Google Sheets and paste your sheet's URL into **Read the sheet**. Header row: `Name, Course, Date, Instructor, Verify URL`.\n\nThe batch runs on Docspout's side and resumes if anything restarts. Open **Renders** in the dashboard to download each PDF, or add `webhook_url` to the body to hear when it finishes.",
        "height": 320,
        "width": 560
      },
      "id": "note",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -340
      ]
    },
    {
      "parameters": {},
      "id": "manual",
      "name": "Run",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "options": {}
      },
      "id": "sheets",
      "name": "Read the sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        220,
        0
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// One row per sheet line. Column names must match your sheet's header row.\nreturn [{ json: { rows: $input.all().map((item) => ({\n  name: item.json['Name'],\n  course: item.json['Course'],\n  date: item.json['Date'],\n  instructor: item.json['Instructor'],\n  verify_url: item.json['Verify URL'],\n})) } }];"
      },
      "id": "code",
      "name": "Build batch rows",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://docspout.com/v1/batches",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $execution.id }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ template: 'tpl_REPLACE_ME', rows: $json.rows }) }}",
        "options": {}
      },
      "id": "start-the-batch",
      "name": "Start the batch",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": "Docspout API key"
        }
      }
    }
  ],
  "connections": {
    "Run": {
      "main": [
        [
          {
            "node": "Read the sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read the sheet": {
      "main": [
        [
          {
            "node": "Build batch rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build batch rows": {
      "main": [
        [
          {
            "node": "Start the batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}