add sample code and api