How to Modify Files using the Rest API?

I am trying to use the Figma REST API to modify text in a document. For example if a user writes {{title}} my plugin can find it and modify it to create an SVG. This would be simple since it’s in the JSON that’s returned but I have no way of converting Figma REST API JSON to an image.