Skip to main content
Question

Library API script file key error

  • February 6, 2026
  • 2 replies
  • 35 views

Aguiar_Leonardo_extern

Hello,

 

I am trying to run the script offered in Figma's Youtube video and Github page for getting data from the Library API but I am running into an error.

 

These are the video and script that I am attempting to use:

https://github.com/figma-sa/figma-library-analytics-api-example

 

The error I am getting is the following:

line 160, in variable_actions_by_team

    url     = base_url + file_key + params

              ~~~~~~~~~^~~~~~~~~~

TypeError: can only concatenate str (not "NoneType") to str

 

I have tried placing the file key in double quotes, in single quotes and without any quotes characters. Without quotes I get a not defined error for it.

 

Thank you for any help and your time.

2 replies

Aguiar_Leonardo_extern

Fixed the error. It was due to not having a .env file in the script's directory. By creating a .env file and placing the access token and file key variables in it the previous error was resolved.

Now I have got a new error:  File "…/extract-library-data.py", line 44, in component_actions_by_component     normalisedRows = pd.json_normalize(json_data['rows'], meta=['week', 'component_key', 'component_name', 'detachments','insertions'])                                        ~~~~~~~~~^^^^^^^^ KeyError: 'rows'

 

Currently trying to solve it with the help of Claude. If anyone has encountered this also and was able to solve it please share your solution. Thank for your help and time.


Aguiar_Leonardo_extern

Figured it out, don't have the Enterprise plan which grants access to Library Analytics API data.