GET file returns all file data, including the components and component sets that are in this file. You just need to find them in the file structure.
I already use the approach mentioned by @Gleb but it is laborious and expensive when searching through large files, so was excited to see there is a dedicated endpoint for retrieving a fileโs components.
However, Iโm having the same issue as @Nalin_Agrawal - the file components endpoint keeps returning an empty array. Has anyone seen this before, and managed to resolve it?
This is the structure of my request:
curl -H 'X-FIGMA-TOKEN: <my-auth-token>' 'https://api.figma.com/v1/files/6HQRQOxFtpc8mppUXgcgLz/components'
Are your file components published to the library?