httpstat.us is down: a free replacement for testing HTTP status codes
For about ten years, httpstat.us was the quickest way to get a 503 or a 429 out of a real server: put the code in the URL and you got that status back. Plenty of test suites, tutorials and Stack Overflow answers still point at it. It no longer answers:
$ curl -i https://httpstat.us/503
curl: (52) Empty reply from serverIts maintainer took it offline in July 2025. In his note on GitHub he gives the reasons: 306 GB of incoming traffic in one week, production systems using its maximum timeout to schedule delays, and scammers using its redirects to hide phishing links. He wrote that he would add rate limiting and bring it back. When we checked on 23 November 2026, the host still resolved, but every request got an empty reply.
If your tests have started failing with Empty reply from server, socket hang up, ECONNRESET or RemoteDisconnected, and the URL contains httpstat.us, that is why. This post maps every httpstat.us feature to a free endpoint that works today, lists the differences that can break an assertion, and ends with test suites in JavaScript and Python. All the output below was captured on 23 November 2026.
Find every place that still calls it
Start with the repository, including config files and CI workflows:
git grep -n "httpstat.us"Also check Postman collections, .http files, mock-server configs and documentation. An old README example is harmless. A health check or retry test that quietly fails is not.
httpstat.us URLs and their replacements
The replacement is the status code API at https://api.testingapis.com/api/status/{code}. It needs no key and allows cross-origin requests from any site.
| httpstat.us | Replacement | Notes |
|---|---|---|
/200 | /api/status/200 | Any code from 200 to 599, including unofficial ones such as 599 |
/503 | /api/status/503 | Sends Retry-After: 5, so you can test that your client waits |
/429 | /api/status/429 | Also sends Retry-After: 5 |
/200?sleep=5000 | /api/status/200?delay=5 | The delay is in seconds, not milliseconds, and stops at 10 |
/random/200,503 | /api/status/random?codes=200,503 | List each code; ranges such as 500-504 are not accepted |
| Repeat a code to weight it | ?codes=200:3,503:1 | Weights instead of repeats: here, 503 about one time in four |
| A sleep longer than 10 s | /api/chaos/timeout?seconds=30 | Holds the request for up to 60 seconds, for client timeout tests |
X-HttpStatus-Response-Foo: Bar | Not supported | The response headers are fixed; see the differences below |
$ curl -i https://api.testingapis.com/api/status/503
HTTP/1.1 503 Service Unavailable
content-type: application/json; charset=utf-8
retry-after: 5
{"status":503,"statusText":"Service Unavailable","category":"server-error",
"message":"This is a 503 response. Use /api/status/{code} to request any status."}Random codes are handy for a quick look at how a client copes with failures, but a test that passes or fails by chance is a bad test. Use them for exploring, and the fixed endpoints in the next section for assertions.
$ for i in 1 2 3 4 5 6 7 8; do curl -s -o /dev/null -w "%{http_code} " \
"https://api.testingapis.com/api/status/random?codes=200:3,503:1"; done
200 200 503 200 200 200 200 200Differences that can break an assertion
| What | httpstat.us | Replacement |
|---|---|---|
| Response body | Plain text, 200 OK, unless you sent Accept: application/json | Always JSON: status, statusText, category, message |
| Delay unit and limit | Milliseconds, up to 30 seconds | Seconds, up to 10 on /api/status; up to 60 on /api/chaos/timeout |
| Random ranges | 500-504 | Each code listed: 500,501,502,503,504 |
| Custom response headers | Echoed from X-HttpStatus-Response-* request headers | Not available |
| Redirects (3xx) | Location pointed back at httpstat.us | Location: /api/echo, so a client that follows it ends on a 200 |
| 1xx codes | Listed | Not sent as a final response; /api/status/100 explains why |
The body is the change most likely to break something. A test that asserts the response text equals 503 Service Unavailable needs to read the JSON instead, or better, assert only on the status code and headers, which is what the code under test usually cares about.
Failures that stop after a few tries
httpstat.us could only fail every time, or fail at random. Retry logic is easier to test against an endpoint that fails a set number of times and then succeeds. /api/chaos/retry/{key} counts attempts per key: with succeedAfter=2, the first two calls get a 503 and the third gets a 200. Each 503 carries Retry-After: 1. Use a new key for each test run, so the counter starts from zero.
$ for i in 1 2 3; do curl -s -w " %{http_code}\n" \
"https://api.testingapis.com/api/chaos/retry/my-test-1?succeedAfter=2"; done
{"status":503,"error":"Service Unavailable","message":"Attempt 1 failed. The first 2 attempt(s) fail; attempt 3 succeeds.", ...} 503
{"status":503,"error":"Service Unavailable","message":"Attempt 2 failed. The first 2 attempt(s) fail; attempt 3 succeeds.", ...} 503
{"message":"Succeeded on attempt 3.","attempt":3,"succeedAfter":2} 200The chaos endpoints cover the rest of what goes wrong in production: dropped connections, truncated bodies, random latency and oversized headers.
Put the host in one place
Every suite that broke when httpstat.us went away had the host written into its tests. Read it from configuration, so the next move is a one-line change:
// test/config.js
export const STATUS_BASE =
process.env.STATUS_BASE ?? "https://api.testingapis.com/api";
// in a test
const res = await fetch(`${STATUS_BASE}/status/503`);If you would rather have no third party in CI at all, ours included, the httpstat.us source on GitHub still publishes a container image you can run next to your tests. Point STATUS_BASE at it and nothing else changes. That is also the right answer if you need delays or codes beyond what a shared public service allows.
A test suite for your error handling (JavaScript)
These five tests check the parts of an HTTP client that a status-code service is good for: which errors it retries, whether it recovers, whether it gives up on a slow server, and whether an empty 204 body breaks it. They use Node's built-in test runner, so there is nothing to install on Node 20 or later.
import { test } from "node:test";
import assert from "node:assert/strict";
const BASE = process.env.STATUS_BASE ?? "https://api.testingapis.com/api";
class HttpError extends Error {
constructor(status, retryAfter) {
super(`HTTP ${status}`);
this.status = status;
this.retryAfter = retryAfter;
}
}
// The client under test: a timeout, and up to 3 retries on 429/503 that respect Retry-After.
async function getJson(url, { timeoutMs = 2000, retries = 3 } = {}) {
for (let attempt = 0; ; attempt++) {
const res = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });
if (res.ok) return res.status === 204 ? null : res.json();
const retryAfter = Number(res.headers.get("retry-after")) || 0;
if ([429, 503].includes(res.status) && attempt < retries) {
await new Promise((r) => setTimeout(r, retryAfter * 1000));
continue;
}
throw new HttpError(res.status, retryAfter);
}
}
test("404 is not retried", async () => {
await assert.rejects(getJson(`${BASE}/status/404`), { status: 404 });
});
test("500 is not retried", async () => {
await assert.rejects(getJson(`${BASE}/status/500`), { status: 500 });
});
test("503 twice, then 200: the client recovers", async () => {
const key = `ci-${Date.now()}`; // a fresh key starts a fresh attempt counter
const body = await getJson(`${BASE}/chaos/retry/${key}?succeedAfter=2`);
assert.equal(body.attempt, 3);
});
test("a slow response hits the timeout", async () => {
await assert.rejects(getJson(`${BASE}/status/200?delay=3`, { timeoutMs: 1000 }), {
name: "TimeoutError",
});
});
test("204 returns null instead of failing on an empty body", async () => {
assert.equal(await getJson(`${BASE}/status/204`), null);
});$ node --test status.test.mjs
✔ 404 is not retried (394.8972ms)
✔ 500 is not retried (120.2565ms)
✔ 503 twice, then 200: the client recovers (2141.2443ms)
✔ a slow response hits the timeout (1017.2616ms)
✔ 204 returns null instead of failing on an empty body (37.108ms)
ℹ tests 5
ℹ pass 5
ℹ fail 0Swap getJson for your own client and run the same five tests. The 204 test fails more often than you would expect: calling res.json() on an empty body throws.
The same checks in Python
With requests, retries belong in a urllib3 Retry mounted on the session. It waits for Retry-After on its own.
import time
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
BASE = "https://api.testingapis.com/api"
session = requests.Session()
retry = Retry(
total=3,
read=False, # don't retry read timeouts (see below)
status_forcelist=[429, 503],
allowed_methods=["GET"],
respect_retry_after_header=True,
)
session.mount("https://", HTTPAdapter(max_retries=retry))
key = f"py-{int(time.time())}"
r = session.get(f"{BASE}/chaos/retry/{key}?succeedAfter=2", timeout=5)
print(r.status_code, r.json())
r = session.get(f"{BASE}/status/404", timeout=5)
print(r.status_code, r.json()["statusText"])
try:
session.get(f"{BASE}/status/200?delay=3", timeout=1)
except requests.exceptions.ReadTimeout:
print("ReadTimeout")$ python retry.py
200 {'message': 'Succeeded on attempt 3.', 'attempt': 3, 'succeedAfter': 2}
404 Not Found
ReadTimeoutFor C#, the 503 handling guide builds the same tests with HttpClient and xUnit.
Questions
Is httpstat.us coming back?
Its maintainer said he planned to bring it back with rate limiting. It was still not answering on 23 November 2026. Even if it returns, keep the host in configuration so an outage stays a one-line fix.
Is there a free API that returns any HTTP status code?
Yes. https://api.testingapis.com/api/status/{code} returns any code from 200 to 599 with no key. /api/status/list lists every code it knows. The HTTP status codes list explains each code and the headers it carries.
What about httpbin?
httpbin.org/status/{code} and /delay/{n} still cover the basics, and it is a fine choice if you already use it. The httpbin alternative guide compares the two.
Can I use the delay endpoint to wait in production?
Please don't. That is one of the reasons httpstat.us went offline. Use a timer in your own code; these endpoints are for tests.
How do I test a 429 with Retry-After?
/api/status/429 sends Retry-After: 5 every time. For a real rate limiter with a counter that runs out and resets, use the rate limit endpoints.