← 返回
开发者工具 Key 中文

n8n API

Operate n8n via its public REST API from OpenClaw. Use for workflow management, executions, and automation tasks such as listing, creating, publishing, triggering, or troubleshooting. Works with both self-hosted n8n and n8n Cloud.
通过 OpenClaw 使用 n8n 公开 REST API 进行操作。用于工作流管理、执行及自动化任务,包括列出、创建、发布、触发或排查故障。兼容自托管 n8n 和 n8n Cloud。
codedao12
开发者工具 clawhub v1.0.1 1 版本 99645.1 Key: 需要
★ 3
Stars
📥 4,152
下载
💾 287
安装
1
版本
#latest

概述

n8n Public REST API

Use this skill when you need to drive n8n programmatically. It covers the same core actions you use in the UI: workflows, executions, tags, credentials, projects, and more.

Availability

  • The public API is unavailable during the free trial.
  • Upgrade your plan to enable API access.

Configuration

Recommended environment variables (or store in .n8n-api-config):

export N8N_API_BASE_URL="https://your-instance.app.n8n.cloud/api/v1"  # or http://localhost:5678/api/v1
export N8N_API_KEY="your-api-key-here"

Create the API key in: n8n Settings → n8n API → Create an API key.

Auth header

All requests require this header:

X-N8N-API-KEY: $N8N_API_KEY

Playground

The API playground is only available on self-hosted n8n and operates on real data. For safe experiments, use a test workflow or a separate test instance.

Quick actions

Workflows: list

curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_BASE_URL/workflows" \
  | jq '.data[] | {id, name, active}'

Workflows: details

curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_API_BASE_URL/workflows/{id}"

Workflows: activate or deactivate

# Activate (publish)
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"versionId":"","name":"","description":""}' \
  "$N8N_API_BASE_URL/workflows/{id}/activate"

# Deactivate
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
  "$N8N_API_BASE_URL/workflows/{id}/deactivate"

Webhook trigger

# Production webhook
curl -s -X POST "$N8N_API_BASE_URL/../webhook/{webhook-path}" \
  -H "Content-Type: application/json" \
  -d '{"key":"value"}'

# Test webhook
curl -s -X POST "$N8N_API_BASE_URL/../webhook-test/{webhook-path}" \
  -H "Content-Type: application/json" \
  -d '{"key":"value"}'

Executions: list

# Recent executions
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
  "$N8N_API_BASE_URL/executions?limit=10" \
  | jq '.data[] | {id, workflowId, status, startedAt}'

# Failed only
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
  "$N8N_API_BASE_URL/executions?status=error&limit=5"

Executions: retry

curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"loadWorkflow":true}' \
  "$N8N_API_BASE_URL/executions/{id}/retry"

Common flows

Health check summary

Count active workflows and recent failures:

ACTIVE=$(curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
  "$N8N_API_BASE_URL/workflows?active=true" | jq '.data | length')

FAILED=$(curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
  "$N8N_API_BASE_URL/executions?status=error&limit=100" \
  | jq '[.data[] | select(.startedAt > (now - 86400 | todate))] | length')

echo "Active workflows: $ACTIVE | Failed (24h): $FAILED"

Debug a failed run

  1. List failed executions to get the execution ID.
  2. Fetch execution details and identify the failing node.
  3. Review node parameters and input data.
  4. Suggest a fix based on the error message.

Endpoint index

See assets/n8n-api.endpoints.md for the full list of endpoints.

REST basics (optional)

If you want a refresher, these are commonly recommended:

  • KnowledgeOwl: working with APIs (intro)
  • IBM Cloud Learn Hub: what is an API / REST API
  • MDN: overview of HTTP

Notes and tips

  • The n8n API node can call the public API from inside workflows.
  • Webhook URLs are not the same as API URLs and do not use the API key header.
  • Execution records may be pruned based on instance retention settings.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-28 10:46 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,906
communication-collaboration

Discord

codedao12
用于 Discord Bot API 工作流的 OpenClaw 技能,通过直接 HTTPS 请求实现交互、命令、消息及各项操作。
★ 2 📥 3,873
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,944