client api refactoring