HTTP Status Codes — TypeScript source
Searchable reference of all HTTP status codes with meaning, category, and usage notes.
This is the TypeScript implementation — the same logic the interactive tool runs, in a shareable, citable form.
// HTTP Status Codes reference - pure, deterministic data + filter. No DOM, no React.
export type StatusCategory =
| 'Informational'
| 'Success'
| 'Redirection'
| 'Client Error'
| 'Server Error';
export interface StatusCode {
code: number;
reason: string;
category: StatusCategory;
description: string;
}
/** Standard + widely-implemented HTTP status codes across 1xx-5xx. */
export const STATUS_CODES: StatusCode[] = [
// --- 1xx Informational ---
{ code: 100, reason: 'Continue', category: 'Informational', description: 'The server has received the request headers and the client should proceed to send the request body.' },
{ code: 101, reason: 'Switching Protocols', category: 'Informational', description: 'The requester has asked the server to switch protocols and the server has agreed to do so.' },
{ code: 103, reason: 'Early Hints', category: 'Informational', description: 'Used to return some response headers before the final HTTP message so the browser can start preloading resources.' },
// --- 2xx Success ---
{ code: 200, reason: 'OK', category: 'Success', description: 'Standard response for a successful HTTP request.' },
{ code: 201, reason: 'Created', category: 'Success', description: 'The request succeeded and a new resource was created.' },
{ code: 202, reason: 'Accepted', category: 'Success', description: 'The request has been accepted for processing but is not yet complete.' },
{ code: 203, reason: 'Non-Authoritative Information', category: 'Success', description: 'The returned metadata originated from a local or third-party copy rather than the origin server.' },
{ code: 204, reason: 'No Content', category: 'Success', description: 'The server processed the request successfully but is not returning any content.' },
{ code: 205, reason: 'Reset Content', category: 'Success', description: 'The server asks the client to reset the document view that sent the request.' },
{ code: 206, reason: 'Partial Content', category: 'Success', description: 'The server is delivering only part of the resource because the client requested a byte range.' },
{ code: 207, reason: 'Multi-Status', category: 'Success', description: 'WebDAV: conveys information about multiple resources in a single XML response.' },
{ code: 208, reason: 'Already Reported', category: 'Success', description: 'WebDAV: the members of a DAV binding have already been enumerated in a previous reply.' },
{ code: 226, reason: 'IM Used', category: 'Success', description: 'The server fulfilled a GET request using an instance-manipulation applied to the current instance.' },
// --- 3xx Redirection ---
{ code: 300, reason: 'Multiple Choices', category: 'Redirection', description: 'The request has more than one possible response; the user agent can choose among them.' },
{ code: 301, reason: 'Moved Permanently', category: 'Redirection', description: 'This and all future requests should be directed to the given URL.' },
{ code: 302, reason: 'Found', category: 'Redirection', description: 'The resource resides temporarily under a different URL; the method may be changed to GET.' },
{ code: 303, reason: 'See Other', category: 'Redirection', description: 'The response to the request can be found under another URI using a GET request.' },
{ code: 304, reason: 'Not Modified', category: 'Redirection', description: 'The resource has not been modified since the version specified by the request headers.' },
{ code: 305, reason: 'Use Proxy', category: 'Redirection', description: 'The requested resource is available only through a proxy (deprecated).' },
{ code: 306, reason: 'Switch Proxy', category: 'Redirection', description: 'No longer used; originally meant subsequent requests should use a specified proxy.' },
{ code: 307, reason: 'Temporary Redirect', category: 'Redirection', description: 'The request should be repeated with another URL; the request method must not change.' },
{ code: 308, reason: 'Permanent Redirect', category: 'Redirection', description: 'This and all future requests should use another URL; the request method must not change.' },
// --- 4xx Client Error ---
{ code: 400, reason: 'Bad Request', category: 'Client Error', description: 'The server cannot process the request due to a client error such as malformed syntax.' },
{ code: 401, reason: 'Unauthorized', category: 'Client Error', description: 'Authentication is required and has either failed or not been provided.' },
{ code: 402, reason: 'Payment Required', category: 'Client Error', description: 'Reserved for future use; sometimes used for paywalled resources.' },
{ code: 403, reason: 'Forbidden', category: 'Client Error', description: 'The server understood the request but refuses to authorize it.' },
{ code: 404, reason: 'Not Found', category: 'Client Error', description: 'The requested resource could not be found on the server.' },
{ code: 405, reason: 'Method Not Allowed', category: 'Client Error', description: 'The request method is not supported for the requested resource.' },
{ code: 406, reason: 'Not Acceptable', category: 'Client Error', description: 'The requested resource can only generate content not acceptable per the Accept headers.' },
{ code: 407, reason: 'Proxy Authentication Required', category: 'Client Error', description: 'The client must first authenticate itself with the proxy.' },
{ code: 408, reason: 'Request Timeout', category: 'Client Error', description: 'The server timed out waiting for the client to send the request.' },
{ code: 409, reason: 'Conflict', category: 'Client Error', description: 'The request could not be processed because of a conflict with the current state of the resource.' },
{ code: 410, reason: 'Gone', category: 'Client Error', description: 'The resource is no longer available and will not be available again.' },
{ code: 411, reason: 'Length Required', category: 'Client Error', description: 'The request did not specify the length of its content, which is required by the resource.' },
{ code: 412, reason: 'Precondition Failed', category: 'Client Error', description: 'The server does not meet one of the preconditions given in the request headers.' },
{ code: 413, reason: 'Content Too Large', category: 'Client Error', description: 'The request payload is larger than the server is willing or able to process.' },
{ code: 414, reason: 'URI Too Long', category: 'Client Error', description: 'The URI provided was too long for the server to process.' },
{ code: 415, reason: 'Unsupported Media Type', category: 'Client Error', description: 'The request uses a media type the server does not support for the resource.' },
{ code: 416, reason: 'Range Not Satisfiable', category: 'Client Error', description: 'The portion of the resource requested in the Range header cannot be supplied by the server.' },
{ code: 417, reason: 'Expectation Failed', category: 'Client Error', description: 'The server cannot meet the requirements of the Expect request header field.' },
{ code: 418, reason: "I'm a Teapot", category: 'Client Error', description: 'RFC 2324 joke status: the server refuses to brew coffee because it is, permanently, a teapot.' },
{ code: 421, reason: 'Misdirected Request', category: 'Client Error', description: 'The request was directed at a server that is not able to produce a response.' },
{ code: 422, reason: 'Unprocessable Content', category: 'Client Error', description: 'The server understands the content type and syntax but cannot process the contained instructions (WebDAV).' },
{ code: 423, reason: 'Locked', category: 'Client Error', description: 'WebDAV: the source or destination resource of the method is locked.' },
{ code: 424, reason: 'Failed Dependency', category: 'Client Error', description: 'WebDAV: the method could not be performed because the requested action depended on another action that failed.' },
{ code: 425, reason: 'Too Early', category: 'Client Error', description: 'The server is unwilling to risk processing a request that might be a replay.' },
{ code: 428, reason: 'Precondition Required', category: 'Client Error', description: 'The origin server requires the request to be conditional.' },
{ code: 429, reason: 'Too Many Requests', category: 'Client Error', description: 'The user has sent too many requests in a given time (rate limiting).' },
{ code: 431, reason: 'Request Header Fields Too Large', category: 'Client Error', description: 'The server is unwilling to process the request because its header fields are too large.' },
{ code: 451, reason: 'Unavailable For Legal Reasons', category: 'Client Error', description: 'The resource is unavailable due to legal demands such as government censorship or a takedown.' },
// --- 5xx Server Error ---
{ code: 500, reason: 'Internal Server Error', category: 'Server Error', description: 'A generic error message: the server encountered an unexpected condition.' },
{ code: 501, reason: 'Not Implemented', category: 'Server Error', description: 'The server does not support the functionality required to fulfill the request.' },
{ code: 502, reason: 'Bad Gateway', category: 'Server Error', description: 'The server, acting as a gateway, received an invalid response from an upstream server.' },
{ code: 503, reason: 'Service Unavailable', category: 'Server Error', description: 'The server is currently unavailable, typically because it is overloaded or down for maintenance.' },
{ code: 504, reason: 'Gateway Timeout', category: 'Server Error', description: 'The server, acting as a gateway, timed out waiting for an upstream response.' },
{ code: 505, reason: 'HTTP Version Not Supported', category: 'Server Error', description: 'The server does not support the HTTP protocol version used in the request.' },
{ code: 506, reason: 'Variant Also Negotiates', category: 'Server Error', description: 'Transparent content negotiation for the request resulted in a circular reference.' },
{ code: 507, reason: 'Insufficient Storage', category: 'Server Error', description: 'WebDAV: the server is unable to store the representation needed to complete the request.' },
{ code: 508, reason: 'Loop Detected', category: 'Server Error', description: 'WebDAV: the server detected an infinite loop while processing the request.' },
{ code: 510, reason: 'Not Extended', category: 'Server Error', description: 'Further extensions to the request are required for the server to fulfill it.' },
{ code: 511, reason: 'Network Authentication Required', category: 'Server Error', description: 'The client must authenticate to gain network access, as with a captive portal.' },
];
/**
* Filter status codes by a free-text query and an optional category.
*
* - `query` is matched case-insensitively against the numeric code, the reason
* phrase, and the description. An empty/whitespace query returns every code
* (in the given category, if one is supplied).
* - `category`, when provided and a known `StatusCategory`, restricts the pool
* to that category before the text match. An unknown category yields `[]`.
*/
export function filterCodes(
query: string,
codes: StatusCode[],
category?: string,
): StatusCode[] {
const cat = category?.trim();
let pool = cat ? codes.filter((c) => c.category === cat) : codes;
const q = query.trim().toLowerCase();
if (!q) return pool;
return pool.filter(
(c) =>
String(c.code).includes(q) ||
c.reason.toLowerCase().includes(q) ||
c.description.toLowerCase().includes(q),
);
}
Also available in 13 other languages
Every CosmoDev tool ships its pure logic in TypeScript (web) and Go (CLI), with authored implementations in a dozen-plus languages — the same contract, ported. Compare all languages side by side →