Figma

Learn how to use Figma with Composio

Overview

SLUG: FIGMA

Description

A collaborative interface design tool.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
full
stringDefaults to https://api.figma.comRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to file_read,file_comments:write,file_dev_resources:read,file_dev_resources:write,webhooks:write
bearer_token
string
full
stringDefaults to https://api.figma.comRequired
generic_api_key
stringRequired

Connecting to Figma

Create an auth config

Use the dashboard to create an auth config for the Figma toolkit. This allows you to connect multiple Figma accounts to Composio for agents to use.

1

Select App

Navigate to the Figma toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5figma_auth_config_id = "ac_YOUR_FIGMA_CONFIG_ID" # Auth config ID created above
6user_id = "0000-0000-0000" # UUID from database/application
7
8composio = Composio()
9
10
11def authenticate_toolkit(user_id: str, auth_config_id: str):
12 connection_request = composio.connected_accounts.initiate(
13 user_id=user_id,
14 auth_config_id=auth_config_id,
15 )
16
17 print(
18 f"Visit this URL to authenticate Figma: {connection_request.redirect_url}"
19 )
20
21 # This will wait for the auth flow to be completed
22 connection_request.wait_for_connection(timeout=15)
23 return connection_request.id
24
25
26connection_id = authenticate_toolkit(user_id, figma_auth_config_id)
27
28# You can also verify the connection status using:
29connected_account = composio.connected_accounts.get(connection_id)
30print(f"Connected account: {connected_account}")

