AutomationFlowsAI & RAG › Auto-fill PDF Forms with AI Using Autype, Openai, and Google Drive

Auto-fill PDF Forms with AI Using Autype, Openai, and Google Drive

By8Automator @kesim0 on n8n.io

Important: This workflow uses the Autype community node and requires a self-hosted n8n instance.

Event trigger★★★★☆ complexityAI-powered15 nodesHTTP RequestN8N Nodes AutypeAgentOpenAI ChatGoogle Drive
AI & RAG Trigger: Event Nodes: 15 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13902 — we link there as the canonical source.

This workflow follows the Agent → Google Drive recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-fill PDF forms with AI using Autype and OpenAI",
  "tags": [],
  "nodes": [
    {
      "id": "fdee74d8-7a0f-4b7f-8c2b-2bf2936eab99",
      "name": "Run Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        416,
        848
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d00a35ac-3e97-4a5c-9cd7-48fb0d7743ac",
      "name": "Download PDF Form",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        656,
        848
      ],
      "parameters": {
        "url": "https://drive.google.com/uc?export=download&id=19FEbkEjFA1H8jFcqHcDb5yGrJoiOe7-u",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a20f6ae9-4030-4698-aa10-fafd740d5027",
      "name": "Upload PDF Form",
      "type": "n8n-nodes-autype.autype",
      "position": [
        896,
        848
      ],
      "parameters": {
        "resource": "file"
      },
      "credentials": {
        "autypeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8094144a-4eb9-4077-a1a7-e437ce4200e2",
      "name": "Get Form Fields",
      "type": "n8n-nodes-autype.autype",
      "position": [
        1136,
        848
      ],
      "parameters": {
        "fileId": "={{ $json.id }}",
        "resource": "documentTools",
        "operation": "formFields"
      },
      "credentials": {
        "autypeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e0cccee6-0888-4f06-9b0e-3c9ec40bc645",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        704,
        1280
      ],
      "parameters": {
        "text": "=Fill out a PDF registration form.\n\nPerson/company data:\n- Full Name: Maria Schmidt\n- ID Number: 1234560001\n- Gender: Female\n- Married: yes\n- City: Berlin\n- Preferred Language: German\n- Notes: Submitted via automated workflow on {{ $now.format('yyyy-MM-dd') }}\n\nThe PDF form has these fields (from Autype Get Form Fields):\n\n{{ $json.metadata.fields.map(f => '- \"' + f.name + '\" (' + f.type + ')' + (f.options && f.options.length > 0 ? ' [options: ' + f.options.join(', ') + ']' : '') + (f.isReadOnly ? ' [read-only, skip]' : '')).join('\\n') }}\n\nMap each field name to the correct value from the data above.",
        "options": {
          "maxIterations": 3,
          "systemMessage": "You are a precise form-filling assistant. You receive applicant data and a list of PDF form fields with their types and allowed options. Return a JSON object mapping each field name to its value. Use exact option strings for dropdowns and radio groups. Use booleans for checkboxes. Skip read-only fields."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "395304b3-96cf-4681-8817-487f0803e96a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        704,
        1488
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "abefa7ee-b65b-4993-8f8b-159176b65dd0",
      "name": "Prepare Fill Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1024,
        1280
      ],
      "parameters": {
        "jsCode": "const raw = $json.output;\nconst fileId = $('Upload PDF Form').first().json.id;\n\n// The AI Agent returns a JSON string \u2014 parse and re-stringify to validate\nlet fields;\ntry {\n  fields = typeof raw === 'string' ? JSON.parse(raw) : raw;\n} catch (e) {\n  // Strip markdown fences if present and retry\n  let cleaned = raw.replace(/^```(?:json)?\\n?/, '').replace(/\\n?```$/, '');\n  fields = JSON.parse(cleaned);\n}\n\nreturn [{ json: { fields: JSON.stringify(fields), fileId } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "b0c18c27-1a8d-40a0-86df-f402d14dcc6d",
      "name": "Fill PDF Form",
      "type": "n8n-nodes-autype.autype",
      "position": [
        1264,
        1280
      ],
      "parameters": {
        "fields": "={{ $json.fields }}",
        "fileId": "={{ $json.fileId }}",
        "flatten": true,
        "resource": "documentTools",
        "operation": "fillForm",
        "downloadOutput": true
      },
      "credentials": {
        "autypeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4c0773d0-6d26-41ba-aa16-9b3f5ad36e41",
      "name": "Save Filled PDF to Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1472,
        1280
      ],
      "parameters": {
        "name": "=filled-form-{{ $now.format('yyyy-MM-dd') }}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_FOLDER_ID"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "220b9eb1-0b10-4a3b-bef3-be632309c441",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        464
      ],
      "parameters": {
        "width": 576,
        "height": 992,
        "content": "## Auto-Fill PDF Forms with AI Using Autype and OpenAI\n### This workflow downloads a fillable PDF form from a URL, extracts all form fields using Autype, sends the field list to an AI Agent (OpenAI) together with applicant data, and uses the structured AI response to fill the form automatically. The filled PDF is flattened (non-editable) and saved to Google Drive.\n\n**The sample form has these fields:**\n- FullName (text)\n- ID (text)\n- Gender (radio: Male / Female)\n- Married (checkbox: true / false)\n- City (dropdown: e.g. New York, Berlin, ...)\n- Language (optionlist: e.g. English, German, ...)\n- Notes (text)\n\n**Use Case:** A company that regularly fills the same government or compliance PDF forms -- permit applications, registrations, insurance declarations. The AI reads whatever fields the form has and maps the right values automatically.\n\nClick \"Test Workflow\" to run it once with the sample form.\n\n### How it works\n1. **Download PDF Form** -- Fetches the fillable PDF from a URL.\n2. **Upload PDF Form** -- Uploads it to Autype Tools.\n3. **Get Form Fields** -- Autype extracts field names, types, options, read-only flags as metadata.\n4. **AI Agent** -- Receives the field list and applicant data as a prompt. The system message instructs the AI to return raw JSON only.\n5. **Prepare Fill Data** -- Parses and validates the AI JSON output, pairs it with the file ID.\n6. **Fill PDF Form** -- Autype fills all fields and flattens them (non-editable).\n7. **Save Filled PDF to Drive** -- Uploads the completed PDF to Google Drive.\n\n### Requirements\n* **Autype account** -- [app.autype.com](https://app.autype.com) > Settings > API Keys\n* **OpenAI account** -- API key from [platform.openai.com](https://platform.openai.com)\n* **Google Drive** -- OAuth2 credential in n8n (optional)\n* **n8n-nodes-autype** -- Install via Settings > Community Nodes\n\n> Community node: requires self-hosted n8n. Not available on n8n Cloud."
      },
      "typeVersion": 1
    },
    {
      "id": "5b4bdb7b-c445-4d14-88d9-3331961c939d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 972,
        "height": 368,
        "content": "### 1. Download & Extract Form Fields\nDownloads the PDF form from a URL and uploads it to Autype. The Get Form Fields operation returns all field names, types, current values, and options as metadata (no output file). The field info flows directly into the AI Agent prompt via an expression."
      },
      "typeVersion": 1
    },
    {
      "id": "cb3cdc91-7371-445b-a87b-5043d040bc27",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        1088
      ],
      "parameters": {
        "color": 7,
        "width": 548,
        "height": 368,
        "content": "### 2. AI Agent Fills Fields\nThe AI Agent node receives the form fields and applicant data directly in its prompt (no separate Code node needed). The system message instructs the AI to return only a raw JSON object. The Prepare Fill Data code node validates and parses the response. Edit the applicant data directly in the AI Agent prompt."
      },
      "typeVersion": 1
    },
    {
      "id": "a814d65f-433c-43f7-b78e-0d0a4181baea",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        1088
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 336,
        "content": "### 3. Fill Form & Save\nThe Prepare Fill Data code node parses and validates the AI JSON, then passes it to the Autype Fill Form operation. Fields are flattened (non-editable). The result is saved to Google Drive. Replace the Drive node with Email, S3, Slack, or any other output."
      },
      "typeVersion": 1
    },
    {
      "id": "244791c0-c74a-4c66-abef-92f001778d13",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1280,
        848
      ],
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "cfcbc604-e525-4c19-8338-6e58cddc9177",
      "name": "Get tool job status",
      "type": "n8n-nodes-autype.autype",
      "position": [
        1440,
        848
      ],
      "parameters": {
        "jobId": "={{ $('Get Form Fields').item.json.id }}",
        "resource": "documentTools",
        "operation": "getJobStatus"
      },
      "credentials": {
        "autypeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get tool job status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Prepare Fill Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Workflow": {
      "main": [
        [
          {
            "node": "Download PDF Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fill PDF Form": {
      "main": [
        [
          {
            "node": "Save Filled PDF to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Form Fields": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF Form": {
      "main": [
        [
          {
            "node": "Get Form Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF Form": {
      "main": [
        [
          {
            "node": "Upload PDF Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Fill Data": {
      "main": [
        [
          {
            "node": "Fill PDF Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get tool job status": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Important: This workflow uses the Autype community node and requires a self-hosted n8n instance.

Source: https://n8n.io/workflows/13902/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

🎯 Create viral TikToks, Shorts, Reels, podcasts, and ASMR videos in minutes — all on autopilot.

OpenAI, HTTP Request, Form Trigger +7
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”

OpenAI, HTTP Request, XML +11
AI & RAG

&gt; Note: This workflow uses sticky notes extensively to document each logical section of the automation. Sticky notes are mandatory and already included to explain OCR, AI parsing, folder logic, dup

QuickBooks, Google Sheets, Google Drive +5
AI & RAG

This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste

Telegram, Telegram Trigger, Google Drive +8