Glossary

What Is an Expected Status Code?

The HTTP status code a monitor treats as healthy — anything else marks the check as down.

Definition

The expected status code is the HTTP response code your monitor considers a success. Most healthy endpoints return 200 (OK), but some health checks return 204 (No Content) or other codes. Whatever you set, a response that doesn't match marks the check as failed.

Setting this correctly is what makes "up" mean genuinely working. Without it, a monitor might accept any response — including 500 errors or redirects — as healthy, defeating the purpose of monitoring.

Why It Matters

The expected status code is how monitoring distinguishes a working endpoint from a broken one. An endpoint returning 500 is down for users; if your monitor accepts it as fine, you'll never get alerted. Matching the expected code to your endpoint's real healthy response makes alerts trustworthy.

How It Works

You configure the code (or codes) that count as healthy for each monitor. On every check, the monitor compares the actual response code to the expected one: a match passes, a mismatch fails. This runs after the response arrives within the timeout, so both timing and correctness are validated.

Real-World Example

A health endpoint returns 204 No Content when healthy. The team sets the expected status code to 204. Later a bug makes it return 500; because 500 ≠ 204, the check fails and alerts fire — exactly the behavior you want.

Best Practices

  • Set the expected code to match what your endpoint returns when healthy
  • Use 200 for most pages and APIs, 204 for empty health responses
  • Don't accept broad ranges that would let error codes pass
  • Update the expected code if your endpoint's healthy response changes
  • Pair status-code checks with response-time thresholds for full coverage

Common Mistakes

  • Leaving the expected code so loose that 500s count as healthy
  • Expecting 200 from an endpoint that returns 204 or a redirect
  • Treating redirects (3xx) as success when they shouldn't be
  • Not updating the expected code after changing the endpoint
  • Relying on status code alone without checking response time

In Monitoristic

In Monitoristic you set the expected status code per monitor (for example 200 or 204). Any other code marks the check as down, so your alerts reflect real failures rather than just whether something responded.

Frequently Asked Questions

What status code should a healthy endpoint return?
Usually 200 OK. Some health endpoints return 204 No Content. Set your monitor's expected code to match whatever your endpoint returns when healthy.
Why set an expected status code?
So the monitor treats only a genuinely healthy response as success. Without it, error codes like 500 could be accepted as 'up'.
Should redirects count as healthy?
Usually not, unless a redirect is the intended healthy response. Accepting all 3xx codes can mask misconfigurations.
Can I expect more than one code?
Some tools let you accept a set of codes. Keep it tight — only include codes that genuinely represent a healthy endpoint.

Get started today

Your Sites Deserve Better Monitoring.

Create monitors, connect alerts, and share status pages with your customers. Plans from $5/month.