Status codes & delay
Two tiny endpoints that make it trivial to test the error paths and timing behavior of any HTTP client.
https://sampleapi.top/api
Base URL — append any path below.
Endpoints
| Method | Path | Description |
|---|---|---|
| ANY | /status/{code} | Return the given HTTP status code (100–599). Any verb is accepted. |
| GET | /delay/{seconds} | Sleep up to 5 seconds before responding. Fractional values (e.g. 1.5) are allowed. |
Common status codes
| Code | Name | Why test it | Try |
|---|---|---|---|
| 200 | OK | Standard success response. | /status/200 |
| 201 | Created | Resource was created (or simulated to be). | /status/201 |
| 202 | Accepted | Request accepted, processing later. | /status/202 |
| 204 | No Content | No response body. Useful for delete confirmations. | /status/204 |
| 301 | Moved Permanently | Test how your client handles permanent redirects. | /status/301 |
| 302 | Found | Temporary redirect, common in OAuth flows. | /status/302 |
| 304 | Not Modified | Cache-validation response, no body. | /status/304 |
| 400 | Bad Request | Generic client error. | /status/400 |
| 401 | Unauthorized | Missing credentials. | /status/401 |
| 403 | Forbidden | Credentials present but not allowed. | /status/403 |
| 404 | Not Found | Classic missing resource. | /status/404 |
| 409 | Conflict | Useful for testing optimistic-concurrency error paths. | /status/409 |
| 418 | I'm a teapot | Strictly for fun. | /status/418 |
| 422 | Unprocessable Entity | Validation failures. | /status/422 |
| 429 | Too Many Requests | Rate-limit handling. | /status/429 |
| 500 | Internal Server Error | Generic server failure. | /status/500 |
| 502 | Bad Gateway | Upstream failure. | /status/502 |
| 503 | Service Unavailable | Test retry-with-backoff. | /status/503 |
| 504 | Gateway Timeout | Test long-tail timeout handling. | /status/504 |
Any code from 100 to 599 is accepted, not just the ones listed above.
Examples
Force a 503
curl -i https://sampleapi.top/api/status/503Test retry with exponential backoff
// Pseudo-code
for (let attempt = 0; attempt < 4; attempt++) {
const r = await fetch('https://sampleapi.top/api/status/503');
if (r.ok) break;
await sleep(Math.pow(2, attempt) * 250);
}Add 3 seconds of delay to test client timeout
curl -s -m 2 https://sampleapi.top/api/delay/3 \
|| echo "client hit its 2s timeout, as expected"POST that returns 201
curl -s -X POST https://sampleapi.top/api/status/201Notes
- Statuses that have no body by spec (
204,205,304) return an empty body, as required. - Delay is capped at 5 seconds. Anything larger is clamped.
- Negative or non-numeric delays are treated as zero.