Added support for api key for scheduled tasks