Create the register api function