Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/n8n/Api-reference
Reference · n8n

Api-reference

Part of n8n. Install the skill and your agent reads this page when it needs the depth.

API Reference

Complete list of n8n REST API commands.

Contents


Workflows

List All Workflows

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/workflows" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Get Workflow by ID

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/workflows/{WORKFLOW_ID}" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Create Workflow

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/workflows" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{
  "name": "My Workflow",
  "nodes": [],
  "connections": {},
  "settings": {"executionOrder": "v1"}
}' | jq .

Update Workflow (PUT, not PATCH!)

export $(cat .env | grep -v '^#' | xargs) && curl -s -X PUT "${N8N_API_URL}/api/v1/workflows/{WORKFLOW_ID}" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{
  "name": "Updated Name",
  "nodes": [],
  "connections": {},
  "settings": {"executionOrder": "v1"}
}' | jq .

Delete Workflow

export $(cat .env | grep -v '^#' | xargs) && curl -s -X DELETE "${N8N_API_URL}/api/v1/workflows/{WORKFLOW_ID}" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Activate Workflow

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/workflows/{WORKFLOW_ID}/activate" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Deactivate Workflow

⚠️ WARNING: NEVER deactivate workflows during the build process. Just use PUT to update directly. Deactivation is only for when you intentionally want to stop a workflow from running.

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/workflows/{WORKFLOW_ID}/deactivate" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Executions

List Executions (always use limit!)

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions?limit=2" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Filter by Workflow

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions?workflowId={WORKFLOW_ID}&limit=2" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Get Execution with Data

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions/{EXECUTION_ID}?includeData=true" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Get Execution Status Only

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions?limit=1" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq '.data[0] | {id, status}'

Get Which Nodes Ran

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions/{EXECUTION_ID}?includeData=true" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq '.data.resultData.runData | keys'

Get Error Details

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/executions/{EXECUTION_ID}?includeData=true" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq '.data.resultData.error'

Tags

List Tags

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/tags" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Create Tag

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/tags" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{"name": "production"}' | jq .

Variables

List Variables

export $(cat .env | grep -v '^#' | xargs) && curl -s "${N8N_API_URL}/api/v1/variables" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Create Variable

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/variables" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{"key": "MY_VAR", "value": "my-value"}' | jq .

Delete Variable

export $(cat .env | grep -v '^#' | xargs) && curl -s -X DELETE "${N8N_API_URL}/api/v1/variables/{VARIABLE_ID}" -H "X-N8N-API-KEY: ${N8N_API_KEY}" | jq .

Source Control

Pull from Remote

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/source-control/pull" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{"force": false}' | jq .

Push to Remote

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/api/v1/source-control/push" -H "X-N8N-API-KEY: ${N8N_API_KEY}" -H "Content-Type: application/json" -d '{"message": "Update workflows"}' | jq .

Webhook Execution

Execute via Production Webhook

Workflow must be ACTIVATED first.

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/webhook/{WEBHOOK_PATH}" -H "Content-Type: application/json" -d '{"key": "value"}' | jq .

Execute via Test Webhook

Workflow must be OPEN in n8n UI with "Listening for test events".

export $(cat .env | grep -v '^#' | xargs) && curl -s -X POST "${N8N_API_URL}/webhook-test/{WEBHOOK_PATH}" -H "Content-Type: application/json" -d '{"key": "value"}' | jq .

Webhook Node Configuration

ALWAYS use responseMode: "onReceived" (Respond Immediately) by default.

{
  "id": "webhook-trigger",
  "name": "Webhook",
  "type": "n8n-nodes-base.webhook",
  "typeVersion": 2,
  "position": [250, 300],
  "parameters": {
    "path": "my-webhook-path",
    "httpMethod": "POST",
    "responseMode": "onReceived"
  },
  "webhookId": "unique-webhook-id"
}

Response modes:

Why onReceived is preferred:

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.