edited api function