Skip to main content
Solved

REST API - Get color and text styles?


Karine6

Hi all! Is there a way to get color and text styles data from the REST API? I’m using the /v1/files/:key/nodes?ids=:ids endpoint, and the response on nodes > [node id] > styles returns all color and text styles but only metadata, nothing related to font family, font size, color etc. Is this expected? I know that I can get those styles if I look for an specific element that is assigned to those styles, but that won’t always be the case, for example, if I have 10 text styles but only 5 are being used on a file, I’d still want info from all of them. I also tried using /v1/styles/:key but for some reason it always returns 404, and by looking at the documentation, it also only returns metadata and not the actual styling information. On the Plugin API I can just use figma.getLocalPaintStyles() and figma.getLocalTextStyles(), so is there something similar to this on the REST API?

Best answer by tank666

View original
This topic has been closed for replies.

3 replies

tank666
  • 4873 replies
  • Answer
  • July 26, 2023

Karine6
  • Author
  • 1 reply
  • July 26, 2023

Thank you, that totally works! I was under the impression that the “ids” query param was only for the “node-id” from the file URL, now it all makes sense. 😀


  • 5 replies
  • July 3, 2024

@tank666 thanks for the suggestion. Do you know why we have to go through this endpoint? It’s seems a bit hacky since it returns styles as “emulated primitive nodes” (lot of default properties here).

Why can’t we use directly /v1/styles/:key? I’m also having a 404 errors.


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