Using API Key

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5figma_auth_config_id = "ac_YOUR_FIGMA_CONFIG_ID" # Auth config ID created above
6user_id = "0000-0000-0000" # UUID from database/app
7
8composio = Composio()
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 # Replace this with a method to retrieve an API key from the user.
12 # Or supply your own.
13 user_api_key = input("[!] Enter API key")
14
15 connection_request = composio.connected_accounts.initiate(
16 user_id=user_id,
17 auth_config_id=auth_config_id,
18 config={"auth_scheme": "API_KEY", "val": user_api_key}
19 )
20
21 # API Key authentication is immediate - no redirect needed
22 print(f"Successfully connected Figma for user {user_id}")
23 print(f"Connection status: {connection_request.status}")
24
25 return connection_request.id
26
27
28connection_id = authenticate_toolkit(user_id, figma_auth_config_id)
29
30# You can verify the connection using:
31connected_account = composio.connected_accounts.get(connection_id)
32print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Figma toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["FIGMA"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Design tokens to tailwind

Description

Convert design tokens to tailwind css configuration. takes the output from extractdesigntokens and generates: - tailwind.config.ts/js with theme extensions - optional globals.css with font imports note: shadow colors can be provided in either string format (e.g., "rgba(15, 110, 110, 0.32)") or dictionary format (e.g., {"r": 0.059, "g": 0.431, "b": 0.431, "a": 0.32}).

Action Parameters

config_format
stringDefaults to ts
include_font_imports
booleanDefaults to True
prefix
string
tokens
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Download Figma Images

Description

Download images from figma file nodes. renders specified nodes as images and downloads them using mercury's filedownloadable infrastructure. supports png, svg, jpg, and pdf formats.

Action Parameters

file_key
stringRequired
images
arrayRequired
scale
numberDefaults to 2
svg_include_id
boolean
svg_outline_text
booleanDefaults to True
svg_simplify_stroke
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Extract design tokens

Description

Extract design tokens from figma files. combines styles, variables, and extracted values to create a comprehensive design token system.

Action Parameters

extract_from_nodes
booleanDefaults to True
file_key
stringRequired
include_local_styles
booleanDefaults to True
include_variables
boolean

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Extract Prototype Interactions

Description

Extract prototype interactions and animations from figma files. analyzes the prototype data to extract: - user interactions (clicks, hovers, etc.) - transition animations - component variant states - user flows and navigation

Action Parameters

analyze_components
booleanDefaults to True
file_key
stringRequired
include_animations
booleanDefaults to True

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get component

Description

Get component data with automatic simplification. returns clean, ai-friendly component structure.

Action Parameters

file_key
stringRequired
node_id
stringRequired
simplify
booleanDefaults to True

Action Response

data
objectRequired
error
string
simplified
booleanRequired
successful
booleanRequired

Tool Name: Get current user

Description

Retrieves detailed information for the currently authenticated figma user.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get files in a project

Description

Fetches a list of files in a figma project, optionally including branch metadata.

Action Parameters

branch_data
boolean
project_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get file components

Description

Retrieves published components from a figma file, which must be a main file (not a branch) acting as a library.

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get file component sets

Description

Retrieves all published component sets from the specified figma main file (file key must not be for a branch).

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get file json

Description

Get figma file data with automatic simplification. this enhanced version automatically transforms verbose figma json into clean, ai-friendly format with: - css-like property names - deduplicated variables - removed empty values - 70%+ size reduction use simplify=false to get raw api response.

Action Parameters

branch_data
boolean
depth
integer
file_key
stringRequired
geometry
string
ids
string
include_raw
boolean
plugin_data
string
simplify
booleanDefaults to True
version
string

Action Response

data
objectRequired
error
string
raw_data
object
simplified
booleanRequired
successful
booleanRequired

Tool Name: Get local variables

Description

Retrieves all local/remote variables for a figma file/branch; crucial for obtaining mode-specific values which `/v1/files/{file key}/variables/published` omits.

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get projects in a team

Description

Retrieves projects within a specified figma team that are visible to the authenticated user.

Action Parameters

team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add a comment to a file

Description

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 defining a comment region.

Action Parameters

client_meta
object
comment_id
string
file_key
stringRequired
message
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add a reaction to a comment

Description

Posts a specified emoji reaction to an existing comment in a figma file or branch, requiring valid file key and comment id.

Action Parameters

comment_id
stringRequired
emoji
stringRequired
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create a webhook

Description

Creates a figma webhook for a `team id` to send post notifications for an `event type` to a publicly accessible https `endpoint`; an initial ping is sent unless `status` is `paused`.

Action Parameters

description
string
endpoint
stringRequired
event_type
stringRequired
passcode
stringRequired
status
string
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create dev resources

Description

Creates and attaches multiple uniquely-urled development resources to specified figma nodes, up to 10 per node.

Action Parameters

dev_resources
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create, modify, or delete variables

Description

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 `variablemodevalues` match the target variable's `resolvedtype`.

Action Parameters

file_key
stringRequired
variableCollections
array
variableModeValues
array
variableModes
array
variables
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete a comment

Description

Deletes a specific comment from a figma file or branch, provided the authenticated user is the original author of the comment.

Action Parameters

comment_id
stringRequired
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete a reaction

Description

Deletes a specific emoji reaction from a comment in a figma file; the user must have originally created the reaction.

Action Parameters

comment_id
stringRequired
emoji
stringRequired
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete a webhook

Description

Permanently deletes an existing webhook, identified by its unique `webhook id`; this operation is irreversible.

Action Parameters

webhook_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete dev resource

Description

Deletes a development resource (used to link figma design elements to external developer information like code or tasks) from a specified figma file.

Action Parameters

dev_resource_id
stringRequired
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Detect background

Description

Detect background layers for selected nodes. uses geometric analysis, z-index ordering, and visual properties to identify potential background layers.

Action Parameters

file_key
stringRequired
search_depth
integerDefaults to 3
target_node_ids
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Discover Figma Resources

Description

🔍 smart figma resource discovery - never guess ids again! 🎯 easiest method: just paste any figma url to get all ids: • file urls: https://www.figma.com/file/abc123/design → get file key • design urls: https://www.figma.com/design/abc123/design → get file key • node urls: ...?node-id=123:456 → get file key + node id • team urls: .../team/123456/... → get team id 🔄 step-by-step discovery: 1. team id → projects list (with project ids) 2. project id → files list (with file keys + thumbnails) 3. file key → nodes list (with node ids + hierarchy) 💡 common workflows: • extract from url: discoverfigmaresources(figma url="...") • browse team: discoverfigmaresources(team id="123") • list files: discoverfigmaresources(project id="proj 456") • find nodes: discoverfigmaresources(file key="abc123") ✨ get file key for getfilejson, node ids for detectbackground, etc.

Action Parameters

figma_url
string
file_key
string
max_depth
integerDefaults to 2
project_id
string
team_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get activity logs

Description

Retrieves activity log events from figma, allowing filtering by event types, time range, and pagination.

Action Parameters

end_time
integer
events
string
limit
integer
order
stringDefaults to asc
start_time
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a webhook

Description

Retrieves detailed information about a specific webhook by its id, provided the webhook exists and is accessible to the user.

Action Parameters

webhook_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get comments in a file

Description

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.

Action Parameters

as_md
boolean
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get component set

Description

Retrieves detailed metadata for a specific published figma component set using its unique `key`.

Action Parameters

key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get dev resources

Description

Retrieves development resources (e.g., jira/github links) for a figma main file, optionally filtering by specific node ids.

Action Parameters

file_key
stringRequired
node_ids
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get file styles

Description

Retrieves a list of published styles (like colors, text attributes, effects, and layout grids) from a specified main figma file (not a branch).

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get image fills

Description

Retrieves temporary (14-day expiry) download urls for all image fills in a figma file; requires `imageref` from `paint` objects to map urls.

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics component action data

Description

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).

