Add API class and test, together with doc.