Overview
FastrAPI provides constants for HTTP and WebSocket status codes, making your code more readable and maintainable. Import them fromfastrapi.status.
HTTP status codes
1xx Informational
The server has received the request headers and the client should proceed to send the request body
The server is switching protocols as requested by the client
The server has received and is processing the request, but no response is available yet
Used to return some response headers before final HTTP message
2xx Success
The request succeeded
The request succeeded and a new resource was created
The request has been accepted for processing, but processing is not complete
The request was successful but the enclosed payload has been modified by a transforming proxy
The request succeeded but there is no content to send
The request succeeded and the user agent should reset the document view
The server is delivering only part of the resource due to a range header sent by the client
Multiple status codes might be appropriate
The members of a DAV binding have already been enumerated
The server has fulfilled a request for the resource and the response is a representation of the result
3xx Redirection
The request has more than one possible response
The URL of the requested resource has been changed permanently
The URI of requested resource has been changed temporarily
The server sent this response to direct the client to get the requested resource at another URI
Used for caching purposes. The response has not been modified
The requested response must be accessed by a proxy
This response code is no longer used
The server sends this response to direct the client to get the requested resource at another URI with the same method
The resource is now permanently located at another URI
4xx Client errors
The server cannot process the request due to a client error
The client must authenticate itself to get the requested response
Reserved for future use
The client does not have access rights to the content
The server cannot find the requested resource
The request method is not supported for the requested resource
The server cannot produce a response matching the list of acceptable values
Authentication is required to access the proxy
The server would like to shut down this unused connection
The request conflicts with the current state of the server
The requested content has been permanently deleted from server
The server requires the Content-Length header field
The client has indicated preconditions that the server does not meet
Request entity is larger than limits defined by server
The URI requested by the client is longer than the server is willing to interpret
The media format of the requested data is not supported by the server
The range specified by the Range header field cannot be fulfilled
The expectation indicated by the Expect request header field cannot be met
The server refuses to brew coffee because it is a teapot
The request was directed at a server that is not able to produce a response
The request was well-formed but contains semantic errors
The resource that is being accessed is locked
The request failed due to failure of a previous request
The server is unwilling to risk processing a request that might be replayed
The server refuses to perform the request using the current protocol
The origin server requires the request to be conditional
The user has sent too many requests in a given amount of time
The server is unwilling to process the request because header fields are too large
The user requested a resource that is not available due to legal reasons
5xx Server errors
The server has encountered a situation it does not know how to handle
The request method is not supported by the server
The server got an invalid response while working as a gateway
The server is not ready to handle the request
The server is acting as a gateway and cannot get a response in time
The HTTP version used in the request is not supported by the server
The server has an internal configuration error
The server is unable to store the representation needed to complete the request
The server detected an infinite loop while processing the request
Further extensions to the request are required for the server to fulfill it
The client needs to authenticate to gain network access
WebSocket status codes
Normal closure; the connection successfully completed
The endpoint is going away (server shutdown or browser navigation)
The endpoint is terminating due to a protocol error
The connection is being terminated because the endpoint received data of a type it cannot accept
No status code was provided even though one was expected
The connection was closed abnormally without sending or receiving a Close frame
The endpoint is terminating because it received data that was inconsistent with the message type
The endpoint is terminating because it received a message that violates its policy
The endpoint is terminating because it received a message that is too big to process
The client is terminating because it expected the server to negotiate one or more extensions
The server is terminating because it encountered an unexpected condition
The server is terminating because it is restarting
The server is terminating because it is temporarily overloaded
The server was acting as a gateway and received an invalid response
The connection was closed due to a failure to perform a TLS handshake