Skip to main content

Hi. I’m trying to create script, which will upload images from local pc storage to Figma file. I do it through token, but get error 403 “Invalid Token”. The token is taken from account - settings - security. It is correctly written, the token account and file account is one and mine. May be the issue with scopes, but how to check it… while generating token I extended all rights that I could. There’s simple checking code with similar error, may be someone can direct me:

import requests


TOKEN = “personal token”

FILE_KEY = “the string between “design” and /name of file”

HEADERS = {“Authorization”: f"Bearer {TOKEN}"}


url = f"https://api.figma.com/v1/files/{FILE_KEY}"

response = requests.get(url, headers=HEADERS)


if response.status_code == 200:

print(“OK”)

elif response.status_code == 403:

print(“Error 403: Invalid token.”)

elif response.status_code == 401:

print(“Error 401”)

else:

print(f"Error {response.status_code}: {response.text}")

Be the first to reply!

Reply