ESC
HTTPステータスコード

1xx Informational

Code Name Description
100 Continue The server has received the request headers and the client should proceed to send the request body.
101 Switching Protocols The server agrees to switch protocols as requested by the client (e.g., HTTP to WebSocket).
102 Processing The server has received and is processing the request, but no response is available yet (WebDAV).
103 Early Hints Used to return some response headers before final HTTP message; allows the client to start preloading resources.

2xx Success

Code Name Description
200 OK The request was successful. The response body contains the requested data.
201 Created The request was successful and a new resource was created. Typically returned after POST requests.
202 Accepted The request has been accepted for processing, but processing has not been completed yet.
203 Non-Authoritative Information The response is a modified version of the origin server's response, provided by a proxy or cache.
204 No Content The request was successful but there is no content to return. Common after DELETE or PUT requests.
205 Reset Content The request was successful. The client should reset the document view (e.g., clear a form).
206 Partial Content The server is delivering only part of the resource due to a Range header sent by the client.
207 Multi-Status The response body contains multiple status codes for multiple independent operations (WebDAV).
208 Already Reported Members of a DAV binding have already been enumerated and will not be included again (WebDAV).
226 IM Used The server has fulfilled a GET request for the resource and the response is a result of instance manipulations.

3xx Redirection

Code Name Description
300 Multiple Choices The request has multiple possible responses. The client should choose one of them.
301 Moved Permanently The URL of the requested resource has been changed permanently. Future requests should use the new URL.
302 Found The URI of requested resource has been changed temporarily. Future requests should still use the original URI.
303 See Other The server redirects the client to a different resource using a GET request, usually after a POST.
304 Not Modified The cached version of the resource is still valid. The client can use the cached version.
305 Use Proxy The requested resource must be accessed through the proxy given by the Location field. (Deprecated)
307 Temporary Redirect The request should be repeated with another URI but future requests should still use the original URI. Method is preserved.
308 Permanent Redirect The resource has been moved permanently. Method and body are preserved (unlike 301 where method may change).

4xx Client Errors

Code Name Description
400 Bad Request The server cannot process the request due to invalid syntax, missing parameters, or malformed request.
401 Unauthorized Authentication is required. The client must authenticate itself to get the requested response.
402 Payment Required Reserved for future use. Originally intended for digital payment systems. Used by some APIs for quota exceeded.
403 Forbidden The client does not have access rights to the content. The server knows who the client is but refuses access.
404 Not Found The server cannot find the requested resource. The URL is not recognized or the resource does not exist.
405 Method Not Allowed The request method (GET, POST, etc.) is not supported for the requested resource.
406 Not Acceptable The server cannot produce a response matching the list of acceptable values in the request's headers.
407 Proxy Authentication Required Authentication must be done by a proxy. Similar to 401, but authentication is needed for a proxy.
408 Request Timeout The server timed out waiting for the request. The client did not send a complete request in time.
409 Conflict The request conflicts with the current state of the server (e.g., editing conflict, duplicate resource).
410 Gone The requested resource has been permanently deleted and will not be available again. Clients should remove their caches.
411 Length Required The server requires the Content-Length header to be specified in the request.
412 Precondition Failed The client indicated preconditions in headers that the server does not meet.
413 Content Too Large The request entity is larger than the server is willing or able to process. (Also: Payload Too Large)
414 URI Too Long The URI requested by the client is longer than the server is willing to interpret.
415 Unsupported Media Type The media format of the requested data is not supported by the server.
416 Range Not Satisfiable The range specified by the Range header in the request cannot be fulfilled by the server.
417 Expectation Failed The expectation indicated by the Expect request header cannot be met by the server.
418 I'm a Teapot The server refuses to brew coffee because it is, permanently, a teapot. (April Fools RFC 2324)
421 Misdirected Request The request was directed at a server that is not able to produce a response for the request URI.
422 Unprocessable Content The request was well-formed but cannot be processed due to semantic errors. Common in REST APIs. (WebDAV)
423 Locked The resource being accessed is locked (WebDAV).
424 Failed Dependency The request failed because it depended on another request that also failed (WebDAV).
425 Too Early The server is unwilling to risk processing a request that might be replayed (Early Data).
426 Upgrade Required The server refuses to perform the request using the current protocol. Client must upgrade (e.g., to TLS).
428 Precondition Required The origin server requires the request to be conditional to prevent lost update problems.
429 Too Many Requests The user has sent too many requests in a given amount of time (rate limiting). Retry after specified time.
431 Request Header Fields Too Large The server refuses to process the request because its header fields are too large.
451 Unavailable For Legal Reasons The server is denying access due to a legal demand (e.g., government censorship, court order).

