Skip to main content
September 8, 2023
Solved

How to fetch component keys from team library?

  • September 8, 2023
  • 2 replies
  • 1976 views

I am trying to make a plugin to download all components from a selected team library.
(without having the user to import the components in the document manually, or hardcoding all the component keys)

I found a way to fetch the “variable collection” from a team library, but it seems there is no possible way to directly fetch the “components” from a team library.

So I am trying to make the plugin to

  1. import the components into the document, and then
  2. fetch them from the document

I am trying to find a way to do step 1, which I probably will use importComponentByKeyAsync, but I need a way to find the component keys with the plugin.

Are there any possible ways to do this?

This topic has been closed for replies.
Best answer by tank666

If you are running the plugin in a non-library file, you can get the keys for components and component sets using the REST API.
https://www.figma.com/developers/api#get-file-components-endpoint
https://www.figma.com/developers/api#get-file-component-sets-endpoint

2 replies

tank666
tank666Answer
September 8, 2023

If you are running the plugin in a non-library file, you can get the keys for components and component sets using the REST API.
https://www.figma.com/developers/api#get-file-components-endpoint
https://www.figma.com/developers/api#get-file-component-sets-endpoint

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
September 13, 2023