Add programmatic API

Detail are in the doc. 

@arikon @scf2k 
does not exist