move client code to api