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:

Fili, ex-Google engineer, SEO Expert

Supported HTTP status codes

And the following HTTP status codes are supported:

1xx: Informational

2xx: Success

3xx: Redirection

4xx: Client error

5xx: Server 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


Made with by SEO Expert Fili © 2022 - 2024