Inside web api there is no way to get what you want. In any case, Web Apis should be stateless.
Theoretically, you can create a long-term task on your web server to periodically call your Api (or method directly), the best place to put such a method would be the OnStart method in your global asax file. However, this method is started when the web server is loaded into the application domain, and the task will be destroyed when the web server decides to unload your application. Therefore, if you do not call your web server at least once, your task will not be launched. And if your web server does not access periodically, your task will be killed.
Having an external reliable resource, such as your service, is still the best and safest.
source share