Though both Scratch and Snap are open source, I can't see any documentation for building on top of either of them. If you're interested in building something in this space, Blockly [1] is essentially the same and has some great docs for working with it (no affiliation).