Document and Image Data Extraction using Mistral OCR - n8n Workflow

Automate document parsing with this advanced n8n workflow. Use this robust n8n template to leverage the powerful Mistral OCR API for extracting structured data from PDFs and images, handling both public URLs and secure, privately hosted files.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Data scientists and developers needing automated Optical Character Recognition (OCR).
Businesses processing invoices, bank statements, or receipts.
Users looking for advanced examples of using the n8n HTTP Request node with complex API authentication.
Anyone interested in integrating the latest LLM and OCR capabilities into their n8n templates.

Overview

Extracting structured data from PDFs and images is a crucial automation challenge. This comprehensive n8n workflow provides three distinct methodologies for integrating Mistral OCR capabilities into your processes.

This robust n8n template solves the problem of file accessibility by demonstrating how to process both publicly available document links and how to securely handle privately stored files (e.g., in Google Drive) by uploading them to the Mistral Cloud and generating a signed URL before processing. Furthermore, this n8n workflow showcases advanced direct querying capabilities, where you can ask specific questions about the document content using Mistral's multimodal models, bypassing traditional extraction steps. By utilizing the dedicated n8n node approach via HTTP Requests, you ensure maximum flexibility and speed when deploying this document parsing solution.

How it Works

This n8n workflow starts with a manual n8n trigger, splitting into several parallel processing branches, each demonstrating a different file handling scenario.


  1. Publicly Hosted Files (Direct OCR):

The Document URL or Image URL n8n node defines a publicly accessible file link.
The workflow sends a direct HTTP POST request to the Mistral /v1/ocr endpoint, including the file URL in the JSON body, resulting in immediate OCR extraction.


  1. Privately Hosted Files (Secure Upload & Signed URL):

The Import PDF or Import Image n8n node retrieves binary data from a private Google Drive location.
The binary data is sent to the Mistral Upload n8n node (HTTP Request) to securely store the file in the Mistral Cloud.
The workflow then uses the returned file ID to call the Mistral Signed URL n8n node, obtaining a short-lived access URL.
Finally, the Mistral DOC OCR or Mistral IMAGE OCR n8n node uses this secure signed URL to perform the final OCR processing, ensuring data privacy.


  1. Document Understanding (Direct Q&A):

The Document URL1 n8n node sets both the file URL and a specific query (e.g., 'what is the total number of deposits?').
The Document Understanding n8n node sends this data to the Mistral Chat Completions API (mistral-small-latest), allowing the model to answer questions directly based on the document's content without a separate OCR extraction step. This demonstrates a highly efficient use case for document intelligence within an n8n automation.

Installation Guide

To install and configure this specialized n8n template, follow these steps:


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

  2. Mistral API Credentials: This n8n workflow heavily relies on the Mistral Cloud API. You must set up a credential named Mistral Cloud account containing your Mistral API key.

  3. Google Drive Credentials (Optional): If you wish to test the 'Privately Hosted Files' branch, you must configure a Google Drive OAuth2 API credential named Google Drive account and replace the placeholder File IDs in the Import PDF and Import Image n8n node with IDs to files you own.

  4. Testing: Execute the When clicking ‘Test workflow’ n8n trigger. Review the output from the final OCR and understanding n8n node steps to confirm successful data extraction.

Node Details

When clicking ‘Test workflow’ (n8n trigger): The starting point for executing this n8n workflow manually during development or testing.
Set (Document/Image URL n8n node): Used to define the public URL of the PDF or image files to be processed by Mistral OCR in the first example branch.
Google Drive (Import PDF/Image n8n node): Downloads binary file data from a private Google Drive location. Essential for the private file handling branch of this n8n template.
HTTP Request (Mistral Upload n8n node): Uploads the file binary data (from Google Drive) to the Mistral /v1/files endpoint with the purpose: ocr. Uses multipart-form-data content type.
HTTP Request (Mistral Signed URL n8n node): Retrieves a time-limited, secure URL for the previously uploaded file using the returned File ID.
HTTP Request (Mistral DOC OCR/IMAGE OCR n8n node): The core OCR n8n node. It sends a POST request to /v1/ocr using the mistral-ocr-latest model. In the secure file branch, it uses the signed URL; in the public branch, it uses the direct URL.


  • HTTP Request (Document Understanding n8n node): Demonstrates direct querying using mistral-small-latest. This n8n node passes a text prompt and a document URL within the message content array, enabling the LLM to answer questions about the document immediately.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Jimleuk
Jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

Featured*