Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrate Spike with APImetrics

Send APImetrics alerts to Spike so a failing or slow API call alerts your on-call team by phone, SMS, Slack or Teams, and resolves when the call passes.

APImetrics monitors your APIs by calling them on a schedule from locations around the world. When a call fails, runs slow or breaks a warning threshold, APImetrics can send a webhook. Point that webhook at a Spike integration URL and the failing call pages your on-call rotation, repeat failures of the same call land on the incident already open, and the incident resolves itself when the call passes again.

Prerequisites

  • An APImetrics account that can create alert actions

  • An APImetrics integration in Spike and its webhook URL

Step 1 — Create the integration in Spike

In Spike, go to Integrations → Add integration → APImetrics, attach it to a service and an escalation policy, and copy the webhook URL. It looks like https://hooks.spike.sh/<your-token>/push-events.

Create integration and service on our dashboard

Step 2 — Add a Generic webhook action in APImetrics

  1. Sign in to APImetrics, open your project and choose Alerts & Webhooks in the left-hand navigation.

  2. Click + Add new action.

  3. Set Type to Generic and give the action a name, for example Spike.

  4. Toggle on the triggers Fail, Warning, Slow and Pass. Pass is what resolves the incident, so keep it on.

  5. Optionally use Include tags and Exclude tags to limit which API calls page Spike, and set Only alert after this many failures in a row (0 alerts on every result).

  6. Paste the Spike webhook URL from Step 1 into the URL field. Leave HTTP Headers empty and Authentication at None.

  7. Make sure the Enabled toggle is on, and click Save.

What APImetrics sends

APImetrics posts this JSON body when an API call fails. Spike reads call_id, result_class, result and context._notification; the other fields are kept on the incident.

Required and optional fields

Field
Required
Used for

call_id

Yes

Identifies the monitored API call. It is the same on every run, so repeat failures join one incident and a pass resolves it

result_class

Yes

PASS resolves the incident (OK, RESOLVED, CLOSED and CLEARED count as a pass too, in any case). Any other value, such as FAIL, WARNING or SLOW, opens or updates an incident. The class is added to the end of the title

context._notification.description

Recommended

APImetrics' own sentence about what is wrong. It becomes the incident title

context._notification.title

Recommended

The title when call_id is missing, and the call name when the description has no link

result

Optional

A machine code such as DOWNLOAD_ERROR, used in the title only when the description has no text

Every other field (result_id, location_id, result_url, call_url, response_time, response_size, context._result_category, context._result_streak) is stored with the incident and not read for the title.

Recovery

When the call passes, APImetrics sends the same shape with result_class set to PASS. It may arrive without context._notification:

Incident title

The title is APImetrics' own sentence about the fault: the lead line of context._notification.description, its first finding, its last finding when that is different, and the result class. HTML, links and the "View details here" sign-off are removed:

Titles are capped at 200 characters by shortening the findings; the call name and the class are always kept. If the description has no list, its whole text is used. If it has no text at all, the title falls back to the result code and call name, for example DOWNLOAD_ERROR on API Call "APImetrics: All Failures: Checkout - Create order" (FAIL), where the call name comes from the notification title.

If call_id is missing, the title is the plain notification title, for example APImetrics: All Failures: Checkout - Create order, and Spike matches repeats and recoveries by that title. A pass is titled API Call "<call name>" is passing again (PASS), or APImetrics API call is passing again (PASS) when the pass carries no notification.

Use a Title Remapper if you prefer a different format.

Auto resolve

An incident is matched by call_id. Repeat failures of the same call join the open incident instead of paging again, and a PASS for that call_id resolves it. A pass with no matching open incident is dropped.

Without a call_id, a pass resolves the incident only when it carries the same context._notification.title as the failure that opened it; a pass without a notification title cannot be matched and leaves the incident for you to resolve.

Last updated