added condtition for api call