Skip to main content
Question

Connecting API python-script with Figma file problem

  • December 17, 2024
  • 0 replies
  • 72 views

Erick10

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}")

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings