All examples assume FIGMA_API_TOKEN is set.
Base URL: https://api.figma.com/v1
---
1. Get File
Retrieve complete file structure including frames, components, and styles. Replace with your actual file key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files/" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '{name, lastModified, version, document: .document.children[0].name}'
```
Get specific version:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files/?version=123" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"'
```
---
2. Get File Nodes
Retrieve specific nodes from a file by node IDs. Replace with your file key and with comma-separated node IDs (e.g., 1:2,1:3):
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files//nodes?ids=" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.nodes'
```
Node IDs can be found in the file structure or by appending ?node-id=X-Y to the Figma URL.
---
3. Get File Images
Export nodes as images in PNG, JPG, SVG, or PDF format. Replace with your file key and with comma-separated node IDs:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/images/?ids=&format=png&scale=2" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.images'
```
Parameters:
format: png, jpg, svg, pdf (default: png)scale: 0.5, 1, 2, 4 (default: 1)svg_outline_text: true to convert text to outlines in SVGsvg_include_id: true to include node IDs in SVG
Download an exported image. Replace with your file key and with the actual node ID:
```bash
IMAGE_URL="$(bash -c 'curl -s -X GET "https://api.figma.com/v1/images/?ids=&format=png" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq -r '.images[""]')"
curl -s -o output.png "$IMAGE_URL"
```
---
4. Get Image Fills
Get download URLs for all images used in a file. Replace with your file key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files//images" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.meta.images'
```
---
5. Get File Comments
List all comments on a file. Replace with your file key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files//comments" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.comments[] | {id, message: .message, user: .user.handle, created_at}'
```
---
6. Post Comment
Add a comment to a file. Replace with your file key.
Write to /tmp/figma_request.json:
```json
{
"message": "This looks great!",
"client_meta": {"x": 100, "y": 200}
}
```
Then run:
```bash
bash -c 'curl -s -X POST "https://api.figma.com/v1/files//comments" -H "X-Figma-Token: ${FIGMA_API_TOKEN}" -H "Content-Type: application/json" -d @/tmp/figma_request.json'
```
To comment on a specific node, add client_meta with node coordinates.
---
7. Delete Comment
Delete a comment by ID. Replace with your file key and with the comment ID:
```bash
curl -s -X DELETE "https://api.figma.com/v1/files//comments/" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"
```
---
8. Get File Versions
List version history of a file. Replace with your file key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files//versions" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.versions[] | {id, created_at, label, description, user: .user.handle}'
```
---
9. Get Team Projects
List all projects in a team. Replace with your team ID:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/teams//projects" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.projects[] | {id, name}'
```
To find your team ID, go to your Figma team page and extract it from the URL: https://www.figma.com/files/team//TeamName
---
10. Get Project Files
List all files in a project. Replace with your project ID:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/projects//files" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.files[] | {key, name, last_modified}'
```
---
11. Get Team Components
Get all published components in a team. Replace with your team ID:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/teams//components" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.meta.components[] | {key, name, description, containing_frame: .containing_frame.name}'
```
---
12. Get Component
Get metadata for a specific component. Replace with your component key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/components/" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '{key, name, description, containing_frame}'
```
---
13. Get Team Styles
Get all published styles (colors, text, effects, grids) in a team. Replace with your team ID:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/teams//styles" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.meta.styles[] | {key, name, description, style_type}'
```
Style types: FILL, TEXT, EFFECT, GRID
---
14. Get Style
Get metadata for a specific style. Replace with your style key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/styles/" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '{key, name, description, style_type}'
```
---
15. Get Current User
Get information about the authenticated user:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/me" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '{id, email, handle, img_url}'
```
---
16. Get Team Members
List all members of a team. Replace with your team ID:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/teams//members" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.members[] | {id, email: .user.email, handle: .user.handle, role}'
```
---
17. Get Component Sets
Get component sets (variants) in a file. Replace with your file key:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/files//component_sets" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.meta.component_sets[] | {key, name, description}'
```
---
18. Search Files
Search for files in a team (requires team ID). Replace with your team ID and with your search term:
```bash
bash -c 'curl -s -X GET "https://api.figma.com/v1/teams//files?name=" -H "X-Figma-Token: ${FIGMA_API_TOKEN}"' | jq '.files[] | {key, name, last_modified}'
```
---