how to build api