Refactor api methods to take Config objects