Skip to main content
Photo of DeepakNess DeepakNess

Export n8n workflows and credentials

Unproofread notes

I was moving my self-hosted n8n instance to another server and needed to export my workflows and credentials so that I can use them inside my new n8n instance. There is a page about this in the n8n official docs but the commands don't directly work in the terminal. However, there's a workaround for this:

First, ssh into your server by running the ssh root@your_server_ip command and then cd into the n8n directory. For me, the folder was n8n-docker-caddy. After that find the name of your Docker container by running the following command:

docker ps

Find the container name and then run the below command, and replace the <container_name> with the actual name of the container. This outputs a workflows.json file in the same directory that you can later copy of download to your computer.

docker exec -u node -it <container_name> n8n export:workflow --all > workflows.json

Similarly, you can run the below command to output all credentials as credentials.json file in the same directory.

docker exec -u node -it <container_name> n8n export:credentials --all --decrypted > credentials.json

Make sure to keep the credentials safe as it contains important keys and APIs that you wouldn't want going into wrong hands.

Also, to download these .json files locally to your computer, you can run the below command. Replace your_ip_address with the server's IP and adjust other things accordingly.

scp root@your_ip_address:/root/n8n-docker-caddy/*.json ~/Downloads/

That's it.

Previously, I've also written about n8n password reset and upgrading n8n that you might find helpful.

Hope this helps.

Comment via email