Erratic API response when GETing variables

Hey there. We are building out our design system token layer and are using the REST API to push collections, collectionModes and variables to our Figma file.

We are seeing some unexpected results where running the same script has different results.

Fetching the list of modes in the Figma file sometimes returns an old, out-of-date response that includes modes that were in the file at some stage, but are not currently in the file.

The file in question was moved from one workspace to another. Our suspicion is that the “old response” we are occasionally getting back from the API is the state of the file before it was moved. Does this sound like a possible bug? Is there anything we can do on our end to debug this further?


Seeing the same issue or similar issue. The Variable Rest API returns existing collections as well as old collections that were renamed.