Drop a .fig file or Figma JSON anywhere on this page, or paste JSON, and get a pen.dev document (schema 2.21) with frames, auto-layout, components, instances and variables carried across.
From the REST API, with a personal access token. Include geometry=paths so icons and vectors convert as real paths.
curl -H "X-Figma-Token: $FIGMA_TOKEN" \ "https://api.figma.com/v1/files/FILE_KEY?geometry=paths" \ -o figma.json
A .fig file (File → Save local copy in Figma) converts directly in your browser. It’s Figma’s undocumented internal format, so treat .fig import as best effort; the REST JSON or plugin export is more reliable.
Variables come from a separate endpoint (Enterprise plans), or use the companion Figma plugin, which works on any plan and exports the selection with its variables in one file.
curl -H "X-Figma-Token: $FIGMA_TOKEN" \ "https://api.figma.com/v1/files/FILE_KEY/variables/local" \ -o variables.json
Image fills point to ./images/<imageRef>.png. Download them with GET /v1/files/FILE_KEY/images and place them beside the .pen file.