PDF to Structured Markdown Conversion with LlamaCloud - n8n Workflow

Use this robust n8n workflow to automate complex PDF parsing and convert documents into clean markdown using the LlamaCloud API, featuring automatic job polling and retry logic.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI/ML Engineers who need structured data from unstructured PDFs for RAG or specialized AI applications.
Technical content managers requiring accurate extraction of text, tables, and complex layouts from documents.
Developers looking for reliable, production-ready n8n templates for integrating document processing services.
Users seeking to build advanced data ingestion pipelines within their existing n8n workflow environment.

Overview

This powerful n8n workflow provides a robust solution for dealing with difficult PDF documents. Traditional PDF extractors often fail on complex layouts or multi-column documents, but by integrating with LlamaCloud, this n8n template guarantees high-quality parsing and converts the content into clean, structured markdown. The key feature of this n8n workflow is its built-in reliability logic: instead of failing on long-running jobs, it employs a core logic flow control using an If n8n node and Wait n8n node loop, automatically polling the LlamaCloud API every 30 seconds until the parsing job is complete. This makes the entire n8n workflow highly resilient and perfect for heavy-duty document automation tasks, ensuring the final clean markdown output is ready for immediate consumption by AI systems.

How it Works

The entire automated n8n workflow is executed through a sequence of steps designed for robust asynchronous processing:


  1. PDF Retrieval: The workflow starts by using the Google Drive n8n node, 'Download File From Drive1', to retrieve the target PDF file as binary data. (This step can be easily replaced by a webhook n8n trigger or another file source).

  2. Job Initiation: The binary file data is passed to the 'Send Data To Llama Cloud1' HTTP Request n8n node, which uploads the document to the LlamaCloud parsing API. This action returns a unique Job ID.

  3. Initial Wait: A short Wait n8n node pauses execution for 1 second to give the API time to initialize the job.

  4. Status Check Loop: The 'Check Status1' HTTP Request n8n node periodically queries the LlamaCloud API using the Job ID to check the job’s progress.

  5. Conditional Branching: The 'Check Job Status1' If n8n node evaluates the status. If the status is 'SUCCESS', the workflow proceeds to data retrieval.

  6. Polling Delay: If the status is anything other than 'SUCCESS' (e.g., PENDING), the workflow enters the retry branch. The 'Wait3' n8n node pauses the execution for 30 seconds before looping back to 'Check Status1', ensuring continuous polling until completion.

  7. Data Retrieval: Once the parsing is marked as successful, the 'Get Data1' HTTP Request n8n node fetches the final processed result, which is specifically requested in clean markdown format, completing the automated n8n workflow.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON and import it directly into your n8n instance.

  2. LlamaCloud API Credentials: You must obtain a LlamaCloud API key. In n8n, create a new Generic Credential of type HTTP Header Auth.

Set the Header Name to Authorization.
Set the Header Value to Bearer YOURAPIKEYHERE (replacing YOURAPIKEYHERE with your actual key).
* Ensure this credential is applied to all three HTTP Request n8n node instances ('Send Data To Llama Cloud1', 'Check Status1', and 'Get Data1').

  1. Google Drive Setup (Optional): If you retain the 'Download File From Drive1' n8n node, configure your Google Drive OAuth2 credentials and update the File ID parameter to point to the specific PDF you wish to process.

  2. Execution: Run the n8n workflow manually or set up an appropriate n8n trigger (like a Schedule or Webhook) to test the parsing logic.

Node Details

Download File From Drive1 (Google Drive n8n node): Retrieves the source PDF file. Configured for the download operation, outputting the file as binary data.
Send Data To Llama Cloud1 (HTTP Request n8n node): Uploads the binary PDF to the LlamaCloud /v1/parsing/upload endpoint using the POST method and multipart-form-data content type. This initiates the parsing job.
Wait1 (Wait n8n node): A utility n8n node that introduces a 1-second delay before the initial status check.
Check Status1 (HTTP Request n8n node): Polls the LlamaCloud job status endpoint (/v1/parsing/job/{{ $json.id }}). Uses JSON expression to dynamically pull the Job ID received from the previous upload step.
Check Job Status1 (If n8n node): The core decision-making n8n node. It checks if the status response from LlamaCloud is strictly equal to 'SUCCESS'.
Wait3 (Wait n8n node): Used in the false branch of the If node. Introduces a 30-second delay to manage API polling frequency and prevent timeouts during long parsing jobs.


  • Get Data1 (HTTP Request n8n node): Executes when the job is successful. This n8n node requests the final output from LlamaCloud, specifically targeting the /result/markdown endpoint using the dynamically inserted Job ID.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Patrick Campbell
Patrick Campbell

Featured*