Skip to main content
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. READ MORE

Alert API key owners about the API key expiration within x days

No ratings
Showing results for 
Search instead for 
Did you mean: 

Alert API key owners about the API key expiration within x days

Last Update:

Sep 13, 2022 8:17:31 AM

Updated By:


Created date:

Sep 9, 2022 2:38:55 AM

This article contains additional information on the "Alerts API key owners about API key expiring within x days" template. You can find this template in the template picker when creating new automation.

This template will send an alert email to API key owners with a list of API keys that are expiring within x days or that have expired or been revoked. It can also alert all tenant admins via email with a list of API keys that have been orphaned by the deletion of their owner's account.

For example, if we want to know the API keys that are expired/have been revoked and are expiring within 10 days, we can use this template which retrieves the information and sends an email to the respective users/tenant admins.

Steps to set up the values in the template:

  1. Set the value for the variable APIKeyExpiresWithinDays which specifies the API keys that will be expiring or have expired/have been revoked for 'x' num of days. Where x is a number set in this variable.
  2. Set the value for the variable EmailTenantAdmins which allows to Email all tenant admins the list of API keys orphaned by the deletion of their owner's account. The value can be Yes/No.

Automation structure

  1. Retrieve all the users using the List Users block and store them in the variable.
  2. Retrieve all the API keys using the Raw API List Request block and store them in the variable named API keys.
  3. Loop over each API key in the APIKeys object and check if the API key is expiring within the set number of days ("APIKeyExpiresWithinDays").
  4. If the API keys are found, then store them in the variable UserAPIKeys.
    • Retrieve the tenant information using the Get Current Tenant Info block and store the tenant URL in the tenantURL variable.
    • Loop over the UserAPIKeys and check if the user is tenantAdmin and pick the username and user email of the API key owner to send an email.
  5. Construct the email body using the above information and send an email to the owner of the API key.

Below is the image of the email received.



Labels (2)
Version history
Last update:
‎2022-09-13 08:17 AM
Updated by: