Variables
Get Variables
List all local variables and variable collections in a Figma file.
Returns all local variables and their collections defined in a file. This is essential for design token extraction and sync workflows.
GET https://api.figma.com/v1/files/:file_key/variables/local
Authentication
Requires a valid access token with file_content:read scope. Pass via X-Figma-Token header (personal access token) or Authorization: Bearer header (OAuth).
Parameters
Path parameters
The key of the file to retrieve variables from.
Example Request
Response
{
"meta": {
"variables": {
"VariableID:1:1": {
"id": "VariableID:1:1",
"name": "brand/primary",
"key": "abc123",
"variableCollectionId": "VariableCollectionId:1:0",
"resolvedType": "COLOR",
"valuesByMode": {
"1:0": { "r": 0.635, "g": 0.349, "b": 1.0, "a": 1.0 },
"1:1": { "r": 0.4, "g": 0.2, "b": 0.8, "a": 1.0 }
},
"scopes": ["ALL_SCOPES"],
"description": "Primary brand color"
}
},
"variableCollections": {
"VariableCollectionId:1:0": {
"id": "VariableCollectionId:1:0",
"name": "Brand Colors",
"key": "def456",
"modes": [
{ "modeId": "1:0", "name": "Light" },
{ "modeId": "1:1", "name": "Dark" }
],
"defaultModeId": "1:0",
"variableIds": ["VariableID:1:1"]
}
}
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
meta.variables | object | Map of variable IDs to variable objects |
meta.variables[id].id | string | Unique variable identifier |
meta.variables[id].name | string | Variable name (uses / for grouping) |
meta.variables[id].key | string | Stable key for cross-file references |
meta.variables[id].variableCollectionId | string | The collection this variable belongs to |
meta.variables[id].resolvedType | string | COLOR, FLOAT, STRING, or BOOLEAN |
meta.variables[id].valuesByMode | object | Map of mode IDs to values |
meta.variableCollections | object | Map of collection IDs to collection objects |
meta.variableCollections[id].modes | array | List of modes (e.g., Light, Dark) |