PDF Document Transformation to Markdown via LlamaIndex - n8n Workflow

This n8n workflow template automates the conversion of uploaded PDF documents into structured Markdown format using the LlamaIndex Cloud API. This robust n8n node setup ensures reliable processing and status checks.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Knowledge Engineers: Users needing automated document ingestion for building Retrieval-Augmented Generation (RAG) systems.
Content Managers: Individuals requiring structured, clean text extracted from complex PDF reports.
n8n Automation Specialists: Those looking for robust n8n templates demonstrating asynchronous API polling patterns.
Developers: Anyone integrating LlamaIndex PDF parsing features without writing custom backend code.

Overview

The difficulty in programmatically extracting structured, clean text from complex PDFs is a common challenge in data automation. This specific n8n workflow solves this by leveraging the powerful LlamaIndex Cloud API for document parsing and transformation. This n8n templates solution provides a simple web form using an n8n trigger for initiating the upload. The subsequent steps demonstrate a highly robust asynchronous polling mechanism, which is essential when dealing with long-running server-side jobs like PDF conversion. Using the HTTP Request n8n node combined with Wait and If nodes, this n8n automation reliably monitors the job status until completion, ensuring high-quality Markdown output is retrieved without manual intervention.

How it Works

This comprehensive n8n workflow executes a reliable job submission and polling cycle to ensure PDF processing completes successfully:


  1. Trigger & Upload: The process begins with the "On form submission" n8n trigger. A user uploads a PDF file using the publicly accessible n8n form.

  2. Job Submission: The "Upload_doc" n8n node sends the binary PDF data to the LlamaIndex Cloud API (/parsing/upload) using Bearer Authentication and the multipart-form-data content type, initiating an asynchronous conversion job.

  3. Initial Wait: The first "Wait" n8n node pauses the n8n workflow for 30 seconds, allowing the LlamaIndex service sufficient time to register and begin processing the file.

  4. Status Check Loop (Polling): The "Status Verification" n8n node, an HTTP Request, repeatedly polls the LlamaIndex API using the job ID returned in the initial upload response, checking the conversion status.

  5. Conditional Flow: The "If" n8n node evaluates the status. It checks if the API response indicates status equals SUCCESS.

  6. Success Path: If successful, the n8n workflow proceeds to the "Content extraction" n8n node, which retrieves the fully processed document content in Markdown format.

  7. Polling Path: If the status is not successful, the n8n workflow branches to "Wait2," which pauses for 60 seconds before looping back to the "Status Verification" n8n node to re-check the job status, ensuring the n8n automation continues polling until the conversion is complete.

Installation Guide

To deploy this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. LlamaIndex Credentials: This n8n workflow requires credentials for the LlamaIndex Cloud API (HTTP Bearer Auth). You must set up a credential named "Bearer Auth account" (or update the credential reference on the HTTP Request n8n node) and input your LlamaIndex API Key.

  3. Form Trigger Setup: The "On form submission" n8n trigger automatically generates a public URL. Ensure your n8n instance is accessible externally if you intend to use this form publicly.

  4. Activate: Save and activate the n8n workflow. You can then access the form URL provided by the n8n trigger node to begin uploading PDFs.

Node Details

This n8n workflow template utilizes several key n8n nodes:

On form submission (n8n trigger): Serves as the starting point, accepting input from users. It is specifically configured to only accept PDF file types, providing the binary data necessary for the next n8n node.
Uploaddoc (HTTP Request n8n node): Sends the uploaded PDF file as multipart/form-data to the LlamaIndex Cloud API. Its key configuration involves mapping the input binary file data (file) from the n8n trigger.
Wait (n8n node): Essential for asynchronous tasks. Configured to pause execution for 30 seconds initially, mitigating immediate polling failures while the job initializes.
Status Verification (HTTP Request n8n node): Configured to dynamically call the LlamaIndex API status endpoint using the expression: =https://api.cloud.llamaindex.ai/api/parsing/job/{{ $('Upload
doc').item.json.id }}. This demonstrates dynamic data referencing within an n8n node.
If (n8n node): Directs the flow based on the API response, checking if {{ $json.status }} equals SUCCESS. This is a critical flow control n8n node.
Wait2 (n8n node): Part of the polling loop, configured to wait for 60 seconds before re-checking the job status if the previous check was not successful.


  • Content extraction (HTTP Request n8n node): Only executes upon success. Fetches the final output, specifically requesting the result in markdown format.

Related n8n Workflows

Free

Nodes: 4 Nodes
Updated: December 26 2025
View all
Created by

Featured*