Get file with the Figma API
Returns the document tree of a file: pages, frames and layers with their properties and ids, plus the components and styles the file uses. The tree of a large file is huge: pass depth 1 for the pages only, or 2 for the top-level frames of each page, then read a frame with Get file nodes. Figma puts this call in its smallest rate limit tier: files in a Starter plan, and users with a View or Collab seat, get only up to 20 calls a month.
- Identifier
- figma_get_file
The request
POST https://connect.reportei.com/api/tools/figma_get_file/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json
{
"customer_toolkit": "<connection UUID>",
"arguments": {
"file_key": "<file_key>"
}
}Your system sends your customer's connection id and the tool arguments. The headers are the same as the rest of the Connect API: your product's token and your customer's token.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_key | string | Yes | Key of the file: the part after /design/, /file/ or /board/ in the URL of the file in Figma. The key of a branch also works. |
| depth | integer | No | How deep to go into the tree, counted from the document: 1 returns the pages, 2 the pages and their top-level frames. Omit it to return every layer. |
| ids | string | No | Comma-separated node ids, like 1:2,1:3, to return only those nodes, their children and the path to them. A node id is the node-id of a Figma link with the hyphen changed to a colon (node-id=1-2 is 1:2), or an id returned by Get file. |
| version | string | No | Id of a version from List file versions, to read the file as it was then. Omit it for the current version. |
| branch_data | boolean | No | Also returns the branches of the file with their keys, which the other tools accept as file_key. The default is false. |
Supported connections
Your customer connects their Figma account once, with one of the modes below. The same connection serves every tool of the toolkit.
OAuth with your product's app
You register your product's OAuth app once, with POST /api/merchants/credentials/figma, and your customer authorizes the account on a consent screen. Connect renews the token when it is about to expire.
The response
On success, Connect preserves the app's response status and body. HTTP errors returned by the app use the {error, api_error} envelope; authentication or validation can fail before execution. The X-Toolkit-Execution-Id header identifies the recorded execution, available at GET /api/tools/executions/{uuid}.
Ready for AI agents
This tool's input is a JSON Schema, available at GET /api/tools/figma_get_file. It becomes your agent's tool definition with no conversion.
Other Figma tools
- Get file metadataGETReturns the metadata of a file without its content: name, folder, editor type (Figma Design, FigJam, Slides and others), creator, who changed it last and when, thumbnail, the role of the user and the link access. Much cheaper than Get file in the Figma rate limits, so use it first when the question is about the file and not its layers.
- Get file nodesGETReturns the given frames or layers of a file, each with its whole subtree, under nodes, plus the name, version and last change of the file. A node that does not exist comes back as null. It is the light way to read one frame of a large file. Figma puts this call in its smallest rate limit tier: files in a Starter plan, and users with a View or Collab seat, get only up to 20 calls a month.
- Render imagesGETRenders frames or layers of a file as images and returns, in images, a map from each node id to a temporary URL of the image, valid for 30 days. A null value means that node could not be rendered. Images above 32 megapixels are scaled down. Figma puts this call in its smallest rate limit tier: files in a Starter plan, and users with a View or Collab seat, get only up to 20 calls a month.
- List file versionsGETLists the version history of a file, newest first: id, creation date, author, and the label and description of named versions. To read older versions, pass as before the before value of the pagination.next_page link; the history ends when next_page is missing.
- List commentsGETLists all the comments of a file, replies included. Each comment has id, message, author, created_at, resolved_at when it was resolved, its position in client_meta and the reactions. A reply carries the id of its root comment in parent_id.
- Create commentPOSTPosts a comment on a file as the connected user and returns it, or a reply when comment_id is sent. Without client_meta the comment is not pinned to a spot of the canvas. A posted comment cannot be edited, only deleted with Delete comment.
- Delete commentDELETEDeletes a comment of a file. Figma only lets the author delete a comment, so it works on the comments made by the connected user.
- List file componentsGETLists the components published from a library file: key, name, description, node_id, thumbnail, dates, author and the frame and page that contain each one. Components that were never published do not appear.
See Connect applied to your product.
Try it for 15 days with no card, or walk our team through your use case.
