n8n is the open-source workflow automation tool that connects 400+ apps. But its real power is the API — automate your automations programmatically.
What Is n8n?
n8n (pronounced n-eight-n) is a fair-code workflow automation platform. Think Zapier, but self-hosted, open-source, and with a code option for complex logic.
The n8n API
n8n exposes a REST API for managing workflows, executions, and credentials.
Authentication
# n8n uses API keys or Basic Auth
export N8N_URL="https://your-n8n.com"
export N8N_API_KEY="your-api-key"
# List all workflows
curl -s "$N8N_URL/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY" | jq '.data | length'
Create a Workflow
curl -s -X POST "$N8N_URL/api/v1/workflows" \
-H "X-N8N-API-KEY: $N8N_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Daily Report",
"nodes": [
{"parameters": {"rule": {"interval": [{"field": "hours", "hoursInterval": 24}]}}, "name": "Schedule", "type": "n8n-nodes-base.scheduleTrigger", "position": [250, 300]},
{"parameters": {"url": "https://api.example.com/metrics"}, "name": "Fetch Data", "type": "n8n-nodes-base.httpRequest", "position": [450, 300]}
],
"connections": {"Schedule": {"main": [[{"node": "Fetch Data", "type": "main", "index": 0}]]}}
}'
Execute a Workflow
# Trigger workflow by ID
curl -s -X POST "$N8N_URL/api/v1/workflows/WORKFLOW_ID/activate" \
-H "X-N8N-API-KEY: $N8N_API_KEY"
# Get execution history
curl -s "$N8N_URL/api/v1/executions?workflowId=WORKFLOW_ID&limit=5" \
-H "X-N8N-API-KEY: $N8N_API_KEY" | jq '.data[].status'
Webhook Trigger
import requests
# Trigger n8n workflow via webhook
response = requests.post(
"https://your-n8n.com/webhook/abc-123",
json={
"event": "new_order",
"customer": "john@example.com",
"amount": 99.99
}
)
print(response.json())
n8n vs Zapier vs Make
| Feature | n8n | Zapier | Make |
|---|---|---|---|
| Self-hosted | Yes | No | No |
| Open source | Yes | No | No |
| Code nodes | JS/Python | No | Limited |
| API access | Full REST | Limited | Limited |
| Pricing | Free (self-hosted) | $20/mo+ | $9/mo+ |
| Integrations | 400+ | 5000+ | 1000+ |
Real Use Case: Scraping Pipeline
// n8n Code node: process scraped data
const items = $input.all();
const processed = items.map(item => ({
json: {
title: item.json.title.trim(),
price: parseFloat(item.json.price.replace('$', '')),
scraped_at: new Date().toISOString(),
source: item.json.url
}
}));
return processed;
Getting Started
# Docker (fastest)
docker run -it --rm -p 5678:5678 n8nio/n8n
# npm
npx n8n
Open http://localhost:5678 and start building workflows.
Need web data for your n8n workflows? Scrapfly handles scraping at scale — proxies, browsers, anti-bot. Email spinov001@gmail.com for custom integrations.
Top comments (0)