How to share workflow in private n8n instance?

Hello,
I would like to share with other users of a private n8n instance. How does it? Is it possible?

When I look at the database, the workflow seems to be attached to a single user and it is not possible to share it.

Thank you for your answer

1 Like

Hi @Thibaut_Cellier, welcome to the community :tada:

You’re quire right, user management does not allow sharing workflows or credentials between users at this time unfortunately. So at present to share a workflow you’d need to share the JSON code/file of the respective workflow. You can download your workflow through the Workflows menu in the left sidebar:

That said, I do know our product and engineering teams are working hard on improving the user management functionality, maybe @sirdavidoff can share some more details on where we currently are with this?

2 Likes

This is completely experimental, likely prone to breaking and may put your n8n in an unexpected state. But if you have access to the n8n DB, you can actually set two or more owners for the same workflow, and also do the same with credentials.

This workflow sets up some webhook endpoints (with basic auth):

  • get-users: return a list of users and their IDs
  • get-workflows: returns a list of workflows, their IDs, and their owner
  • share-workflow: this takes a userId and a workflowId then shares that workflow with that user, including any of the linked credentials.
    • curl -u user:pass https://n8n.example.com/webhook/share-workflow -d "userId=abcd-wxyz&workflowId=123"

Again, YMMV:

4 Likes

The main thing to avoid is sharing workflows with sub-workflows that aren’t shared with the same user. You’ll get all sorts of errors and have trouble getting your triggers up and running again

1 Like

While I wouldn’t want to run it in a production environment, that is some beautiful work there.