How to generate URL to specific node?

I have the Figma page URL, the node ID (1:2, 1:3, etc), and the file key. Is there a way to generate a URL to a specific node? from what I’m able to see, the URL should be https://www.figma.com/file{file_key}/{file_name}?node-id=/{node_id} but the node_id appears in the URL as something like 1%3A2&t=LmbhyU6Dh4wZFrzK-0. Is there a way to convert the 1:3 node_id from the original node object into the string necessary for this? Thanks for the help.

3 Likes

The same question. I also need file_key. Unclear how to get it.

1%3A2 = 1:2.

figma.fileKey

1 Like

Why is it available for private plugins only? It’s strange.

This was helpful reference. If anyone else is referencing this to generate their own urls, just a note, I think…
https://www.figma.com/file{file_key}/{file_name}?node-id=/{node_id}
…should actually be…
https://www.figma.com/file/{file_key}/{file_name}?node-id={node_id} (note the different position of the forward slashes).

The specific code I used to generate urls was…
const nodeUrl = `https://www.figma.com/file/${figma.fileKey}/${encodeURIComponent(figma.root.name)}?type=design&node-id=${encodeURIComponent(node_id)}`