Include "scoping" settings on API response

I’m writing a script to transform Figma Variables into design tokens, and I need to differentiate between different types of tokens.

The API is returning me this structure for the variables:

"VariableID:209:1372": {
  "id": "VariableID:209:1372",
  "name": "spacing-xs",
  "remote": false,
  "key": "490e2217721624da15c389ac089a09b2cfc8ffe4",
  "variableCollectionId": "VariableCollectionId:209:1371",
  "resolvedType": "FLOAT",
  "valuesByMode": { "209:3": 8, "209:4": 16, "209:5": 2 }

The “resolvedTokenType” field is useful, but only to an extent. The numeric variables can represent many different things: border radius, spacing, sizing, etc. I would like to be able to identify the intended use of the variable from the meta data associated with it.

One very useful piece of information would be the “scoping” of the variable:


This would help me narrow down the specificity of the token, but I can’t seem to find it on the response from the API. I’m using the GET /v1/files/:file_key/variables/local ¿is there other endpoint I can use to get that data?

If not, it would be great for the next version of the API to have the “scoping” of the variable to give that extra bit of information for the applications reading this data.

1 Like

Hi Daniel, we definitely plant to add scoping information to the GET /v1/files/:file_key/variables/local endpoint.