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.

I have a question about your sharing question. I hope this doesn’t bother the ticket too much.

@pemontto how did you get the workflow to show here in the ticket as a visual workflow and not straight text JSON? I’ve been looking all over for how to do that here in the community forums. Haven’t found that answer yet.

Any help or guidance is appreciated, I’m a newbie here.

Maybe this should be in the FAQ - n8n, or in the forum help text.

It’s quite simple, just surround your JSON, or any other code with three back ticks ```

```
{
    "My Pasted Workflow": {
        "Nodes": [
        ]
    }
}
```
1 Like

Thank You for that. I did try pasting the JSON in between the back ticks. Just looked like text JSON to me. Maybe it’s because I’m reading it from within my profile.

Hey @norg,

If you are just seeing formatted json it could be that something was missed on the copy of the workflow, Sometimes when manually removing data it can cause an issue if the same format is not kept but most of the issues I have seen are when other characters get in the way.

If you have an example post I can take a quick look and see what happened.

1 Like