# Figma on boxd

> A collaborative interface design tool.

- Page: https://boxd.sh/integrations/figma/
- CLI: `run figma` (53 commands, 17 marked common)
- SDK: `import { figma } from "@boxd/run"`; every parameter and response type is at `@boxd/run/figma`
- Triggers: none
- Connect: `run auth figma` (Sign in with Figma), or https://app.boxd.sh/integrations/detail/figma
- All integrations: https://boxd.sh/integrations/ (Markdown: https://boxd.sh/integrations/index.md)

## From the shell

```sh
run auth figma      # once: prints a link to connect your account
run figma           # list its commands
run figma get-current-user
```

Parameters are flags (`--flag value`); object and array parameters take a JSON string. Output is YAML, or JSON with `--json`. Calls use your own connection; `--scope <name>` uses a connection shared with your team.

## From a script

```ts
import { every, figma } from "@boxd/run";

every("1 hour", async () => {
  const result = await figma.getCurrentUser();
  console.log(result);
});
```

Run it with `run figma.run.ts`. Figma has no triggers; `every()` polls on a schedule, keeps the script running as a job, and wakes the machine when it is due.

## Commands

Required flags are listed; `run figma <command> --help` lists the optional ones. "common" marks what `run figma` shows without `--all`.

| Command | SDK method | Required flags | Optional | Description |
|---|---|---|---|---|
| `add-comment-to-file` | `figma.addCommentToFile()` | `--file-key` `--message` | 2 | Posts a new comment to a Figma file or branch, optionally replying to an existing root comment (replies cannot be nested); `region_height` and `region_width` in `client_meta` must be positive if… |
| `add-reaction-to-comment` | `figma.addReactionToComment()` | `--comment-id` `--emoji` `--file-key` | 0 | Posts a specified emoji reaction to an existing comment in a Figma file or branch, requiring valid file_key and comment_id |
| `create-dev-resources` | `figma.createDevResources()` | `--dev-resources` | 0 | Creates and attaches multiple uniquely-URLed development resources to specified Figma nodes, up to 10 per node |
| `create-modify-delete-variables` | `figma.createModifyDeleteVariables()` | `--file-key` | 4 | Manages variables, collections, modes, and their values in a Figma file via batch create/update/delete operations; use temporary IDs to link new related items in one request and ensure… |
| `create-webhook` | `figma.createWebhook()` | `--endpoint` `--event-type` `--passcode` | 5 | Creates a Figma webhook to receive POST notifications when specific events occur |
| `delete-comment` | `figma.deleteComment()` | `--comment-id` `--file-key` | 0 | Deletes a specific comment from a Figma file or branch, provided the authenticated user is the original author of the comment |
| `delete-dev-resource` | `figma.deleteDevResource()` | `--dev-resource-id` `--file-key` | 0 | Deletes a development resource (used to link Figma design elements to external developer information like code or tasks) from a specified Figma file |
| `delete-reaction` | `figma.deleteReaction()` | `--comment-id` `--emoji` `--file-key` | 0 | Deletes a specific emoji reaction from a comment in a Figma file; the user must have originally created the reaction |
| `delete-webhook` | `figma.deleteWebhook()` | `--webhook-id` | 0 | Permanently deletes an existing webhook, identified by its unique `webhook_id`; this operation is irreversible |
| `design-tokens-to-tailwind` ·common | `figma.designTokensToTailwind()` | `--tokens` | 3 | Convert design tokens to Tailwind CSS configuration |
| `detect-background` ·common | `figma.detectBackground()` | `--file-key` `--target-node-ids` | 1 | Detect background layers for selected nodes in a Figma file |
| `discover-resources` ·common | `figma.discoverResources()` | — | 5 | Smart Figma resource discovery - extract IDs from any Figma URL |
| `download-images` ·common | `figma.downloadImages()` | `--file-key` `--images` | 4 | Download images from Figma file nodes |
| `extract-design-tokens` ·common | `figma.extractDesignTokens()` | `--file-key` | 3 | Extract design tokens from Figma files by combining styles, variables, and node-extracted values |
| `extract-prototype-interactions` ·common | `figma.extractPrototypeInteractions()` | `--file-key` | 2 | Extract prototype interactions and animations from Figma files |
| `get-activity-logs` | `figma.getActivityLogs()` | — | 5 | Retrieves activity log events from Figma, allowing filtering by event types, time range, and pagination |
| `get-comments-in-file` | `figma.getCommentsInFile()` | `--file-key` | 1 | Retrieves all comments from an existing Figma file, identified by a valid `file_key`, returning details like content, author, position, and reactions, with an option for Markdown formatted content |
| `get-component` ·common ·deprecated | `figma.getComponent()` | `--file-key` `--node-id` | 1 | Use get-file-nodes instead |
| `get-component-set` | `figma.getComponentSet()` | `--key` | 0 | Retrieves detailed metadata for a specific published Figma component set using its unique `key` |
| `get-component2` ·common | `figma.getComponent2()` | `--key` | 0 | Fetches metadata for a specific component using its unique identifier |
| `get-current-user` ·common | `figma.getCurrentUser()` | — | 0 | Retrieves detailed information for the currently authenticated Figma user |
| `get-dev-resources` | `figma.getDevResources()` | `--file-key` | 1 | Retrieves development resources (e.g., Jira/GitHub links) for a Figma main file, optionally filtering by specific node IDs |
| `get-file-component-sets` ·common | `figma.getFileComponentSets()` | `--file-key` | 0 | Retrieves all published component sets from the specified Figma main file (file_key must not be for a branch) |
| `get-file-components` ·common | `figma.getFileComponents()` | `--file-key` | 0 | Retrieves published components from a Figma file, which must be a main file (not a branch) acting as a library |
| `get-file-json` ·common | `figma.getFileJson()` | `--file-key` | 7 | Get Figma Design file data with automatic simplification |
| `get-file-metadata` ·common | `figma.getFileMetadata()` | `--file-key` | 0 | Get Figma file metadata including name, creator, last modification details, thumbnail, and access information |
| `get-file-nodes` ·common | `figma.getFileNodes()` | `--file-key` `--ids` | 4 | Fetch JSON for specific node IDs from a Figma file to avoid full-file payload limits |
| `get-file-styles` | `figma.getFileStyles()` | `--file-key` | 0 | Retrieves a list of published styles (like colors, text attributes, effects, and layout grids) from a specified main Figma file (not a branch) |
| `get-files-in-project` ·common | `figma.getFilesInProject()` | `--project-id` | 1 | Fetches a list of files in a Figma project, optionally including branch metadata |
| `get-image-fills` | `figma.getImageFills()` | `--file-key` | 0 | Retrieves temporary (14-day expiry) download URLs for all image fills in a Figma file; requires `imageRef` from `Paint` objects to map URLs |
| `get-library-analytics-component-action-data` | `figma.getLibraryAnalyticsComponentActionData()` | `--file-key` `--group-by` | 3 | Retrieves component insertion and detachment analytics for a specified Figma library, groupable by 'component' or 'team' and filterable by a date range (YYYY-MM-DD) |
| `get-library-analytics-component-usage-data` | `figma.getLibraryAnalyticsComponentUsageData()` | `--file-key` `--group-by` | 1 | Retrieves component usage analytics for a specified Figma library file (identified by `file_key`), with data groupable by 'component' or 'file' |
| `get-library-analytics-style-action-data` | `figma.getLibraryAnalyticsStyleActionData()` | `--file-key` `--group-by` | 3 | Retrieves style usage analytics (insertions, detachments) for a Figma library, grouped by 'style' or 'team'; if providing a date range, ensure end_date is not before start_date |
| `get-library-analytics-style-usage-data` | `figma.getLibraryAnalyticsStyleUsageData()` | `--file-key` `--group-by` | 1 | Retrieves style usage analytics for a published Figma library |
| `get-library-analytics-variable-action-data` | `figma.getLibraryAnalyticsVariableActionData()` | `--file-key` `--group-by` | 3 | Retrieves weekly, paginated analytics data on variable insertions and detachments for a specified Figma library (identified by `file_key`), groupable by 'variable' or 'team', and filterable by an… |
| `get-library-analytics-variable-usage-data` | `figma.getLibraryAnalyticsVariableUsageData()` | `--file-key` `--group-by` | 1 | Retrieves paginated analytics data on variable usage from a specified Figma library, grouped by 'file' or 'variable', for libraries with enabled analytics |
| `get-local-variables` ·common | `figma.getLocalVariables()` | `--file-key` | 0 | Retrieves all local/remote variables for a Figma file/branch; crucial for obtaining mode-specific values which `/v1/files/{file_key}/variables/published` omits |
| `get-payments` | `figma.getPayments()` | — | 5 | Retrieves a user's payment information for a Figma plugin, widget, or Community file; the authenticated identity must own the resource |
| `get-projects-in-team` ·common | `figma.getProjectsInTeam()` | `--team-id` | 0 | Retrieves projects within a specified Figma team that are visible to the authenticated user |
| `get-published-variables` | `figma.getPublishedVariables()` | `--file-key` | 0 | Retrieves variables published from a specified Figma file; this API is available only to full members of Enterprise organizations |
| `get-reactions-for-comment` | `figma.getReactionsForComment()` | `--comment-id` `--file-key` | 1 | Retrieves reactions for a specific comment in a Figma file |
| `get-scim-service-provider-config` | `figma.getScimServiceProviderConfig()` | — | 0 | Get Figma's SCIM service provider configuration |
| `get-style` | `figma.getStyle()` | `--key` | 0 | Retrieves detailed metadata for a specific style in Figma using its unique style key |
| `get-team-component-sets` | `figma.getTeamComponentSets()` | `--team-id` | 3 | Retrieves a paginated list of published component sets (collections of reusable UI elements) from a specified Figma team's library |
| `get-team-components` | `figma.getTeamComponents()` | `--team-id` | 3 | Retrieves components published in a specific Figma team's library; the team must have published components, otherwise an empty list is returned |
| `get-team-styles` | `figma.getTeamStyles()` | `--team-id` | 3 | Retrieves a paginated list of published styles (fill colors, text styles, effects, grids) from a specified Figma team's library |
| `get-team-webhooks` | `figma.getTeamWebhooks()` | `--context-id` | 1 | Retrieves all webhooks registered for a specified Figma context (team, project, or file) |
| `get-versions-of-file` | `figma.getVersionsOfFile()` | `--file-key` | 3 | Retrieves the version history for a Figma file or branch, as specified by its `file_key` |
| `get-webhook` | `figma.getWebhook()` | `--webhook-id` | 0 | Retrieves detailed information about a specific webhook by its ID, provided the webhook exists and is accessible to the user |
| `get-webhook-requests` | `figma.getWebhookRequests()` | `--webhook-id` | 0 | Retrieves a history of webhook requests for a specific Figma webhook subscription; data is available for requests sent within the last seven days |
| `render-images-of-file-nodes` | `figma.renderImagesOfFileNodes()` | `--file-key` `--ids` | 9 | Render Figma nodes as images (PNG, JPG, SVG, PDF) |
| `update-dev-resources` | `figma.updateDevResources()` | `--dev-resources` | 0 | Updates the name and/or URL of one or more existing Figma Dev Resources, each identified by its unique `id` |
| `update-webhook` | `figma.updateWebhook()` | `--webhook-id` | 5 | Updates an existing Figma webhook, identified by `webhook_id`, allowing modification of its event type, endpoint, passcode, status, or description |

## Docs

- [run CLI](https://docs.boxd.sh/cli/run): Call connected integrations from the shell, connect new ones, and run automations.
- [Quickstart](https://docs.boxd.sh/guides/integrations/quickstart): Connect an integration, call it from the shell, and turn a script into an automation.
- [Connections](https://docs.boxd.sh/guides/integrations/connections): Connect an account once, for yourself or for your whole organization.
- [Scripts](https://docs.boxd.sh/guides/automations/scripts): Typed integrations, triggers, schedules and state in a .run.ts file.
- [Jobs](https://docs.boxd.sh/guides/automations/jobs): How a script becomes a background job: states, retries, sleep and wake.
- [Beyond the catalog](https://docs.boxd.sh/guides/automations/beyond-the-catalog): Reach your own APIs, databases and cloud accounts from a script.
