Developing a Plugin for Automating Design Fetch and Recreation from a Single-Component Figma File

Hi, I’m wondering whether it would be possible to create a plugin that fetches a component from a Figma file (based on a link I provide), which has one component, and recreates it when I run my plugin?

Yes, it’s possible.

I do this by getting the key file in URL.
example:
URL = https://www.figma.com/file/<key>/name?type=design&t=xyz

I use REST API for get components list

curl -H 'X-FIGMA-TOKEN: xxx' 'https://api.figma.com/v1/files/<key>/components'

And then take key component for import using importComponentByKeyAsync
example:

const importComponent = await figma.importComponentByKeyAsync(key);
const instance = importComponent.createInstance();
const page = figma.currentPage;

page.appendChild(instance);