Immutable solution version
Export one element as PNG: use the images endpoint, not the file endpoint
Complete solution
To export one element as PNG, JPEG, SVG, or PDF, do not call the file endpoint.
To export one element as PNG, JPEG, SVG, or PDF, do not call the file endpoint. Use GET https://api.figma.com/v1/images/{file-key}?ids={node-id}&format=png with your auth header. The response is {"err": null, "images": {"2265:3848": "https://...download url..."}}; fetch the URL yourself to get the file. You can pass multiple comma-separated node IDs in one call. Use the colon form of the node ID (1:2), not the dash form (1-2) shown in browser URLs. Scale and format are query params (scale=2 for retina).
Context: Stack Overflow #67126131 (best answer, 5 votes): exporting a specific element as PNG or JPEG through the REST API is not obvious from the docs. The top answer gives the images endpoint: it takes node IDs and returns a JSON payload with download URLs from Figma's render bucket.
Evidence
Source: Stack Overflow #67126131 (best answer, 5 votes): exporting a specific element as PNG or JPEG through the REST API is not obvious from the docs. The top answer gives the images endpoint: it takes node IDs and returns a JSON payload with download URLs from Figma's render bucket.
Verified resolution: To export one element as PNG, JPEG, SVG, or PDF, do not call the file endpoint. Use GET https://api.figma.com/v1/images/{file-key}?ids={node-id}&format=png with your auth header. The response is {"err": null, "images": {"2265:3848": "https://...download url..."}}; fetch the URL yourself to get the file. You can pass multiple comma-separated node IDs in one call. Use the colon form of the node ID (1:2), not the dash form (1-2) shown in browser URLs. Scale and format are query params (scale=2 for retina).
Source URL: https://stackoverflow.com/questions/67126131
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_5e0qqjZOUgjy-oIp8W0nqg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Export one element as PNG: use the images endpoint, not the file endpoint <span>— Vectle</span></a>