5xx Server Errors

Code Name Description
500 Internal Server Error The server encountered an unexpected condition that prevented it from fulfilling the request.
501 Not Implemented The request method is not supported by the server and cannot be handled.
502 Bad Gateway The server, acting as a gateway or proxy, received an invalid response from the upstream server.
503 Service Unavailable The server is not ready to handle the request. Common for maintenance or overloaded servers.
504 Gateway Timeout The server is acting as a gateway and cannot get a response in time from the upstream server.
505 HTTP Version Not Supported The HTTP version used in the request is not supported by the server.
506 Variant Also Negotiates The server has an internal configuration error: the chosen variant is configured to engage in transparent content negotiation itself.
507 Insufficient Storage The server is unable to store the representation needed to complete the request (WebDAV).
508 Loop Detected The server detected an infinite loop while processing the request (WebDAV).
510 Not Extended Further extensions to the request are required for the server to fulfill it.
511 Network Authentication Required The client needs to authenticate to gain network access (e.g., captive portals in WiFi).

よくある質問

HTTPステータスコードは、サーバーがクライアントのリクエストに対して返す3桁の数字です。リクエストが正常に完了したか、リダイレクトされたか、エラーが発生したかを示します。最初の数字が応答クラスを定義します:1xx(情報)、2xx(成功)、3xx(リダイレクト)、4xx(クライアントエラー)、5xx(サーバーエラー)。

4xxエラーはクライアント側に問題があることを示します。リクエストの形式が正しくない、認証されていない、またはリソースが見つからないといった場合です。一般的な例:400(Bad Request)、401(Unauthorized)、404(Not Found)。5xxエラーはサーバーが有効なリクエストを処理しようとしてエラーが発生したことを示します。500(Internal Server Error)や503(Service Unavailable)などのサーバー側の問題です。

最もよく見かけるステータスコードは次のとおりです:200 OK(リクエスト成功)、201 Created(リソースが作成された)、301 Moved Permanently(URLが永久に変更された)、302 Found(一時的なリダイレクト)、304 Not Modified(キャッシュが有効)、400 Bad Request(構文エラー)、401 Unauthorized(認証が必要)、403 Forbidden(サーバーがリクエストを拒否)、404 Not Found(リソースが存在しない)、500 Internal Server Error(汎用サーバー障害)。

301(Moved Permanently)リダイレクトは、ブラウザと検索エンジンにリソースが新しいURLに永久に移動したことを伝えます。検索エンジンはSEOの「リンクエクイティ」を古いURLから新しいURLに引き継ぎます。302(Found)リダイレクトは一時的な移動を示します。元のURLは引き続き検索エンジンにインデックスされ、SEO価値は引き継がれません。URLを恒久的に変更する場合は301を、一時的なリダイレクトには302を使用してください。

204 No Contentは、リクエストが成功したがレスポンスボディに返すコンテンツがない場合に返されます。DELETEリクエスト(リソースが削除され、返すものがない)、更新されたリソースを返す必要のないPUTやPATCHリクエスト、CORSプリフライトレスポンスなどでよく使われます。200 OKと異なり、204を使う場合はレスポンスボディを空にしなければなりません。