Most businesses don't need a custom-built AI platform. They need their existing tools to talk to each other — with an LLM sitting in the middle to handle the messy, unstructured parts. That's exactly what n8n + Claude API gives you: a visual workflow engine that can orchestrate API calls, database queries, file processing, and AI reasoning in a single drag-and-drop canvas.

We've deployed this combination for clients handling everything from invoice processing to lead qualification to contract review. The pattern is remarkably consistent: a trigger fires, data flows through a few transformation nodes, Claude processes the unstructured content, and the structured output lands in whatever system needs it. No ML engineers required. No GPU infrastructure. Just workflows that run.

Why n8n Instead of Zapier or Make?

We're not anti-Zapier — it's great for simple integrations. But for AI workflows specifically, n8n has three decisive advantages:

Architecture: The Standard AI Workflow Pattern

Nearly every AI workflow we build follows the same five-stage pattern:

  1. Trigger — A webhook, scheduled cron, email arrival, or file upload in S3/Google Drive.
  2. Extract — Pull the raw content. For PDFs, this means OCR or text extraction. For emails, it's parsing the body and attachments. For CRM records, it's an API call to Salesforce or HubSpot.
  3. Transform — Clean and structure the data into a prompt. This is where most workflows fail — garbage in, garbage out. We use Code nodes to strip formatting, truncate to token limits, and build system prompts with explicit output schemas.
  4. Reason — Send the structured prompt to Claude via the HTTP Request node. Parse the JSON response.
  5. Act — Route the output: create a CRM record, send a Slack notification, update a database row, generate a reply email, or flag for human review.

Example 1: Automated Invoice Processing

Here's a concrete workflow we built for a distribution company processing 200+ vendor invoices per week. Previously, a bookkeeper spent 15 hours/week manually entering invoice data into their accounting system.

The Workflow

Trigger: Email arrives at invoices@company.com (n8n IMAP trigger, polling every 5 minutes).

Extract: A Code node pulls PDF attachments and converts them to text using the pdf-parse npm library.

Transform + Reason: The extracted text goes to Claude with this prompt structure:

// n8n Code Node: Build the Claude API request
const invoiceText = $input.first().json.extractedText;

const response = await this.helpers.httpRequest({
  method: 'POST',
  url: 'https://api.anthropic.com/v1/messages',
  headers: {
    'x-api-key': $credentials.anthropicApi.apiKey,
    'anthropic-version': '2023-06-01',
    'content-type': 'application/json',
  },
  body: {
    model: 'claude-sonnet-4-20250514',
    max_tokens: 1024,
    system: `You are an invoice data extraction system. Extract structured
data from the invoice text. Return ONLY valid JSON with no markdown.`,
    messages: [{
      role: 'user',
      content: `Extract the following fields from this invoice:
- vendor_name (string)
- invoice_number (string)
- invoice_date (YYYY-MM-DD)
- due_date (YYYY-MM-DD)
- line_items (array of {description, quantity, unit_price, total})
- subtotal (number)
- tax (number)
- total (number)
- currency (3-letter code)

Invoice text:
${invoiceText}`
    }]
  }
});

const parsed = JSON.parse(response.content[0].text);
return [{ json: parsed }];

Act: The parsed JSON feeds into an Odoo API node that creates a draft vendor bill with all line items pre-populated. A Slack notification goes to the bookkeeper with a summary and a link to review.

Key insight: We don't try to make this 100% autonomous. The bookkeeper still reviews and posts each bill — but instead of 15 hours/week of data entry, they spend 3 hours/week on review and approval. That's an 80% time reduction at approximately $0.02 per invoice in Claude API costs.

Example 2: Lead Enrichment and Qualification

A B2B SaaS client wanted to qualify inbound leads before routing them to sales reps. Their form collected name, email, company, and a free-text "tell us about your needs" field. The sales team was wasting hours chasing unqualified leads.

The Workflow

Trigger: Webhook from their website form (HubSpot form submission).

Extract: An HTTP Request node pulls the company's LinkedIn data and website content. A second node checks Clearbit for firmographic data (employee count, industry, revenue estimate).

Reason: All the enriched data goes to Claude:

// System prompt for lead qualification
const systemPrompt = `You are a B2B lead qualification system for a SaaS
company selling project management software. Score each lead 1-100 and
classify as HOT, WARM, or COLD.

Scoring criteria:
- Company size 50-500 employees: +30 points
- Industry in [tech, consulting, agency, manufacturing]: +20 points
- Message mentions pain points [deadlines, visibility, collaboration]: +25 points
- Decision maker title [VP, Director, Head of, C-level]: +25 points

Return JSON: {score, classification, reasoning, suggested_talk_track}`;

// User message assembled from enriched data
const userMsg = `Lead submission:
Name: ${lead.name}
Title: ${lead.title}
Company: ${lead.company} (${firmographic.employees} employees,
  ${firmographic.industry}, est. revenue ${firmographic.revenue})
Message: "${lead.message}"
Website summary: ${websiteSummary}`;

Act: Based on Claude's classification:

Result: the sales team's meeting-to-close rate improved by 35% in the first month because they were spending time on qualified leads instead of tire-kickers.

Setting Up n8n with Claude: The Practical Details

Here's how to get a production-ready n8n instance running with Claude API access.

Deployment

# docker-compose.yml for production n8n
version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=${POSTGRES_PASSWORD}
      - N8N_ENCRYPTION_KEY=${ENCRYPTION_KEY}
      - WEBHOOK_URL=https://n8n.yourdomain.com/
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres

  postgres:
    image: postgres:16-alpine
    restart: always
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  n8n_data:
  postgres_data:

Put this behind an Nginx reverse proxy with TLS (Let's Encrypt) and you're production-ready. Total infrastructure cost on a t3.small EC2 instance: about $20/month.

Claude API Credentials in n8n

n8n doesn't have a native Anthropic node yet, but the HTTP Request node works perfectly. Store your API key as a credential of type "Header Auth":

Then in every HTTP Request node that calls Claude, select this credential and add the anthropic-version: 2023-06-01 header manually.

Error Handling and Reliability

Production AI workflows need to handle failures gracefully. Here's what we always configure:

Cost tip: Use claude-haiku-4-5-20251001 for simple extraction and classification tasks. Reserve claude-sonnet-4-20250514 for complex reasoning. A typical invoice extraction costs $0.001–0.003 with Haiku vs $0.008–0.015 with Sonnet. At 200 invoices/day, that's the difference between $6/month and $45/month.

Common Workflow Ideas to Get Started

Beyond the two examples above, here are workflows we've built for clients that take less than a day to implement:

When Not to Use This Pattern

This approach isn't right for everything. Skip n8n + Claude when:

Getting Started

The fastest path to production: pick your highest-volume manual task that involves reading unstructured content and producing structured output. Build the workflow in n8n with Claude. Run it in parallel with your manual process for two weeks. Measure the accuracy. If it's above 95%, flip the switch and let the human do review-only.

Most teams go from "we should try AI" to "this is saving us 20 hours a week" in under a month. The combination of n8n's integration library and Claude's reasoning capability makes it possible to automate workflows that would have required a full engineering team just two years ago.