primitree export
Download local variables JSON from the Figma Variables REST API.
primitree export [options]Figma limits the Variables REST API to Enterprise organizations. The request needs file_variables:read and access to the file.
Usage
export FIGMA_TOKEN=figd_...
export FIGMA_FILE_KEY=your-file-key
primitree export --out variables.jsonPass the file key while keeping the token in the environment:
primitree export --file-key "$FIGMA_FILE_KEY" --out variables.json
primitree export --fileKey "$FIGMA_FILE_KEY" --out variables.jsonUse --file-key in new scripts. --fileKey remains as a compatibility alias.
Options
| Option | Description |
|---|---|
--file-key <key> | Figma file key (or set FIGMA_FILE_KEY) |
--fileKey <key> | Compatibility alias for --file-key |
--out <path> | Output path (defaults to figma-variables.json) |
After export
primitree build variables.json
primitree diff previous.json variables.jsonThe Primitree export plugin reads local variables from the open file without calling the Variables REST API.