As stated earlier, SERP APIs are web scrapers. In the past, the act of web scraping is seen as a grey area, with some saying it is legal while others think otherwise.
However, the lawsuit against HiQ Labs by LinkedIn in a US court has seen HiQ Labs victorious as the court sees the act of HiQ Labs scraping LinkedIn as legal since the data is publicly available and not hidden behind a password or paywall. Since SERPs are publicly available, then scraping them is legal.