added API doc and example