AutomationFlowsAI & RAG › Generate Summaries From Uploaded Files Using Openai Assistants API

Generate Summaries From Uploaded Files Using Openai Assistants API

BySam Robertson @samrobertson on n8n.io

Upload a document (PDF, DOCX, PPTX, TXT, CSV, JSON, or Markdown) and receive an AI-generated summary containing:

Event trigger★★★★☆ complexity8 nodesForm TriggerHTTP Request
AI & RAG Trigger: Event Nodes: 8 Complexity: ★★★★☆ Added:

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

This workflow follows the Form Trigger → HTTP Request 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": "fXtw0Iqzc5X1fyPf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate Summaries From Uploaded Files",
  "tags": [],
  "nodes": [
    {
      "id": "e8d5aaf3-8ef3-4b66-8d61-1a8eedde36ca",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        140,
        100
      ],
      "parameters": {
        "path": "2c3f820b-8b84-41d8-bc1a-1e33f9bb7bfd",
        "options": {},
        "formTitle": "Upload Form",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "File",
              "multipleFiles": false,
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d7817690-47d2-491d-8819-373bb5402daf",
      "name": "Create Thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        540,
        100
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/threads",
        "options": {},
        "requestMethod": "POST",
        "authentication": "headerAuth",
        "jsonParameters": true,
        "bodyParametersJson": "={\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Summarize the attached file.\",\n      \"attachments\": [\n        {\n          \"file_id\": \"{{$node['Upload File'].json['id']}}\",\n          \"tools\": [ { \"type\": \"file_search\" } ]\n        }\n      ]\n    }\n  ]\n}",
        "headerParametersJson": "{\n  \"OpenAI-Beta\": \"assistants=v2\"\n}"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5b93297d-c354-410a-a19e-5f7e3993ba32",
      "name": "Poll Run Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        140,
        320
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/runs/{{$node[\"Run Assistant\"].json[\"id\"]}}",
        "options": {},
        "authentication": "headerAuth",
        "headerParametersUi": {
          "parameter": [
            {
              "name": "OpenAI-Beta",
              "value": "assistants=v2"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d6b28a0e-1468-4dbc-b193-7a7f5b6c7e99",
      "name": "Is Not Complete?",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        320
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $node[\"Poll Run Status\"].json[\"status\"] }}",
              "value2": "completed",
              "operation": "notEqual"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "88db0070-35f4-4fd7-9e51-8a30bd18bc23",
      "name": "Wait 2s",
      "type": "n8n-nodes-base.wait",
      "position": [
        540,
        300
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 2
      },
      "typeVersion": 1
    },
    {
      "id": "9ea51b21-08e3-4a28-b8f5-fd85758e46f9",
      "name": "Fetch Summary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        340
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/messages",
        "options": {},
        "authentication": "headerAuth",
        "jsonParameters": true,
        "headerParametersJson": "{\n  \"OpenAI-Beta\": \"assistants=v2\"\n}"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "14fdac82-a66a-493e-a8ed-74bdda5ea316",
      "name": "Run Assistant",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        100
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/runs",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"assistant_id\": \"REPLACE_WITH_YOUR_ASSISTANT_ID\",\n  \"instructions\": \"You are an AI knowledge-base assistant.\\n\\nFor every file provided (PDF, DOCX, slides, or an audio/video transcript) return a single, valid JSON object with exactly these keys:\\n{\\n  \\\"title\\\": string,\\n  \\\"summary\\\": string,\\n  \\\"bullets\\\": string[],\\n  \\\"tags\\\": string[]\\n}\\n\u2022 Read or transcribe the entire file first.\\n\u2022 Do not add any extra keys, comments, or explanatory text.\\n\u2022 If the file is audio or video, transcribe it before summarizing.\\n\u2022 If the file type is unsupported (e.g., pure image), reply with:\\n  { \\\"error\\\": \\\"unsupported_file_type\\\" }\\n\u2022 Return **only** the JSON object\u2014nothing else.\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "OpenAI-Beta",
              "value": "assistants=v2"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fabdc95f-4bfd-41c3-8f1b-3b74ee6513fd",
      "name": "Upload File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        340,
        100
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "File"
            },
            {
              "name": "purpose",
              "value": "assistants"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "OpenAI-Beta",
              "value": "assistants=v2"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a9a89fc0-37bf-43ba-bae3-97b159f84a27",
  "connections": {
    "Wait 2s": {
      "main": [
        [
          {
            "node": "Poll Run Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File": {
      "main": [
        [
          {
            "node": "Create Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Thread": {
      "main": [
        [
          {
            "node": "Run Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Assistant": {
      "main": [
        [
          {
            "node": "Poll Run Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll Run Status": {
      "main": [
        [
          {
            "node": "Is Not Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Not Complete?": {
      "main": [
        [
          {
            "node": "Wait 2s",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fetch Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Upload File",
            "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

Upload a document (PDF, DOCX, PPTX, TXT, CSV, JSON, or Markdown) and receive an AI-generated summary containing:

Source: https://n8n.io/workflows/4911/ — 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

This workflow is ideal for content creators, video marketers, and research professionals who need to extract actionable insights, detailed transcripts, or metadata from YouTube videos efficiently. It

HTTP Request, Google Drive, Gmail +2
AI & RAG

Legal, Procurement, and Compliance teams at mid-size companies. ESN and agencies selling AI-powered contract review as a service.

Form Trigger, HTTP Request, Form +4
AI & RAG

This workflow takes a Loom link, extracts the video ID, uses the Loom API to download the video, then sends it to Gemini along with your question. Finally, it sends the output to Slack.

HTTP Request, Form Trigger, Slack
AI & RAG

This template is designed for filmmakers, content creators, social media managers, and AI developers who want to harness OpenAI's Sora 2 for creating physically accurate, cinematic videos with synchro

HTTP Request, Form Trigger, Form +1
AI & RAG

Transform text prompts into stunning images or edit existing visuals using OpenAI's latest GPT-4 Vision model through an intuitive web form interface.

Google Drive, HTTP Request, Form Trigger +1