What is an API, exactly?
APIs are triggered by requests, whether you're sending or requesting data.
You could have an API that Creates, Reads, Updates, or Deletes data based on a request. For API, the demand begets a response.
Although real-time is possible with API, it requires an extra configuration from a web developer, making webhooks the most suitable mechanism for real-time information.