productivity
Figma CLI for AI Agents
Use the Figma CLI from KosmoKrator to call Figma tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Figma CLI Setup
Figma can be configured headlessly with `kosmokrator integrations:configure figma`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure figma --set access_token="$FIGMA_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor figma --json
kosmokrator integrations:status --json Credentials
Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | FIGMA_ACCESS_TOKEN | Secret secret | yes | Personal Access Token |
url | FIGMA_URL | URL url | no | API Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call figma.figma_delete_comment '{"file_key":"example_file_key","comment_id":"example_comment_id"}' --json kosmo integrations:figma figma_delete_comment '{"file_key":"example_file_key","comment_id":"example_comment_id"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs figma --json
kosmo integrations:docs figma.figma_delete_comment --json
kosmo integrations:schema figma.figma_delete_comment --json
kosmo integrations:search "Figma" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
figma.figma_delete_comment
Delete a comment from a Figma file.
write - Parameters
- file_key, comment_id
kosmo integrations:call figma.figma_delete_comment '{"file_key":"example_file_key","comment_id":"example_comment_id"}' --json kosmo integrations:figma figma_delete_comment '{"file_key":"example_file_key","comment_id":"example_comment_id"}' --json figma.figma_get_comments
List all comments on a Figma file.
read - Parameters
- file_key
kosmo integrations:call figma.figma_get_comments '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_get_comments '{"file_key":"example_file_key"}' --json figma.figma_get_component
Get a Figma component by its key.
read - Parameters
- component_key
kosmo integrations:call figma.figma_get_component '{"component_key":"example_component_key"}' --json kosmo integrations:figma figma_get_component '{"component_key":"example_component_key"}' --json figma.figma_get_components
List all components in a Figma file.
read - Parameters
- file_key
kosmo integrations:call figma.figma_get_components '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_get_components '{"file_key":"example_file_key"}' --json figma.figma_get_current_user
Get the authenticated Figma user profile. Returns name, email, and account details.
read - Parameters
- none
kosmo integrations:call figma.figma_get_current_user '{}' --json kosmo integrations:figma figma_get_current_user '{}' --json figma.figma_get_file
Get a Figma file by key. Returns the document tree with pages and nodes.
read - Parameters
- file_key, ids, depth, geometry, plugin_data
kosmo integrations:call figma.figma_get_file '{"file_key":"example_file_key","ids":"example_ids","depth":1,"geometry":"example_geometry","plugin_data":"example_plugin_data"}' --json kosmo integrations:figma figma_get_file '{"file_key":"example_file_key","ids":"example_ids","depth":1,"geometry":"example_geometry","plugin_data":"example_plugin_data"}' --json figma.figma_get_file_images
Export images from Figma nodes in a file. Returns image download URLs.
read - Parameters
- file_key, ids, format, scale, svg_include_id_token
kosmo integrations:call figma.figma_get_file_images '{"file_key":"example_file_key","ids":"example_ids","format":"example_format","scale":1,"svg_include_id_token":true}' --json kosmo integrations:figma figma_get_file_images '{"file_key":"example_file_key","ids":"example_ids","format":"example_format","scale":1,"svg_include_id_token":true}' --json figma.figma_get_file_nodes
Get specific nodes from a Figma file by node IDs.
read - Parameters
- file_key, ids, depth, geometry
kosmo integrations:call figma.figma_get_file_nodes '{"file_key":"example_file_key","ids":"example_ids","depth":1,"geometry":"example_geometry"}' --json kosmo integrations:figma figma_get_file_nodes '{"file_key":"example_file_key","ids":"example_ids","depth":1,"geometry":"example_geometry"}' --json figma.figma_get_image_fills
Get image fill metadata for a Figma file. Returns image URLs for all image fills.
read - Parameters
- file_key
kosmo integrations:call figma.figma_get_image_fills '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_get_image_fills '{"file_key":"example_file_key"}' --json figma.figma_get_me
Get the authenticated Figma user profile.
read - Parameters
- none
kosmo integrations:call figma.figma_get_me '{}' --json kosmo integrations:figma figma_get_me '{}' --json figma.figma_get_project_files
List all files in a Figma project.
read - Parameters
- project_id, branch_data
kosmo integrations:call figma.figma_get_project_files '{"project_id":"example_project_id","branch_data":true}' --json kosmo integrations:figma figma_get_project_files '{"project_id":"example_project_id","branch_data":true}' --json figma.figma_get_style
Get a Figma style by its key.
read - Parameters
- style_key
kosmo integrations:call figma.figma_get_style '{"style_key":"example_style_key"}' --json kosmo integrations:figma figma_get_style '{"style_key":"example_style_key"}' --json figma.figma_get_styles
List all styles in a Figma file.
read - Parameters
- file_key
kosmo integrations:call figma.figma_get_styles '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_get_styles '{"file_key":"example_file_key"}' --json figma.figma_get_team_projects
List all projects in a Figma team.
read - Parameters
- team_id
kosmo integrations:call figma.figma_get_team_projects '{"team_id":"example_team_id"}' --json kosmo integrations:figma figma_get_team_projects '{"team_id":"example_team_id"}' --json figma.figma_list_comments
List all comments on a Figma file. Includes authors, positions, and reply threads.
read - Parameters
- file_key
kosmo integrations:call figma.figma_list_comments '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_list_comments '{"file_key":"example_file_key"}' --json figma.figma_list_components
List all components in a Figma file. Returns component names, keys, and descriptions.
read - Parameters
- file_key
kosmo integrations:call figma.figma_list_components '{"file_key":"example_file_key"}' --json kosmo integrations:figma figma_list_components '{"file_key":"example_file_key"}' --json figma.figma_list_files
List Figma files accessible to the authenticated user. Returns file names, keys, and thumbnails with pagination support.
read - Parameters
- limit, page
kosmo integrations:call figma.figma_list_files '{"limit":1,"page":1}' --json kosmo integrations:figma figma_list_files '{"limit":1,"page":1}' --json figma.figma_list_projects
List all projects in a Figma team. Returns project names and IDs.
read - Parameters
- team_id
kosmo integrations:call figma.figma_list_projects '{"team_id":"example_team_id"}' --json kosmo integrations:figma figma_list_projects '{"team_id":"example_team_id"}' --json figma.figma_list_team_components
List published components in a Figma team.
read - Parameters
- team_id, max_depth
kosmo integrations:call figma.figma_list_team_components '{"team_id":"example_team_id","max_depth":1}' --json kosmo integrations:figma figma_list_team_components '{"team_id":"example_team_id","max_depth":1}' --json figma.figma_post_comment
Post a comment on a Figma file. Can be a top-level comment or a reply.
read - Parameters
- file_key, message, client_meta, comment_id
kosmo integrations:call figma.figma_post_comment '{"file_key":"example_file_key","message":"example_message","client_meta":"example_client_meta","comment_id":"example_comment_id"}' --json kosmo integrations:figma figma_post_comment '{"file_key":"example_file_key","message":"example_message","client_meta":"example_client_meta","comment_id":"example_comment_id"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
figma.figma_delete_comment 2 parameters
kosmo integrations:schema figma.figma_delete_comment --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
comment_id | string | yes | The comment ID to delete. |
figma.figma_get_comments 1 parameters
kosmo integrations:schema figma.figma_get_comments --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_get_component 1 parameters
kosmo integrations:schema figma.figma_get_component --json | Parameter | Type | Required | Description |
|---|---|---|---|
component_key | string | yes | The component key. |
figma.figma_get_components 1 parameters
kosmo integrations:schema figma.figma_get_components --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_get_current_user 0 parameters
kosmo integrations:schema figma.figma_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
figma.figma_get_file 5 parameters
kosmo integrations:schema figma.figma_get_file --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key (from the file URL). |
ids | string | no | Comma-separated list of node IDs to return. |
depth | integer | no | Max depth of the document tree to return. |
geometry | string | no | Set to "path" to include vector path data. |
plugin_data | string | no | Comma-separated list of plugin IDs to include data for. |
figma.figma_get_file_images 5 parameters
kosmo integrations:schema figma.figma_get_file_images --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
ids | string | yes | Comma-separated list of node IDs to export. |
format | string | no | Image format: png, jpg, svg, or pdf. Defaults to png. |
scale | number | no | Image scale factor (e.g. 1, 2, 3). Defaults to 1. |
svg_include_id_token | boolean | no | If true, include id attribute for SVG root. |
figma.figma_get_file_nodes 4 parameters
kosmo integrations:schema figma.figma_get_file_nodes --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
ids | string | yes | Comma-separated list of node IDs to retrieve. |
depth | integer | no | Max depth of nodes to return. |
geometry | string | no | Set to "path" to include vector path data. |
figma.figma_get_image_fills 1 parameters
kosmo integrations:schema figma.figma_get_image_fills --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_get_me 0 parameters
kosmo integrations:schema figma.figma_get_me --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
figma.figma_get_project_files 2 parameters
kosmo integrations:schema figma.figma_get_project_files --json | Parameter | Type | Required | Description |
|---|---|---|---|
project_id | string | yes | The Figma project ID. |
branch_data | boolean | no | If true, include branch metadata for each file. |
figma.figma_get_style 1 parameters
kosmo integrations:schema figma.figma_get_style --json | Parameter | Type | Required | Description |
|---|---|---|---|
style_key | string | yes | The style key. |
figma.figma_get_styles 1 parameters
kosmo integrations:schema figma.figma_get_styles --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_get_team_projects 1 parameters
kosmo integrations:schema figma.figma_get_team_projects --json | Parameter | Type | Required | Description |
|---|---|---|---|
team_id | string | yes | The Figma team ID. |
figma.figma_list_comments 1 parameters
kosmo integrations:schema figma.figma_list_comments --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_list_components 1 parameters
kosmo integrations:schema figma.figma_list_components --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
figma.figma_list_files 2 parameters
kosmo integrations:schema figma.figma_list_files --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of files to return (default: 30). |
page | integer | no | Page number for pagination (default: 1). |
figma.figma_list_projects 1 parameters
kosmo integrations:schema figma.figma_list_projects --json | Parameter | Type | Required | Description |
|---|---|---|---|
team_id | string | yes | The Figma team ID. |
figma.figma_list_team_components 2 parameters
kosmo integrations:schema figma.figma_list_team_components --json | Parameter | Type | Required | Description |
|---|---|---|---|
team_id | string | yes | The Figma team ID. |
max_depth | integer | no | Maximum depth of component tree to return. |
figma.figma_post_comment 4 parameters
kosmo integrations:schema figma.figma_post_comment --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_key | string | yes | The Figma file key. |
message | string | yes | The comment text. |
client_meta | string | no | JSON object with position metadata (x, y) for the comment. |
comment_id | string | no | If provided, this comment is a reply to the given comment ID. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.