N8N

Convert PDF, DOCX, and images to Markdown in N8N workflows. Step-by-step guide using the HTTP Request node.

N8N is a self-hosted workflow automation tool. This guide shows how to convert files to Markdown using the HTTP Request node.

Prerequisites

  • An N8N instance (cloud or self-hosted)
  • A Markdown Anything API token (generate one)

Sync Conversion

Use this approach for small files where you want the result immediately.

Add an HTTP Request Node

Add an HTTP Request node to your workflow and configure:

  • Method: POST
  • URL: https://markdownanything.com/api/v1/convert
  • Authentication: Header Auth
  • Header Name: Authorization
  • Header Value: Bearer mda_your_token_here

Configure the Body

Set the body to Form-Data / Multipart:

  • Parameter Name: file
  • Parameter Type: File
  • Input Data Field Name: The field from your previous node that contains the binary file

Optionally add text parameters:

  • use_enhanced_ai = true (for scanned documents)
  • include_metadata = true (for document metadata)
  • optimize_tokens = true (for LLM pipelines)

Use the Result

The response JSON contains:

{
    "success": true,
    "markdown": "# Your converted content...",
    "credits_used": 1,
    "credits_remaining": 499
}

Access the Markdown with {{ $json.markdown }} in subsequent nodes.

Async Conversion with Webhook

For large files or batch processing, use async mode to avoid timeout issues.

Set Up a Webhook Trigger

Add a Webhook node at the start of a separate workflow. Copy its URL — this is where Markdown Anything will send results.

Send the Conversion Request

In your main workflow, configure the HTTP Request node as above, but add these extra form parameters:

  • webhook_url = your N8N webhook URL
  • webhook_secret = a random string (32+ characters) for signature verification

The API returns 202 Accepted immediately with a status URL.

Handle the Webhook

Your webhook workflow receives the completed conversion:

{
    "id": "uuid",
    "status": "completed",
    "markdown": "# Converted content...",
    "completed_at": "2025-01-15T10:30:05+00:00"
}

Verify the X-Webhook-Signature header if you provided a secret.

N8N webhook URLs must be publicly accessible for async mode. If self-hosting behind a firewall, use sync mode or set up a tunnel.