How to use it

This is a simple service for generating HTTP status codes on demand. It is useful for testing how your own code, scripts, and integrations react to different responses. Add the status code you want to the URL, such as https://http-stat.us/200, and the service returns that status. We return a response like this:

HTTP/1.1 {status code} {status description} Content-Type: text/plain or application/json Content-Length: {length} {status code} {status description}

JSON responses

To get a JSON response, send an Accept header that contains application/json. The service then returns {"code": 200, "description": "OK"} with a JSON content type.

Random status codes

Use the /random/{range} endpoint to get a random status from a range, for example https://http-stat.us/random/200,201,500-504. Ranges are comma-separated numbers or inclusive spans, and duplicates raise a code's probability.

Delayed responses

Add a delay before the response with the sleep query parameter (milliseconds), such as https://http-stat.us/200?sleep=5000, or the X-HttpStatus-Sleep request header. The maximum delay is set by the operator (30 seconds by default).

Custom response headers

Send a request header prefixed with X-HttpStatus-Response- and it is reflected back with the prefix removed. For example X-HttpStatus-Response-Foo: Bar adds Foo: Bar to the response.

Methods and CORS

Status and random endpoints accept GET, PUT, POST, DELETE, HEAD, OPTIONS, TRACE, PATCH, and the newer QUERY method. All origins, headers, and supported methods are allowed for cross-origin requests.

Limitations

A few behaviors are constrained by HTTP semantics and by the edge in front of the service:

Informational 1xx codes (100–199) cannot be sent as final responses and return a transparent 501 Not Implemented.

The TRACE method is blocked at the edge and returns 405, so it cannot be exercised through the public service, even though the endpoint accepts it.

Streamed and dribbled responses (X-HttpStatus-DribbleBody and delayed bodies) may be buffered and delivered all at once rather than incrementally.

Connection-abort controls (X-HttpStatus-AbortBeforeHeaders and related) are best-effort and may be transformed by an intermediary into a connection reset or gateway error.

No custom reason phrase is returned; rely on the numeric status code, headers, and body (HTTP/2 carries no reason phrase).

Status code catalog

The catalog below lists standard status codes first, followed by provider-specific codes. Select any code to request its response.

100
Continue
101
Switching Protocols
102
Processing
103
Early Hints
200
OK
201
Created
202
Accepted
203
Non-Authoritative Information
204
No Content
205
Reset Content
206
Partial Content
207
Multi-Status
208
Already Reported
226
IM Used
300
Multiple Choices
301
Moved Permanently
302
Found
303
See Other
304
Not Modified
305
Use Proxy
306
Switch Proxy
307
Temporary Redirect
308
Permanent Redirect
400
Bad Request
401
Unauthorized
402
Payment Required
403
Forbidden
404
Not Found
405
Method Not Allowed
406
Not Acceptable
407
Proxy Authentication Required
408
Request Timeout
409
Conflict
410
Gone
411
Length Required
412
Precondition Failed
413
Request Entity Too Large
414
Request-URI Too Long
415
Unsupported Media Type
416
Requested Range Not Satisfiable
417
Expectation Failed
418
I'm a teapot
421
Misdirected Request
422
Unprocessable Entity
423
Locked
424
Failed Dependency
425
Too Early
426
Upgrade Required
428
Precondition Required
429
Too Many Requests
431
Request Header Fields Too Large
451
Unavailable For Legal Reasons
500
Internal Server Error
501
Not Implemented
502
Bad Gateway
503
Service Unavailable
504
Gateway Timeout
505
HTTP Version Not Supported
506
Variant Also Negotiates
507
Insufficient Storage
508
Loop Detected
510
Not Extended
511
Network Authentication Required
419
CSRF Token Missing or Expired (non-standard)
420
Enhance Your Calm (non-standard)
440
Login Time-out (non-standard)
444
No Response (non-standard)
449
Retry With (non-standard)
450
Blocked by Windows Parental Controls (non-standard)
460
Client closed the connection with AWS Elastic Load Balancer (non-standard)
463
The load balancer received an X-Forwarded-For request header with more than 30 IP addresses (non-standard)
494
Request header too large (non-standard)
495
SSL Certificate Error (non-standard)
496
SSL Certificate Required (non-standard)
497
HTTP Request Sent to HTTPS Port (non-standard)
498
Invalid Token (Esri) (non-standard)
499
Client Closed Request (non-standard)
520
Web Server Returned an Unknown Error (non-standard)
521
Web Server Is Down (non-standard)
522
Connection Timed out (non-standard)
523
Origin Is Unreachable (non-standard)
524
A Timeout Occurred (non-standard)
525
SSL Handshake Failed (non-standard)
526
Invalid SSL Certificate (non-standard)
527
Railgun Error (non-standard)
530
Origin DNS Error (non-standard)
561
Unauthorized (AWS Elastic Load Balancer) (non-standard)