@biggora/claude-plugins 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +13 -0
- package/CLAUDE.md +55 -0
- package/LICENSE +1 -1
- package/README.md +208 -39
- package/bin/cli.js +39 -0
- package/package.json +30 -17
- package/registry/registry.json +166 -1
- package/registry/schema.json +10 -0
- package/src/commands/skills/add.js +194 -0
- package/src/commands/skills/list.js +52 -0
- package/src/commands/skills/remove.js +27 -0
- package/src/commands/skills/update.js +74 -0
- package/src/config.js +5 -0
- package/src/skills/codex-cli/SKILL.md +265 -0
- package/src/skills/commafeed-api/SKILL.md +1012 -0
- package/src/skills/gemini-cli/SKILL.md +379 -0
- package/src/skills/gemini-cli/references/commands.md +145 -0
- package/src/skills/gemini-cli/references/configuration.md +182 -0
- package/src/skills/gemini-cli/references/headless-and-scripting.md +181 -0
- package/src/skills/gemini-cli/references/mcp-and-extensions.md +254 -0
- package/src/skills/n8n-api/SKILL.md +623 -0
- package/src/skills/notebook-lm/SKILL.md +217 -0
- package/src/skills/notebook-lm/references/artifact-options.md +168 -0
- package/src/skills/notebook-lm/references/auth.md +58 -0
- package/src/skills/notebook-lm/references/workflows.md +144 -0
- package/src/skills/screen-recording/SKILL.md +309 -0
- package/src/skills/screen-recording/references/approach1-programmatic.md +311 -0
- package/src/skills/screen-recording/references/approach2-xvfb.md +232 -0
- package/src/skills/screen-recording/references/design-patterns.md +168 -0
- package/src/skills/test-mobile-app/SKILL.md +212 -0
- package/src/skills/test-mobile-app/references/report-template.md +95 -0
- package/src/skills/test-mobile-app/references/setup-appium.md +154 -0
- package/src/skills/test-mobile-app/scripts/analyze_apk.py +164 -0
- package/src/skills/test-mobile-app/scripts/check_environment.py +116 -0
- package/src/skills/test-mobile-app/scripts/generate_report.py +250 -0
- package/src/skills/test-mobile-app/scripts/run_tests.py +326 -0
- package/src/skills/test-web-ui/SKILL.md +232 -0
- package/src/skills/test-web-ui/references/test_case_schema.md +102 -0
- package/src/skills/test-web-ui/scripts/discover.py +176 -0
- package/src/skills/test-web-ui/scripts/generate_report.py +237 -0
- package/src/skills/test-web-ui/scripts/run_tests.py +296 -0
- package/src/skills/text-to-speech/SKILL.md +236 -0
- package/src/skills/text-to-speech/references/espeak-cli.md +277 -0
- package/src/skills/text-to-speech/references/kokoro-onnx.md +124 -0
- package/src/skills/text-to-speech/references/online-engines.md +128 -0
- package/src/skills/text-to-speech/references/pyttsx3-espeak.md +143 -0
- package/src/skills/tm-search/SKILL.md +240 -0
- package/src/skills/tm-search/references/field-guide.md +79 -0
- package/src/skills/tm-search/references/scraping-fallback.md +140 -0
- package/src/skills/tm-search/scripts/tm_search.py +375 -0
- package/src/skills/wp-rest-api/SKILL.md +114 -0
- package/src/skills/wp-rest-api/references/authentication.md +18 -0
- package/src/skills/wp-rest-api/references/custom-content-types.md +20 -0
- package/src/skills/wp-rest-api/references/discovery-and-params.md +20 -0
- package/src/skills/wp-rest-api/references/responses-and-fields.md +30 -0
- package/src/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
- package/src/skills/wp-rest-api/references/schema.md +22 -0
- package/src/skills/youtube-search/SKILL.md +412 -0
- package/src/skills/youtube-search/references/parsing-examples.md +159 -0
- package/src/skills/youtube-search/references/youtube-api-quota.md +85 -0
- package/src/skills/youtube-thumbnail/SKILL.md +1060 -0
- package/tests/commands/info.test.js +49 -0
- package/tests/commands/install.test.js +36 -0
- package/tests/commands/list.test.js +66 -0
- package/tests/commands/publish.test.js +182 -0
- package/tests/commands/search.test.js +45 -0
- package/tests/commands/uninstall.test.js +29 -0
- package/tests/commands/update.test.js +59 -0
- package/tests/functional/skills-lifecycle.test.js +293 -0
- package/tests/helpers/fixtures.js +63 -0
- package/tests/integration/cli.test.js +83 -0
- package/tests/skills/add.test.js +138 -0
- package/tests/skills/list.test.js +63 -0
- package/tests/skills/remove.test.js +38 -0
- package/tests/skills/update.test.js +60 -0
- package/tests/unit/config.test.js +31 -0
- package/tests/unit/registry.test.js +79 -0
- package/tests/unit/utils.test.js +150 -0
- package/tests/validation/registry-schema.test.js +112 -0
- package/tests/validation/skills-validation.test.js +96 -0
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: n8n-api
|
|
3
|
+
description: >
|
|
4
|
+
Use this skill whenever the user wants to interact with an n8n instance via its
|
|
5
|
+
public REST API. Triggers include: listing, creating, updating, deleting, activating
|
|
6
|
+
or deactivating workflows; viewing or managing executions; managing credentials, tags,
|
|
7
|
+
variables, users, or projects; auditing instance activity; triggering workflow runs;
|
|
8
|
+
checking execution status; or any automation task involving the n8n API. Also use for
|
|
9
|
+
requests like "show my n8n workflows", "run workflow X", "list failed executions",
|
|
10
|
+
"create a tag in n8n", "manage n8n variables", or "check n8n audit log".
|
|
11
|
+
Always use this skill for any n8n API interaction — it defines the correct endpoints,
|
|
12
|
+
authentication, and patterns.
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# n8n REST API Skill
|
|
16
|
+
|
|
17
|
+
Interact with an n8n automation platform instance via its public REST API v1.
|
|
18
|
+
|
|
19
|
+
## Environment Variables (REQUIRED)
|
|
20
|
+
|
|
21
|
+
Before making any API calls, ensure these environment variables are set:
|
|
22
|
+
|
|
23
|
+
| Variable | Description | Example |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `N8N_HOST` | n8n instance hostname (with protocol, no trailing slash) | `https://n8n.example.com` |
|
|
26
|
+
| `N8N_API_KEY` | API key generated in n8n UI (Settings > API) | `n8n_api_...` |
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
export N8N_HOST="https://n8n.example.com"
|
|
30
|
+
export N8N_API_KEY="your-api-key-here"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If these are not set, **ask the user** to provide them before proceeding.
|
|
34
|
+
|
|
35
|
+
## Authentication
|
|
36
|
+
|
|
37
|
+
All requests require the `X-N8N-API-KEY` header:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -H "X-N8N-API-KEY: $N8N_API_KEY" "$N8N_HOST/api/v1/workflows"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Every request pattern below assumes:
|
|
44
|
+
- Base URL: `$N8N_HOST/api/v1`
|
|
45
|
+
- Header: `X-N8N-API-KEY: $N8N_API_KEY`
|
|
46
|
+
- Content-Type: `application/json` (for POST/PUT/PATCH)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## API Endpoints
|
|
51
|
+
|
|
52
|
+
### Workflows
|
|
53
|
+
|
|
54
|
+
| Method | Path | Description |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| GET | `/workflows` | List all workflows (supports `?active=true/false`, `?tags=tagId`, `?limit=N`, `?cursor=`) |
|
|
57
|
+
| GET | `/workflows/{id}` | Get a single workflow by ID |
|
|
58
|
+
| POST | `/workflows` | Create a new workflow |
|
|
59
|
+
| PUT | `/workflows/{id}` | Update an existing workflow (full replace) |
|
|
60
|
+
| DELETE | `/workflows/{id}` | Delete a workflow |
|
|
61
|
+
| POST | `/workflows/{id}/activate` | Activate a workflow |
|
|
62
|
+
| POST | `/workflows/{id}/deactivate` | Deactivate a workflow |
|
|
63
|
+
| POST | `/workflows/{id}/transfer` | Transfer workflow to another project |
|
|
64
|
+
|
|
65
|
+
#### List workflows
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
69
|
+
"$N8N_HOST/api/v1/workflows?limit=50" | jq .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Query parameters:
|
|
73
|
+
- `active` (boolean) — filter by active/inactive status
|
|
74
|
+
- `tags` (string) — filter by tag ID
|
|
75
|
+
- `name` (string) — filter by name (partial match)
|
|
76
|
+
- `limit` (number) — results per page (default 10, max 250)
|
|
77
|
+
- `cursor` (string) — pagination cursor from previous response
|
|
78
|
+
|
|
79
|
+
#### Get a workflow
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
83
|
+
"$N8N_HOST/api/v1/workflows/{id}" | jq .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Create a workflow
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
curl -s -X POST \
|
|
90
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
91
|
+
-H "Content-Type: application/json" \
|
|
92
|
+
-d '{
|
|
93
|
+
"name": "My Workflow",
|
|
94
|
+
"nodes": [],
|
|
95
|
+
"connections": {},
|
|
96
|
+
"settings": {
|
|
97
|
+
"executionOrder": "v1"
|
|
98
|
+
}
|
|
99
|
+
}' \
|
|
100
|
+
"$N8N_HOST/api/v1/workflows" | jq .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Request body fields:
|
|
104
|
+
- `name` (string, required) — workflow name
|
|
105
|
+
- `nodes` (array, required) — array of node objects
|
|
106
|
+
- `connections` (object, required) — node connections map
|
|
107
|
+
- `settings` (object) — workflow settings
|
|
108
|
+
- `staticData` (object) — static data for the workflow
|
|
109
|
+
- `tags` (array of objects) — tags to assign `[{"id": "tagId"}]`
|
|
110
|
+
|
|
111
|
+
#### Update a workflow
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
curl -s -X PUT \
|
|
115
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
116
|
+
-H "Content-Type: application/json" \
|
|
117
|
+
-d '{
|
|
118
|
+
"name": "Updated Workflow",
|
|
119
|
+
"nodes": [...],
|
|
120
|
+
"connections": {...},
|
|
121
|
+
"settings": {...}
|
|
122
|
+
}' \
|
|
123
|
+
"$N8N_HOST/api/v1/workflows/{id}" | jq .
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> **Note:** If the workflow is active, the updated version is automatically re-published.
|
|
127
|
+
|
|
128
|
+
#### Activate / Deactivate
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Activate
|
|
132
|
+
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
133
|
+
"$N8N_HOST/api/v1/workflows/{id}/activate" | jq .
|
|
134
|
+
|
|
135
|
+
# Deactivate
|
|
136
|
+
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
137
|
+
"$N8N_HOST/api/v1/workflows/{id}/deactivate" | jq .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Delete a workflow
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
curl -s -X DELETE -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
144
|
+
"$N8N_HOST/api/v1/workflows/{id}" | jq .
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### Executions
|
|
150
|
+
|
|
151
|
+
| Method | Path | Description |
|
|
152
|
+
|---|---|---|
|
|
153
|
+
| GET | `/executions` | List executions (supports filters) |
|
|
154
|
+
| GET | `/executions/{id}` | Get a single execution |
|
|
155
|
+
| DELETE | `/executions/{id}` | Delete an execution |
|
|
156
|
+
| POST | `/executions/{id}/stop` | Stop a running execution |
|
|
157
|
+
|
|
158
|
+
#### List executions
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
162
|
+
"$N8N_HOST/api/v1/executions?limit=20&status=error" | jq .
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Query parameters:
|
|
166
|
+
- `workflowId` (string) — filter by workflow ID
|
|
167
|
+
- `status` (string) — `error`, `success`, `waiting`, `running`
|
|
168
|
+
- `limit` (number) — results per page (default 10, max 250)
|
|
169
|
+
- `cursor` (string) — pagination cursor
|
|
170
|
+
- `includeData` (boolean) — include full execution data (default false)
|
|
171
|
+
|
|
172
|
+
#### Get execution details
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
176
|
+
"$N8N_HOST/api/v1/executions/{id}?includeData=true" | jq .
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Response includes:
|
|
180
|
+
- `id` — execution ID
|
|
181
|
+
- `finished` — boolean
|
|
182
|
+
- `mode` — trigger mode (manual, webhook, trigger, etc.)
|
|
183
|
+
- `startedAt` / `stoppedAt` — timestamps
|
|
184
|
+
- `workflowId` — associated workflow
|
|
185
|
+
- `status` — success/error/waiting/running
|
|
186
|
+
- `data` — full execution data (when `includeData=true`)
|
|
187
|
+
|
|
188
|
+
#### Stop a running execution
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
192
|
+
"$N8N_HOST/api/v1/executions/{id}/stop" | jq .
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Credentials
|
|
198
|
+
|
|
199
|
+
| Method | Path | Description |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| GET | `/credentials` | List all credentials |
|
|
202
|
+
| POST | `/credentials` | Create new credential |
|
|
203
|
+
| DELETE | `/credentials/{id}` | Delete a credential |
|
|
204
|
+
| POST | `/credentials/{id}/transfer` | Transfer credential to another project |
|
|
205
|
+
|
|
206
|
+
#### List credentials
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
210
|
+
"$N8N_HOST/api/v1/credentials?limit=50" | jq .
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Query parameters:
|
|
214
|
+
- `limit` (number) — results per page
|
|
215
|
+
- `cursor` (string) — pagination cursor
|
|
216
|
+
|
|
217
|
+
#### Create credential
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
curl -s -X POST \
|
|
221
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
222
|
+
-H "Content-Type: application/json" \
|
|
223
|
+
-d '{
|
|
224
|
+
"name": "My API Key",
|
|
225
|
+
"type": "httpHeaderAuth",
|
|
226
|
+
"data": {
|
|
227
|
+
"name": "Authorization",
|
|
228
|
+
"value": "Bearer token123"
|
|
229
|
+
}
|
|
230
|
+
}' \
|
|
231
|
+
"$N8N_HOST/api/v1/credentials" | jq .
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Request body:
|
|
235
|
+
- `name` (string, required) — credential name
|
|
236
|
+
- `type` (string, required) — credential type (e.g., `httpHeaderAuth`, `oAuth2Api`, `httpBasicAuth`)
|
|
237
|
+
- `data` (object, required) — credential-specific data
|
|
238
|
+
|
|
239
|
+
> **Security note:** The API does not return credential secrets in GET responses. Only metadata (id, name, type, createdAt, updatedAt) is returned.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### Tags
|
|
244
|
+
|
|
245
|
+
| Method | Path | Description |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| GET | `/tags` | List all tags |
|
|
248
|
+
| GET | `/tags/{id}` | Get a single tag |
|
|
249
|
+
| POST | `/tags` | Create a new tag |
|
|
250
|
+
| PUT | `/tags/{id}` | Update a tag |
|
|
251
|
+
| DELETE | `/tags/{id}` | Delete a tag |
|
|
252
|
+
|
|
253
|
+
#### List tags
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
257
|
+
"$N8N_HOST/api/v1/tags?limit=100" | jq .
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### Create tag
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
curl -s -X POST \
|
|
264
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
265
|
+
-H "Content-Type: application/json" \
|
|
266
|
+
-d '{"name": "production"}' \
|
|
267
|
+
"$N8N_HOST/api/v1/tags" | jq .
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### Update tag
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
curl -s -X PUT \
|
|
274
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
275
|
+
-H "Content-Type: application/json" \
|
|
276
|
+
-d '{"name": "staging"}' \
|
|
277
|
+
"$N8N_HOST/api/v1/tags/{id}" | jq .
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
### Variables
|
|
283
|
+
|
|
284
|
+
| Method | Path | Description |
|
|
285
|
+
|---|---|---|
|
|
286
|
+
| GET | `/variables` | List all variables |
|
|
287
|
+
| POST | `/variables` | Create a variable |
|
|
288
|
+
| PUT | `/variables/{id}` | Update a variable |
|
|
289
|
+
| DELETE | `/variables/{id}` | Delete a variable |
|
|
290
|
+
|
|
291
|
+
#### List variables
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
295
|
+
"$N8N_HOST/api/v1/variables" | jq .
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### Create variable
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
curl -s -X POST \
|
|
302
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
303
|
+
-H "Content-Type: application/json" \
|
|
304
|
+
-d '{"key": "API_ENDPOINT", "value": "https://api.example.com"}' \
|
|
305
|
+
"$N8N_HOST/api/v1/variables" | jq .
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### Update variable
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
curl -s -X PUT \
|
|
312
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
313
|
+
-H "Content-Type: application/json" \
|
|
314
|
+
-d '{"key": "API_ENDPOINT", "value": "https://api-v2.example.com"}' \
|
|
315
|
+
"$N8N_HOST/api/v1/variables/{id}" | jq .
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### Users
|
|
321
|
+
|
|
322
|
+
| Method | Path | Description |
|
|
323
|
+
|---|---|---|
|
|
324
|
+
| GET | `/users` | List all users |
|
|
325
|
+
| GET | `/users/{id}` | Get user by ID (or `email:{email}`) |
|
|
326
|
+
|
|
327
|
+
#### List users
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
331
|
+
"$N8N_HOST/api/v1/users?limit=50" | jq .
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Query parameters:
|
|
335
|
+
- `limit` (number) — results per page
|
|
336
|
+
- `cursor` (string) — pagination cursor
|
|
337
|
+
- `includeRole` (boolean) — include role in response
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### Projects
|
|
342
|
+
|
|
343
|
+
| Method | Path | Description |
|
|
344
|
+
|---|---|---|
|
|
345
|
+
| GET | `/projects` | List all projects |
|
|
346
|
+
| GET | `/projects/{id}` | Get project by ID |
|
|
347
|
+
| POST | `/projects` | Create a project |
|
|
348
|
+
| PUT | `/projects/{id}` | Update a project |
|
|
349
|
+
| DELETE | `/projects/{id}` | Delete a project |
|
|
350
|
+
|
|
351
|
+
#### List projects
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
355
|
+
"$N8N_HOST/api/v1/projects" | jq .
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### Create project
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
curl -s -X POST \
|
|
362
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
363
|
+
-H "Content-Type: application/json" \
|
|
364
|
+
-d '{"name": "Marketing Automations"}' \
|
|
365
|
+
"$N8N_HOST/api/v1/projects" | jq .
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
### Audit
|
|
371
|
+
|
|
372
|
+
| Method | Path | Description |
|
|
373
|
+
|---|---|---|
|
|
374
|
+
| POST | `/audit` | Generate a security audit report |
|
|
375
|
+
|
|
376
|
+
#### Generate audit
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
curl -s -X POST \
|
|
380
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
381
|
+
-H "Content-Type: application/json" \
|
|
382
|
+
-d '{"additionalOptions": {"categories": ["credentials", "nodes", "instance"]}}' \
|
|
383
|
+
"$N8N_HOST/api/v1/audit" | jq .
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Audit categories: `credentials`, `nodes`, `database`, `filesystem`, `instance`.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### Source Control
|
|
391
|
+
|
|
392
|
+
| Method | Path | Description |
|
|
393
|
+
|---|---|---|
|
|
394
|
+
| GET | `/source-control/preferences` | Get source control preferences |
|
|
395
|
+
| POST | `/source-control/preferences` | Set source control preferences |
|
|
396
|
+
| POST | `/source-control/pull` | Pull changes from remote |
|
|
397
|
+
| POST | `/source-control/push` | Push changes to remote |
|
|
398
|
+
| GET | `/source-control/status` | Get modified resources status |
|
|
399
|
+
| POST | `/source-control/disconnect` | Disconnect from source control |
|
|
400
|
+
|
|
401
|
+
#### Get status
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
405
|
+
"$N8N_HOST/api/v1/source-control/status" | jq .
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
#### Pull from remote
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
curl -s -X POST \
|
|
412
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
413
|
+
-H "Content-Type: application/json" \
|
|
414
|
+
-d '{"force": false}' \
|
|
415
|
+
"$N8N_HOST/api/v1/source-control/pull" | jq .
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Pagination
|
|
421
|
+
|
|
422
|
+
The n8n API uses **cursor-based pagination**. Responses include:
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
{
|
|
426
|
+
"data": [...],
|
|
427
|
+
"nextCursor": "eyJsaW1pdCI6MTAsIm9mZnNldCI6MTB9"
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
To fetch the next page, pass `?cursor=<nextCursor>` on the next request. When `nextCursor` is `null`, there are no more results.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Common Patterns
|
|
436
|
+
|
|
437
|
+
### List all workflows with their status
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
441
|
+
"$N8N_HOST/api/v1/workflows?limit=250" | \
|
|
442
|
+
jq '.data[] | {id, name, active, updatedAt}'
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Find failed executions for a workflow
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
449
|
+
"$N8N_HOST/api/v1/executions?workflowId=123&status=error&limit=50" | \
|
|
450
|
+
jq '.data[] | {id, status, startedAt, stoppedAt}'
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Trigger a workflow manually via webhook
|
|
454
|
+
|
|
455
|
+
If a workflow has a Webhook node, you can trigger it directly:
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
curl -s -X POST \
|
|
459
|
+
-H "Content-Type: application/json" \
|
|
460
|
+
-d '{"key": "value"}' \
|
|
461
|
+
"$N8N_HOST/webhook/{webhook-path}"
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
> **Note:** Webhook URLs use `/webhook/` or `/webhook-test/` path, not `/api/v1/`.
|
|
465
|
+
|
|
466
|
+
### Export a workflow as JSON
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
470
|
+
"$N8N_HOST/api/v1/workflows/{id}" | jq . > workflow-backup.json
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Import / restore a workflow from JSON
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
curl -s -X POST \
|
|
477
|
+
-H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
478
|
+
-H "Content-Type: application/json" \
|
|
479
|
+
-d @workflow-backup.json \
|
|
480
|
+
"$N8N_HOST/api/v1/workflows" | jq .
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Bulk activate all workflows
|
|
484
|
+
|
|
485
|
+
```bash
|
|
486
|
+
# Get all inactive workflow IDs, then activate each
|
|
487
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
488
|
+
"$N8N_HOST/api/v1/workflows?active=false&limit=250" | \
|
|
489
|
+
jq -r '.data[].id' | while read id; do
|
|
490
|
+
curl -s -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
491
|
+
"$N8N_HOST/api/v1/workflows/$id/activate" > /dev/null
|
|
492
|
+
echo "Activated workflow $id"
|
|
493
|
+
done
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Delete old executions (cleanup)
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# Get executions older than a specific date and delete them
|
|
500
|
+
curl -s -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
501
|
+
"$N8N_HOST/api/v1/executions?status=success&limit=100" | \
|
|
502
|
+
jq -r '.data[].id' | while read id; do
|
|
503
|
+
curl -s -X DELETE -H "X-N8N-API-KEY: $N8N_API_KEY" \
|
|
504
|
+
"$N8N_HOST/api/v1/executions/$id" > /dev/null
|
|
505
|
+
echo "Deleted execution $id"
|
|
506
|
+
done
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## Error Handling
|
|
512
|
+
|
|
513
|
+
Common HTTP status codes:
|
|
514
|
+
|
|
515
|
+
| Code | Meaning |
|
|
516
|
+
|---|---|
|
|
517
|
+
| 200 | Success |
|
|
518
|
+
| 201 | Created |
|
|
519
|
+
| 400 | Bad request (invalid parameters) |
|
|
520
|
+
| 401 | Unauthorized (missing or invalid API key) |
|
|
521
|
+
| 403 | Forbidden (insufficient permissions) |
|
|
522
|
+
| 404 | Resource not found |
|
|
523
|
+
| 500 | Internal server error |
|
|
524
|
+
|
|
525
|
+
Error response format:
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
{
|
|
529
|
+
"code": 404,
|
|
530
|
+
"message": "The requested workflow was not found"
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Implementation Notes
|
|
537
|
+
|
|
538
|
+
- Always read `N8N_HOST` and `N8N_API_KEY` from environment variables — never hardcode them
|
|
539
|
+
- Use `jq` for JSON processing in shell scripts
|
|
540
|
+
- For Node.js scripts, use `fetch()` or `axios` with the same headers
|
|
541
|
+
- Rate limiting: n8n does not enforce strict rate limits by default, but be respectful on shared instances
|
|
542
|
+
- Pagination: always handle `nextCursor` for endpoints that return lists
|
|
543
|
+
- Webhook URLs are separate from the API (`/webhook/` vs `/api/v1/`)
|
|
544
|
+
- Execution data can be large — use `includeData=false` (default) when listing executions
|
|
545
|
+
- Workflow JSON structure follows n8n's internal format (nodes + connections + settings)
|
|
546
|
+
|
|
547
|
+
## Node.js Example
|
|
548
|
+
|
|
549
|
+
```javascript
|
|
550
|
+
const N8N_HOST = process.env.N8N_HOST;
|
|
551
|
+
const N8N_API_KEY = process.env.N8N_API_KEY;
|
|
552
|
+
|
|
553
|
+
async function n8nApi(method, path, body = null) {
|
|
554
|
+
const url = `${N8N_HOST}/api/v1${path}`;
|
|
555
|
+
const options = {
|
|
556
|
+
method,
|
|
557
|
+
headers: {
|
|
558
|
+
'X-N8N-API-KEY': N8N_API_KEY,
|
|
559
|
+
'Content-Type': 'application/json',
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
if (body) options.body = JSON.stringify(body);
|
|
563
|
+
const res = await fetch(url, options);
|
|
564
|
+
if (!res.ok) throw new Error(`n8n API ${res.status}: ${await res.text()}`);
|
|
565
|
+
return res.json();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// List workflows
|
|
569
|
+
const workflows = await n8nApi('GET', '/workflows?limit=50');
|
|
570
|
+
console.log(workflows.data);
|
|
571
|
+
|
|
572
|
+
// Create a tag
|
|
573
|
+
const tag = await n8nApi('POST', '/tags', { name: 'automated' });
|
|
574
|
+
console.log(tag);
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
## Python Example
|
|
578
|
+
|
|
579
|
+
```python
|
|
580
|
+
import os
|
|
581
|
+
import requests
|
|
582
|
+
|
|
583
|
+
N8N_HOST = os.environ["N8N_HOST"]
|
|
584
|
+
N8N_API_KEY = os.environ["N8N_API_KEY"]
|
|
585
|
+
|
|
586
|
+
HEADERS = {
|
|
587
|
+
"X-N8N-API-KEY": N8N_API_KEY,
|
|
588
|
+
"Content-Type": "application/json",
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
def n8n_api(method, path, json=None):
|
|
592
|
+
url = f"{N8N_HOST}/api/v1{path}"
|
|
593
|
+
resp = requests.request(method, url, headers=HEADERS, json=json)
|
|
594
|
+
resp.raise_for_status()
|
|
595
|
+
return resp.json()
|
|
596
|
+
|
|
597
|
+
# List workflows
|
|
598
|
+
workflows = n8n_api("GET", "/workflows?limit=50")
|
|
599
|
+
for wf in workflows["data"]:
|
|
600
|
+
print(f"{wf['id']}: {wf['name']} (active={wf['active']})")
|
|
601
|
+
|
|
602
|
+
# Create a variable
|
|
603
|
+
n8n_api("POST", "/variables", {"key": "ENV", "value": "production"})
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## Verification
|
|
609
|
+
|
|
610
|
+
After any API interaction, verify:
|
|
611
|
+
- HTTP status code is 2xx
|
|
612
|
+
- Response contains expected fields (`id`, `name`, etc.)
|
|
613
|
+
- For workflow creation/update: check workflow appears in the list
|
|
614
|
+
- For activation: check `active` field is `true`
|
|
615
|
+
- For executions: check `status` matches expected outcome
|
|
616
|
+
|
|
617
|
+
## Failure Modes
|
|
618
|
+
|
|
619
|
+
- **401 Unauthorized**: API key is missing, invalid, or expired. Regenerate in n8n UI > Settings > API.
|
|
620
|
+
- **404 Not Found**: Wrong workflow/execution ID, or the resource was deleted. Verify ID with a list call.
|
|
621
|
+
- **400 Bad Request**: Invalid JSON body or missing required fields. Check request structure.
|
|
622
|
+
- **Connection refused**: Wrong `N8N_HOST` or n8n instance is down. Verify URL and instance status.
|
|
623
|
+
- **Empty `data` array**: No results match filters. Broaden query parameters.
|