Managing different credentials for DEV and PROD workflows without manually updating every node

Hi everyone,

I’m currently using n8n Pro, and I’m trying to understand the best practice for managing credentials between DEV and PROD environments.

I have a workflow built in DEV with multiple nodes configured using development credentials, for example:

  • OpenAI

  • ERPNext

  • other external services

When the workflow is ready, I duplicate it to move it to production.
The issue is that I then have to manually open many nodes and replace the DEV credentials with the PROD credentials.

I’m wondering whether there is a better approach in n8n, such as:

  • dynamically using different credentials depending on the environment

  • avoiding manual credential replacement node by node

  • having a cleaner deployment process from development to production

So my main question is:

Is there a way in n8n to configure a workflow so that it automatically uses the correct credentials for DEV or PROD, without manually changing the credentials in every node after duplicating the workflow?

I’d also like to understand what the recommended best practices are in this scenario. For example:

  • duplicating the workflow and manually changing credentials

  • using separate DEV/PROD instances

  • using environment variables

  • following a naming convention for credentials

  • or any other cleaner strategy

If anyone has already solved this in a structured way, I’d really appreciate an example of how you organize it.

Thanks!

1 Like

@Gianluca

I’d usually handle this with separate DEV and PROD instances, and keep the credential names the same in both. That way the workflow can move over much more cleanly, without opening every node to swap credentials.

Hi @Gianluca having different instances is a bit unusual, people just separate workflows based on “CRM Staging” & “CRM Prod” and that is really it, having different cloud instances just to keep things separated is not a bad idea but sounds like a too much work, why dont you try just having a single instance but a folder named Prod containing all published and in production flows and externally just keep all the flows you are working on, so that would cut off another n8n instance overhead and also a lot of copy pasting time, and in case if you really want this setup i recommend having your production n8n instance self hosted, so that you can do a lot of customization related to credentials as on cloud there is almost nothing related to env variables.

Just to make sure I understood correctly: do you mean having separate DEV and PROD instances (or projects), each with its own credentials but using the same credential names, and then maintaining two copies of the workflow, one in DEV and one in PROD?

yes, correct

it’s common practice in some places to develop in one environment and run production workflows in another.

thanks for your help ! I’ll try ASAP

happy to help!
I hope everything goes well.
If this solution solves your problem, please consider liking or marking the answer as the solution (this helps others find the answer more easily and also supports community contributors).

another option if you dont want a separate instance: export the workflow as JSON, do a find-replace on the credential IDs in a text editor, then import into PROD. not the cleanest way but works fine for one-off migrations.

for regular deployments the approaches already mentioned (same credential names across instances, or folder separation on one) are probably the better call tho