# n8n

> Manage n8n workflow automations - workflows, activation, executions, credential schemas, and tags - via the API v1.

Lets an agent manage your n8n workflow automations through the REST API v1: list and read workflows, create and update them, activate or deactivate them, browse executions, inspect credential schemas, and read tags. Works with both n8n Cloud and self-hosted instances.

## What it can do

| Method | What it does |
| --- | --- |
| `n8n_workflows_list` | List workflows (filter by active state, tags, name). |
| `n8n_workflow_get` | Get one workflow by ID. |
| `n8n_workflow_create` | Create a workflow (name, nodes, connections). |
| `n8n_workflow_update` | Replace a workflow (PUT) with new nodes and connections. |
| `n8n_workflow_activate` | Activate a workflow. |
| `n8n_workflow_deactivate` | Deactivate a workflow. |
| `n8n_executions_list` | List executions (filter by workflow, status). |
| `n8n_execution_get` | Get one execution (optionally with full run data). |
| `n8n_execution_delete` | Delete an execution. |
| `n8n_credential_schema` | Get the JSON schema for a credential type. |
| `n8n_tags_list` | List tags. |
| `n8n_request` | Generic passthrough to any API v1 endpoint for full API coverage. |

## How to get your key

n8n authenticates with an API key sent as the `X-N8N-API-KEY` header. You also need your **instance URL** - the base host of your n8n (for example `https://xxx.app.n8n.cloud` for Cloud, or your self-hosted URL).

1. Open your n8n instance.
2. Go to **Settings -> n8n API** ([authentication docs](https://docs.n8n.io/api/authentication/)).
3. Create an API key and copy it.
4. Copy your instance base URL from the browser (no trailing `/api/v1` - FlyMyAI adds that).
5. Paste both into FlyMyAI.

## Fields to fill

| FlyMyAI field | Where it comes from |
| --- | --- |
| `N8N_API_KEY` | n8n -> Settings -> n8n API |
| `N8N_BASE_URL` | Your instance URL, e.g. `https://xxx.app.n8n.cloud` |

## Troubleshooting

- **`401 Unauthorized`** - the API key is wrong or expired. Create a new one under Settings -> n8n API.
- **Connection errors / 404 on every call** - the base URL is wrong. Use the instance root (e.g. `https://xxx.app.n8n.cloud`), not a sub-path, and do not append `/api/v1`.
- **`The n8n API is not enabled`** - on self-hosted, enable the Public API in your environment settings.
- **Credentials cannot be listed** - the API does not return existing credentials for security; use `n8n_credential_schema` to see what a credential type expects.

## Links

- [n8n API reference](https://docs.n8n.io/api/)
- [n8n API authentication](https://docs.n8n.io/api/authentication/)
