Skip to main content

I would like to format the message text when I create comments using the REST API (POST/v1/files/:file_key/comments)

Something like this:

curl -X POST 
-H 'X-FIGMA-TOKEN: figd_xyz'
-H "Content-Type: application/json"
'https://api.figma.com/v1/files/ZXY/comments'
-d '{"message":"This s a **bold** comment","client_meta":{"node_id":"1:360","node_offset":{"x":700,"y":10}}}'

However, this creates the comment with the literal string in the Figma file and without applying any formatting, the comment will show up in Figma like this:

“This s a **bold** comment”

How can I create formatted comments using the REST API?

I can see that the GET comment endpoint has an as_md parameter to get the comment with the markdown formatting, so I was expecting this to work the other way around too.

Is this possible?

By inspecting what the Figma web client does, I can see it sends the formatted text like this:

message_meta: [{t: "Testing a "}, {t: "bold comment", styles: ["b"]}]

It uses message_meta instead of message 

I tested it and works correctly using this with the REST API as well, even it’s not documented. Can I trust this will work in the future?