Api core

Refactor all the API calls from being in one giant index.js to each having its own separate file under lib/api/