adding api to need + general fns for apis (DRY)