n8n-selfhosted-opslisted
Install: claude install-skill Mixard/fable-pack
# Self-hosted n8n operations
Verified on n8n 2.8 (global npm install, systemd service, sqlite backend). The facts
below are the ones models reliably get wrong: they assume the REST API is the only
import path, that .env files load automatically, and that sendAndWait works.
## Workflow import without an API key
`n8n import:workflow --input=/path/to/workflow.json` writes directly into the sqlite
DB, bypassing the REST API entirely - no API key, no running UI session needed.
Safe to run repeatedly: the command also applies pending DB migrations on start.
Success output: `Successfully imported N workflow(s).`
- List workflows and recover IDs: `n8n list:workflow` (returns `ID|Name` rows).
- Gotcha: running import via `sudo -u OTHER_USER` fails with `EACCES` when the JSON
is root-owned mode 600. Keep the file readable or run as the service user.
## Env vars in workflow expressions
n8n does NOT read a project `.env` automatically. For `{{$env.FOO}}` to resolve,
the variable must be in the service environment. With systemd:
```
sudo systemctl edit n8n
# add:
[Service]
EnvironmentFile=/path/to/.env
# then:
systemctl daemon-reload && systemctl restart n8n
```
## Credentials are never exported
Workflow JSON exports reference credentials by ID only - the secrets themselves are
not in the file. After importing to another instance, every credentialed node points
at a dangling ID. The user must create each credential in the UI (Settings >
Credentials > New) and re-link it in each