Node and browser client for Figma REST API
npm i figma-rest
yarn add figma-rest
pnpm i figma-rest
import { FigmaClient } from 'figma-api'
const figma = new FigmaClient({
personalAccessToken: 'fig123',
})
const file = await figma.files.get('file_key')
Some of Figma's endpoints that contain long lists are paginated.
The client provides an AsyncIterableIterator
that you can for await...of
each item in the list:
let reactions: Reaction[] = []
for await (let reaction of client.comments.reactions('123', '456')) {
reactions.push(reaction)
}