migrate fns to api