provider Files GET
/v1/images/{file_key} @utdk/figma
/v1/images/{file_key} Render images of file nodes
Renders images from a file.
If no error occurs, `"images"` will be populated with a map from node IDs to URLs of the rendered images, and `"status"` will be omitted. The image assets will expire after 30 days. Images up to 32 megapixels can be exported. Any images that are larger will be scaled down.
Important: the image map may contain values that are `null`. This indicates that rendering of that specific node has failed. This may be due to the node id not existing, or other reasons such has the node having no renderable components. It is guaranteed that any node that was requested for rendering will be represented in this map whether or not the render succeeded.
To render multiple images from the same file, use the `ids` query parameter to specify multiple node ids.
```
GET /v1/images/:key?ids=1:2,1:3,1:4
```
- file_key path required
- File to export images from. This can be a file key or branch key. Use `GET /v1/files/:key` with the `branch_data` query param to get the branch key.
- string
- ids query required
- A comma separated list of node IDs to render.
- string
- version query
- A specific version ID to get. Omitting this will get the current version of the file.
- string
- scale query
- A number between 0.01 and 4, the image scaling factor.
- number
- format query
- A string enum for the image output format.
- enum: jpg, png, svg, pdf
- svg_outline_text query
- Whether text elements are rendered as outlines (vector paths) or as `<text>` elements in SVGs. Rendering text elements as outlines guarantees that the text looks exactly the same in the SVG as it does in the browser/inside Figma. Exporting as `<text>` allows text to be selectable inside SVGs and generally makes the SVG easier to read. However, this relies on the browser's rendering engine which can vary between browsers and/or operating systems. As such, visual accuracy is not guaranteed as the result could look different than in Figma.
- boolean
- svg_include_id query
- Whether to include id attributes for all SVG elements. Adds the layer name to the `id` attribute of an svg element.
- boolean
- svg_include_node_id query
- Whether to include node id attributes for all SVG elements. Adds the node id to a `data-node-id` attribute of an svg element.
- boolean
- svg_simplify_stroke query
- Whether to simplify inside/outside strokes and use stroke attribute if possible instead of `<mask>`.
- boolean
- contents_only query
- Whether content that overlaps the node should be excluded from rendering. Passing false (i.e., rendering overlaps) may increase processing time, since more of the document must be included in rendering.
- boolean
- use_absolute_bounds query
- Use the full dimensions of the node regardless of whether or not it is cropped or the space around it is empty. Use this to export text nodes without cropping.
- boolean
Try it
Authentication
Configure credentials for Figma API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.
Saved automatically to browser storage.
Code snippet
Updates live as you fill in the form above.
TypeScript
import figma from '@utdk/figma';
await figma.getimages({
"format": "png",
"svg_outline_text": true,
"svg_include_id": false,
"svg_include_node_id": false,
"svg_simplify_stroke": true,
"contents_only": true,
"use_absolute_bounds": false
})