How to monitor an API that needs a login, with multi-step checks
Chain requests in one monitor: log in, save the access token, and use it to call the endpoints that matter, with JSON assertions on every step.
· 5 min read · By the Spot Downtime team
Many APIs don't take a fixed key. You log in first, get a short-lived access token, and send it with every request after that. A single-request monitor can't do that: any token you paste in expires within the hour. Multi-step API checks can. They run a short sequence of requests, carry values from one response into the next, and check each step along the way.
The example
We'll monitor this flow, which is typical of OAuth-style and session-based APIs:
POST /v1/auth/tokenwith a username and password, which returns an access token.GET /v1/orders?limit=5with that token, which should return a non-empty list.
1POST /v1/auth/token
- Status is 200200
- data.access_token exists
2GET /v1/orders?limit=5
Authorization: Bearer {{token}}
- Status is 200200
- data.orders.length greater than 0got 5
The login response looks like this:
{
"data": {
"access_token": "eyJhbGciOi…",
"expires_in": 3600
}
}Use a dedicated account
Step 1: set up the login request
- Open Monitors, click Add monitor and choose API.
- Set Method to
POSTand URL tohttps://api.example.com/v1/auth/token. - Under Headers, add
Content-Type: application/json. - In Body, add the credentials:json
{"username": "uptime-monitor", "password": "…"} - Set Expected status to
200. - Add a JSON assertion:
data.access_tokenexists. If login breaks, the check fails here with a clear reason.
Step 2: add the next step
Under More steps, add a step. Once there's a step, Save values for later steps appears on the first request. Save data.access_token as token.
Then fill in the new step:
- Method
GET, URLhttps://api.example.com/v1/orders?limit=5 - Headers:
Authorization: Bearer {{token}} - Expected status:
200 - Assertion:
data.orders.lengthgreater than0
On every check, {{token}} is replaced with the token from that check's login, so it never goes stale. You can use saved values in a step's URL, headers and body, and each step can save values of its own for the steps after it.
Step 3: save and watch the first run
Choose Check every and click Add monitor. The first check runs within a few seconds. If a step fails, the monitor shows which one and why: an unexpected status, a failed assertion, or a value that couldn't be found.
Assertions you can use on each step
| Operator | Example | Catches |
|---|---|---|
| equals | status equals ok | A health check that reports a problem |
| does not equal | data.state does not equal maintenance | A service stuck in maintenance mode |
| contains | data.region contains eu | Traffic routed to the wrong region |
| greater than | data.orders.length greater than 0 | Empty results from a broken query |
| less than | data.queue_depth less than 1000 | Workers falling behind |
| exists | data.access_token exists | A login that silently stopped returning a token |
| does not exist | error does not exist | Errors wrapped in a 200 response |
Other flows worth a multi-step check
- Create, read, delete.
POSTa test record, save itsid,GETit back, thenDELETEit. Proves writes work end to end. Use a test account so it never touches real data. - Search then fetch. Search for a known product, save the first result's ID, and load its detail page.
- API key exchange. Swap a long-lived key for a short-lived token, then call a protected endpoint.
A monitor can have up to five steps after the first request. Keep flows short: each extra step is another thing that can be slow.
Watch the total time too
A login that takes three seconds hurts every user, not just your monitor. Turn on Alert when it's slow to get a warning when responses creep up; tracking API response times explains how to pick a threshold.
More in this series
Get new guides by email
Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.
Keep reading
- How-to · Monitoring · APIsHow to configure gRPC health checkingLearn how to implement and configure gRPC health checking for reliable service discovery and load balancing: server status, Kubernetes probes, client-side health checks, Envoy, cloud load balancers and Consul.November 7, 2026 · 7 min read
- How-to · APIs · MonitoringHow to monitor an LLM API (OpenAI, Anthropic, Gemini) in Spot DowntimeA step-by-step guide to LLM API monitoring: use a separate key, pick the model, set the prompt and time limit, and keep the cost of checks to a fraction of a cent.November 2, 2026 · 5 min read