Integrating API Monitoring with PagerDuty

PagerDuty is a widely-used online incident management platform that “helps orchestrate the ideal response to create better customer, employee, and business value.” When something goes wrong, that incident can be logged in PagerDuty, and all team members who are responsible for monitoring that system will be notified about the issue.

If your business relies on APIs (internal or external) and your customers expect near permanent uptime for your product, then your team needs to know when critical APIs fail. Integrating PagerDuty with your API Science monitoring services can help ensure that the team members who are responsible for maintaining your internal APIs, and maintaining code that responds to external API outages, are always informed.

The first step is to add a PagerDuty contact to your API Science account. From your API Science Dashboard, click your account name in the upper right corner, then select “Settings” on the pull-down menu:


Your settings page is displayed. Under the “Account” tab, click “Contact Book” and click the “New Contact” button:


The “Create Contact” dialog appears. Select “PagerDuty” in the pull-down menu:


Before the contact can be created, a PagerDuty “Integration key” must be obtained from your PagerDuty account.

Obtaining Your PagerDuty Key

To obtain your PagerDuty key, log into your PagerDuty account and click the “Configuration” tab:


Clicking “API Access” on the “Configuration” tab pull-down menu brings you to the “API Access Keys” page, which enables you to create an API key for integration with your API Science account:


Click “Create New API Key” to generate the key for PagerDuty integration with your API Science account. On the screen that follows, enter a description for your PagerDuty API key, and click the “Create Key” button:


You are brought to a page that shows you the newly-created API key, for example:


Now, access to the PagerDuty API is possible from your API Science account. Copy the PagerDuty API Key text, return to your API Science “Create Contact” dialog, and past the key into “Integration key” field:


You may enter a label for the contact. Clicking “Create Contact” enables your PagerDuty account to be contacted when one of your API Science monitors sends an alert due to an API check failure (or a return to service).

To send API Science notifications to PagerDuty, select one of your API Science monitors. Scroll to the bottom of the API monitor summary page and click “Add Rule”; then, add your PagerDuty contact to the “Alerts Rules” list:


Click the “Add Rule” button, and your PagerDuty account will be notified whenever a validation for this API monitor fails.

After an API check fails, PagerDuty will report (for example):


You can configure your PagerDuty account such that these reports will be forwarded to your entire API monitoring team via phone calls, email, SMS text messages, or mobile app push notifications.

–Kevin Farnham