Adding api check logic