refactor api to use new spec document