Init + complete flow code for API