refactor api front-end