UI testing is slow, resource intensive and expensive to maintain. Whenever the UI changes, Page Object Models need to be maintained and tests need to be adapted to keep up. Tests can be well written with good locators to make things easier, and there are AI tools available for POMs, so there are ways around it.
What I found is that API tests are faster, less resource intensive and require less maintenance. These tests can be built into the CI/CD pipeline and inform the team immidiately that something went wrong after a deployment, or even fail a build when a test does not pass. They test the underlying functionality regardless of what the UI looks like, and is agnostic of the device used to run the software. With the DevOps movement and the demand for quick delivery as well as the vast amount of devices and browsers available, much more can be tested with APIs than on UI tests. It does depend on the system architecture though. Stateless microservices work much better with API tests than Monolithic systems.