I’m working with Figma’s API and need to loop through all the master components in a project. Can I access these components directly without creating instances of them in my document first?
I also have questions about component UUIDs. When I make changes to a component, does its unique identifier stay the same? And if multiple people are using the same component library, will they all see the same UUID for each component?
I’m trying to build a tool that tracks component usage across different files, so understanding how these identifiers work is really important for my project.
for sure! u can use figmaAPI.getFile() to get the components obj directly! no need for instances. the UUIDs won’t change even if u edit the component, and everyone using that library sees the same UUIDs, so tracking is easy!
You can grab master components directly through Figma’s REST API using the /files/:key endpoint. When you fetch a file, you’ll get a components object with all the master components and their metadata. Each component has a stable node ID that sticks around through edits - you’ll only get a new ID if you duplicate or recreate the component entirely. For cross-team stuff, component UUIDs stay the same across different users and files as long as they’re from the same library. This makes building usage tracking tools pretty easy since you can reliably match components across multiple documents. I’ve built similar tracking systems before and found that watching the componentId field in instance nodes works great for mapping relationships between master components and where they’re used throughout your project.
Yeah, the Figma API lets you grab master components directly from the document structure. Just look for nodes with type ‘COMPONENT’ - those are your masters. UUID persistence works great for tracking. Component IDs stay the same even when you edit the component, which is perfect for building tracking systems. But here’s something that tripped me up: when someone publishes a new library version, tracking gets messy if components get renamed or restructured. Make sure your logic handles component versioning in published libraries, especially if you’re tracking usage across team files that might be using different library versions.