defining api