The HTTP Response API is a simple API service to generate HTTP responses for different HTTP status codes, using different HTTP methods, and optionally returning user-defined HTTP response headers.
The HTTP Response API can be used to test how your code deals with varying HTTP responses.
Just add the HTTP status code you want to the URL, like this:
https://http.codes/200
And a text/plain HTTP response will be returned, like this:
HTTP/1.1 {status code} {status description}
Content-Type: text/plain or application/json or text/xml or message/http
Content-Length: {something}
{any custom response headers}
{status code} {status description}
{list of any custom response headers}
The HTTP Response API is coded and provided by ex-Google engineer and technical SEO expert Fili.
JSON response
To get a JSON response back instead of a text/plain content type response, ensure that the HTTP request header: Accept contains 'application/json', like:
Accept: application/json
Then the response body will be encoded to JSON format, with the appropiate HTTP header: Content-Type .
Adding a delay to the HTTP response
If you want a delay on the HTTP response, there are two options:
Add the X-Delay HTTP header for the sleep duration (the time is in seconds, max 8 minutes or 480 seconds), like this:
X-Delay: 300
Alternatively provide the query string ?delay= to the URL for the sleep duration (the time is in seconds, max 8 minutes or 480 seconds), like this:
https://http.codes/200?delay=5
Adding HTTP response headers
If you want to return additional HTTP headers to the client, these can be added to the HTTP request with the X-Custom- prefix.
For example, a HTTP header in the HTTP request like this:
X-Custom-Foo: Bar
will append the following HTTP header to the HTTP response.
Foo: Bar
However the following HTTP headers are reserved and cannot be set and/or changed:
Supported HTTP methods
The following HTTP methods are supported:
Supported HTTP status codes
And the following HTTP status codes are supported:
1xx: Informational
2xx: Success
- 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
- 218 This is fine
- 226 IM Used
3xx: Redirection
- 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
4xx: Client error
- 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 Payload Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 419 Page Expired
- 420 Enhance your calm
- 421 Misdirected Request
- 422 Unprocessable Entity
- 423 Locked
- 424 Failed Dependency
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 430 Request Header Fields Too Large
- 431 Request Header Fields Too Large
- 440 Login Time-out
- 444 No Response
- 449 Retry With
- 450 Blocked by Windows Parental Controls
- 451 Unavailable For Legal Reasons
- 460 Client closed connection prematurely
- 463 Too many forwarded IP addresses
- 464 Incompatible protocol
- 494 Request header too large
- 495 SSL Certificate Error
- 496 SSL Certificate Required
- 497 HTTP Request Sent to HTTPS Port
- 498 Invalid Token
- 499 Client Closed Request
5xx: Server error
- 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
- 509 Bandwidth Limit Exceeded
- 510 Not Extended
- 511 Network Authentication Required
- 520 Web server is returning an unknown error
- 521 Web server is down
- 522 Connection timed out
- 523 Origin is unreachable
- 524 A Timeout Occurred
- 525 SSL handshake failed
- 526 Invalid SSL certificate
- 527 Railgun Listener to Origin
- 529 The service is overloaded
- 530 Site Frozen
- 561 Unauthorized
- 598 Network read timeout error
- 599 Network Connect Timeout Error
Other HTTP status codes
Any other three digit number that's not in that list above will also return a HTTP response with the HTTP status code description "Unknown Status Code".
CORS
CORS is enabled on all endpoints so all origins, HTTP headers, and most HTTP methods can be used with this service.
Additional HTTP Status Code APIs
There are more HTTP Status Code APIs out there (supporting JSON, JPG, AVIF, WEBP and JXL) that might be better suited for your needs:
If you want to test HTTP responses and HTTP status codes on live websites and optionally from different locations and/or with different user agents, try the HTTP Status Tester.
Disclaimer
The HTTP Response API is under constant development and improvements will be made over time.
Any data and/or query submitted to this website or its API is by default not stored. Request body messages submitted to the API are completely ignored and not stored. The only exception is when an unexpected error occur, any user-defined header data -if present- may be temporarily stored for debugging purposes and after which this data is completely disregarded and ignored.
Bugs will happen. Despite best efforts to maintain the code base and data quality, no guarantees can or will be given. Data may be incomplete and/or errors may occur. This is a personal website and for-fun project. Use at your own risk