Export blockly code into some text file

Hi, I’m planning a project where I need to be able to export code written in blockly code into some readable format and send it to a server, where I’d then process and run it there. I’ve looked through the docs, and can’t seem to find an API that can do that. May I know if this is possible, and how can I proceed?