DEV Community

Alex Spinov
Alex Spinov

Posted on

n8n Has a Free API — Heres How to Automate Workflows Without Zapier

n8n is an open-source workflow automation platform — like Zapier but self-hosted, with 400+ integrations and a code-when-you-need-it approach.

Why n8n?

  • Self-hosted: Your data never leaves your server
  • 400+ integrations: Slack, GitHub, Postgres, Stripe, and more
  • Code when needed: JavaScript/Python in any workflow step
  • Visual editor: Drag-and-drop workflow builder
  • Free forever: Self-hosted with no limits
  • AI nodes: Built-in LLM integration
  • Webhook triggers: React to external events

Self-Host

docker run -p 5678:5678 -v n8n_data:/home/node/.n8n n8nio/n8n
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:5678

API: List Workflows

curl http://localhost:5678/api/v1/workflows \
  -H 'X-N8N-API-KEY: YOUR_API_KEY'
Enter fullscreen mode Exit fullscreen mode

API: Execute Workflow

curl -X POST http://localhost:5678/api/v1/workflows/WORKFLOW_ID/activate \
  -H 'X-N8N-API-KEY: YOUR_API_KEY'
Enter fullscreen mode Exit fullscreen mode

API: Trigger via Webhook

curl -X POST http://localhost:5678/webhook/my-endpoint \
  -H 'Content-Type: application/json' \
  -d '{"event": "new_order", "data": {"id": 123, "amount": 49.99}}'
Enter fullscreen mode Exit fullscreen mode

Example: GitHub → Slack Notification

Workflow JSON (import into n8n):

{
  "nodes": [
    {
      "name": "GitHub Trigger",
      "type": "n8n-nodes-base.githubTrigger",
      "parameters": {
        "events": ["push"],
        "owner": "myorg",
        "repository": "myrepo"
      }
    },
    {
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#deploys",
        "text": "New push to {{$json.ref}} by {{$json.pusher.name}}"
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Example: Scheduled Report

  1. Cron Trigger: Every Monday at 9 AM
  2. Postgres Node: Query weekly metrics
  3. Code Node: Format data into report
  4. Email Node: Send to team

Code Node (Custom Logic)

// Process incoming data with custom JavaScript
const items = $input.all();
const processed = items.map(item => ({
  ...item.json,
  total: item.json.price * item.json.quantity,
  processed_at: new Date().toISOString(),
}));
return processed.map(json => ({ json }));
Enter fullscreen mode Exit fullscreen mode

AI Agent Workflow

n8n has built-in AI nodes:

  1. Chat Trigger: Receive user message
  2. AI Agent: Process with OpenAI/Claude
  3. Tool nodes: Search database, call APIs
  4. Response: Send back to user

API: Create Workflow Programmatically

curl -X POST http://localhost:5678/api/v1/workflows \
  -H 'X-N8N-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "My Automated Workflow",
    "nodes": [...],
    "connections": {...},
    "active": true
  }'
Enter fullscreen mode Exit fullscreen mode

Real-World Use Case

A small business automated their entire order pipeline: Shopify order → Slack notification → Google Sheet → QuickBooks invoice → customer email. Previously took 15 minutes per order manually. Now it takes 0 minutes and never makes mistakes. They saved 20 hours/week.


Need to automate data collection? Check out my Apify actors for ready-made scrapers, or email spinov001@gmail.com for custom solutions.

Top comments (0)