Action Parameters

cursor
string
end_date
string
file_key
stringRequired
group_by
stringRequired
start_date
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics component usage data

Description

Retrieves component usage analytics for a specified figma library file (identified by `file key`), with data groupable by 'component' or 'file'.

Action Parameters

cursor
string
file_key
stringRequired
group_by
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics style action data

Description

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.

Action Parameters

cursor
string
end_date
string
file_key
stringRequired
group_by
stringRequired
start_date
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics style usage data

Description

Retrieves style usage analytics for a figma library (specified by a valid `file key`), allowing data to be grouped by 'file' or 'style'.

Action Parameters

cursor
string
file_key
stringRequired
group_by
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics variable action data

Description

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 optional date range.

Action Parameters

cursor
string
end_date
string
file_key
stringRequired
group_by
stringRequired
start_date
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get library analytics variable usage data

Description

Retrieves paginated analytics data on variable usage from a specified figma library, grouped by 'file' or 'variable', for libraries with enabled analytics.

Action Parameters

cursor
string
file_key
stringRequired
group_by
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get current user

Description

Deprecated: use 'get current user' instead. retrieves user information for the authenticated user.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get payments

Description

Retrieves a user's payment information for a figma plugin, widget, or community file; the authenticated identity must own the resource.

Action Parameters

community_file_id
integer
plugin_id
integer
plugin_payment_token
string
user_id
integer
widget_id
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get published variables

Description

Retrieves variables published from a specified figma file; this api is available only to full members of enterprise organizations.

Action Parameters

file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get reactions for a comment

Description

Retrieves reactions for a specific comment in a figma file.

Action Parameters

comment_id
stringRequired
cursor
string
file_key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get style

Description

Retrieves detailed metadata for a specific style in figma using its unique style key.

Action Parameters

key
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get team components

Description

Retrieves components published in a specific figma team's library; the team must have published components, otherwise an empty list is returned.

Action Parameters

after
integer
before
integer
page_size
integerDefaults to 30
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get team component sets

Description

Retrieves a paginated list of published component sets (collections of reusable ui elements) from a specified figma team's library.

Action Parameters

after
integer
before
integer
page_size
integerDefaults to 30
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get team styles

Description

Retrieves a paginated list of published styles, such as colors or text attributes, from a specified figma team's library.

Action Parameters

after
integer
before
integer
page_size
integerDefaults to 30
team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get team webhooks

Description

Retrieves all webhooks registered for a specified figma team.

Action Parameters

team_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get versions of a file

Description

Retrieves the version history for a figma file or branch, as specified by its `file key`.

Action Parameters

after
integer
before
integer
file_key
stringRequired
page_size
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get webhook requests

Description

Retrieves a history of webhook requests for a specific figma webhook subscription; data is available for requests sent within the last seven days.

Action Parameters

webhook_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Render images of file nodes

Description

Renders specified nodes from a figma file as images (jpg, pdf, png, svg), returning a map of node ids to image urls (or `null` for failed nodes); images expire after 30 days and are capped at 32 megapixels (larger requests are scaled down).

Action Parameters

contents_only
booleanDefaults to True
file_key
stringRequired
format
stringDefaults to png
ids
stringRequired
scale
integer
svg_include_id
boolean
svg_include_node_id
boolean
svg_outline_text
booleanDefaults to True
svg_simplify_stroke
booleanDefaults to True
use_absolute_bounds
boolean
version
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update a webhook

Description

Updates an existing figma webhook, identified by `webhook id`, allowing modification of its event type, endpoint, passcode, status, or description.

Action Parameters

description
string
endpoint
stringRequired
event_type
stringRequired
passcode
stringRequired
status
string
webhook_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update dev resources

Description

Updates the name and/or url of one or more existing figma dev resources, each identified by its unique `id`.

Action Parameters

dev_resources
arrayRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired