Is there a way to get the current file's ID?

I can’t find this anywhere. I also can’t imagine this is a security risk.

If someone runs XYZ plugin on a specific file, they have access to 99.999999% of the rest of the file… the one thing that seems to be missing is some sort of unique ID for the DocumentNode itself.

My use case is I’m trying to make a public-facing plugin where users can configure settings per-file. I was going to do something like:

figma.clientStorage.setAsync(documentUID, settingsForThisFile)

By getting the file ID a plugin gets perpetual access to the file through REST API (if the file is also accessible by link), which is not something a user expects as plugins only are supposed to work and access the doc when they are launched.

You can store plugin data right on the document node itself (or any other node if necessary):

1 Like

Thanks for the prompt reply!

By getting the file ID a plugin gets perpetual access to the file through REST API

If so, could the Figma team make a separate field on the document called notRestApiAccessibleUID or something to easily avoid that?

You can store plugin data right on the document node itself

I tried doing this with figma.root.foo = 'bar' and it told me that node was read only. I saw this mentioned in a couple old threads but couldn’t find any snippets or docs and ChatGPT didn’t help.

Do you happen to know the API for doing something like that? It’d solve my use-case.

I linked the docs above

1 Like

D’oh! Thank you! I didn’t realize it was a permalink to a specific part of that page.