Moving api related things to api files