Overview
Try the API
Test Figma REST API endpoints from your terminal with these ready-to-use examples.
This page provides copy-paste examples for every major API endpoint group. Replace the placeholder values, run the command, and inspect the response.
Before You Start
Get a personal access token
Go to Figma Account Settings and create a personal access token. Select the file_content:read scope at minimum.
Find your file key
Open any Figma file in your browser. The file key is the string between /design/ (or /file/) and the file name in the URL.
All examples below assume you have exported FIGMA_TOKEN and FILE_KEY as environment variables. If you prefer, replace $FIGMA_TOKEN and $FILE_KEY inline.
Verify Authentication
Start by confirming your token works. This endpoint requires no parameters.
Expected response:
{
"id": "12345",
"handle": "your-username",
"email": "you@example.com",
"img_url": "https://s3-alpha.figma.com/img/..."
}
Files
Get a file tree
Retrieve the document structure. Use depth=1 to get only page-level data and keep the response small.
Get specific nodes
Fetch only the nodes you need by passing comma-separated node IDs. This is much faster than downloading the full file.
Images
Export nodes as images
Render specific nodes as PNG, SVG, JPG, or PDF. You need node IDs — get them from the file tree response above.
Get all image fills
List download URLs for every image used as a fill in the file.
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/images" | python3 -m json.tool
Comments
List comments on a file
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/comments" | python3 -m json.tool
Post a comment
Delete a comment
curl -X DELETE -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/comments/COMMENT_ID"
Components and Styles
List components
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/components" | python3 -m json.tool
List styles
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/styles" | python3 -m json.tool
Variables
Get local variables
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v1/files/$FILE_KEY/variables/local" | python3 -m json.tool
Create a variable
Webhooks
Create a webhook
List webhooks for a team
curl -s -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v2/webhooks/YOUR_TEAM_ID" | python3 -m json.tool
Delete a webhook
curl -X DELETE -H "X-Figma-Token: $FIGMA_TOKEN" \
"https://api.figma.com/v2/webhooks/WEBHOOK_ID"
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
403 Forbidden | Invalid or expired token | Generate a new token in Figma settings |
403 Forbidden on specific endpoint | Token missing a required scope | Regenerate the token with the correct scopes |
404 Not Found | Wrong file key or node ID | Double-check the value from your Figma URL |
429 Too Many Requests | Rate limit exceeded | Wait for the Retry-After duration, then retry |
Empty images object | Node IDs do not exist in the file | Verify node IDs using the Get File endpoint first |