Monitor the APIs your n8n workflows depend on (without alert spam)

Hear about third-party API outages before your client does. Status, latency and content checks in n8n, with consecutive-failure thresholds and transition-only alerts.

By StackSignal ·

Most n8n workflows are glue between other people's APIs: CRMs, payment providers, email platforms, AI models. When one of them degrades, your workflows start failing or, worse, start succeeding with wrong or empty data.

An error workflow will tell you about failures one run at a time. A small health monitor tells you about the dependency itself, often before your scheduled workflows even run.

What to check

A useful check has up to three conditions, not one:

  1. Status code. Is it what you expect (usually 200)?
  2. Latency. Did it answer within a budget, say 3 seconds? A slow API is often the first sign of trouble and a common cause of workflow timeouts.
  3. Content. Does the body contain something that proves it's healthy, such as "status":"ok"? A 200 response with an error page or an empty list isn't healthy.

Point checks at endpoints built for it where they exist: a provider's /health or status API, or a cheap read-only call. Avoid endpoints that cost money or create data, and avoid putting powerful credentials into a monitor. Use an unauthenticated endpoint or a read-only, low-privilege token.

Don't alert on one blip

Networks are noisy. If every single failed check pages you, you'll mute the channel within a week. Two rules fix that:

  • Consecutive-failure threshold. Mark an endpoint DOWN only after two (or three) failed checks in a row. One timeout is noise; three in fifteen minutes is a pattern.
  • Alert on transitions only. Send one message when an endpoint goes DOWN and one when it RECOVERS. While it stays down, list it in other messages rather than repeating the alert every five minutes.

That needs a little state per endpoint: current state (up/down) and the count of consecutive failures. A tiny database table is the dependable place to keep it.

Measuring latency in n8n

The HTTP Request node is great for calling APIs, but it doesn't report how long a request took. Two practical options:

  • Measure in a Code node. Record Date.now() before and after the request inside one Code node. Current n8n Code nodes can make HTTP calls through the node's built-in helpers, but check what your version allows.
  • Use the provider's own status data, if it publishes response times.

Run checks for all endpoints in parallel, so one slow endpoint doesn't delay the others.

A schedule that fits

Every 5 minutes is a good default for business-critical APIs. With a threshold of 2, you'll know within about 10 minutes of a real outage. Keep each result too (endpoint, ok, status, latency, reason). A day of history lets you report uptime and p95 latency, and see whether "slow" is new.

What to do when something is DOWN

Write this down before it happens:

  1. Check the provider's status page.
  2. Decide whether to pause workflows that write to that API, so failures don't leave half-finished state, such as a customer created in the CRM but not in billing.
  3. Don't bulk-retry failed executions until the API has RECOVERED, and only retry the ones that are safe. See which failed executions are safe to retry.

Build it or use ours

A minimal build: Schedule (5 min) → Code (list of endpoints, run checks, compute state transitions) → database upsert → IF transition → Slack. The API Health Monitor in the Reliable Automation Kit is this, finished. It covers status, latency and content checks, transition-only alerts, Postgres history, and feeds uptime and p95 latency into the kit's daily report.

Related