category-iconOTHERS

API Response Code: Simple Guide to API Response Codes

Wasif Zaman19 Mar 202502080
Blog Thumbnail

Basically, API response codes indicate whether a server request was successful or not. I have grouped them into five categories below:


1xx - Informational Responses:


Response Code100 - Continue: The server has received the request headers, and the client should proceed to send the request body (in the case of a request with a body).

Response 101 Switching Protocols: The server is switching to the protocol requested by the client.


2xx - Successful Responses


Response Code 200 OK: The request was successful, and the server returned the requested data.

Response Code 201 Created: The request was successful and created a new resource.

Response Code 202 Accepted: The request has been accepted for processing but is not yet complete.

Response Code 203 Non-Authoritative Information: The request was successful, but the returned metadata may be from a cached copy.

Response Code 204 No Content: The request was successful, but there is no content to send in the response body.

Response Code 205 Reset Content: The request was successful, and the client should reset the document view.

Response Code 206 Partial Content: The server is sending only part of the resource due to a range header sent by the client.


3xx - Redirection Responses


Response Code 300 Multiple Choices: There are multiple options for the resource that the client may follow.

Response Code 301 Moved Permanently: The resource has been permanently moved to a new URL.

Response Code 302 Found: The resource is temporarily located at a different URL.

Response Code 303 See Other: The client should make a GET request to a different URL.

Response Code 304 Not Modified: The resource has not been modified since the last request, so the client can use the cached version.

Response Code 305 Use Proxy: The requested resource must be accessed through a proxy.

Response Code 307 Temporary Redirect: The resource is temporarily located at a different URL, but the client should use the same method for the next request.

Response Code 308 Permanent Redirect: The resource has been permanently moved to a different URL, and the client should use the same method for the next request.


4xx - Client Error Responses


Response Code 400 Bad Request: The server cannot process the request due to malformed syntax or invalid parameters.

Response Code 401 Unauthorized: The client must provide authentication credentials to access the resource.

Response Code 402 Payment Required: Reserved for future use (indicates payment required for accessing the resource).

Response Code 403 Forbidden: The server understands the request, but it refuses to authorize it due to insufficient permissions.

Response Code 404 Not Found: The requested resource could not be found on the server.

Response Code 405 Method Not Allowed: The HTTP method used is not supported for the requested resource.

Response Code 406 Not Acceptable: The requested resource is not available in a format acceptable to the client.

Response Code 407 Proxy Authentication Required: The client must authenticate with the proxy before making the request.

Response Code 408 Request Timeout: The client’s request timed out while waiting for the server.

Response Code 409 Conflict: The request could not be completed due to a conflict with the current state of the resource.

Response Code 410 Gone: The resource is no longer available, and the server has no forwarding address.

Response Code 411 Length Required: The server requires the "Content-Length" header to be set in the request.

Response Code 412 Precondition Failed: The preconditions set by the client in the request headers are not met by the server.

Response Code 413 Payload Too Large: The request payload is too large for the server to process.

Response Code 414 URI Too Long: The URI requested by the client is too long for the server to process.

Response Code 415 Unsupported Media Type: The server cannot process the request due to an unsupported media type.

Response Code 416 Range Not Satisfiable: The range specified by the client cannot be fulfilled.

Response Code 417 Expectation Failed: The server cannot meet the expectations specified in the request's "Expect" header.

Response Code 418 I'm a teapot: A playful error code from an April Fools' joke in HTTP/1.1; the server is a teapot and cannot brew coffee.

Response Code 421 Misdirected Request: The request was directed to a server that is not able to produce a response.

Response Code 422 Unpossessable Entity: The server understands the content type of the request entity, but the request was unable to be followed due to semantic errors.

Response Code 423 Locked: The resource is locked and cannot be modified.

Response Code 424 Failed Dependency: The request failed due to a failure in a previous request.

Response Code 425 Too Early: The server is unwilling to risk processing a request that might be replayed.

Response Code 426 Upgrade Required: The client should switch to a different protocol.

Response Code 428 Precondition Required: The server requires the request to be conditional.

Response Code 429 Too Many Requests: The user has sent too many requests in a given amount of time.

Response Code 431 Request Header Fields Too Large: The server is unwilling to process the request because the request headers are too large.

Response Code 451 Unavailable For Legal Reasons: The requested resource is unavailable due to legal reasons.


5xx - Server Error Responses


Response Code 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.

Response Code 501 Not Implemented: The server does not support the functionality required to fulfill the request.

Response Code 502 Bad Gateway: The server received an invalid response from the upstream server it accessed while attempting to fulfill the request.

Response Code 503 Service Unavailable: The server is temporarily unable to handle the request, usually due to being overloaded or under maintenance.

Response Code 504 Gateway Timeout: The server did not receive a timely response from an upstream server.

Response Code 505 HTTP Version Not Supported: The server does not support the HTTP protocol version used in the request.

Response Code 506 Variant Also Negotiates: The server has an internal configuration error where the chosen variant of the resource is itself a negotiable resource.

Response Code 507 Insufficient Storage: The server is unable to store the representation needed to complete the request.

Response Code 508 Loop Detected: The server detected an infinite loop while processing the request.

Response Code 510 Not Extended: The server requires further extensions to fulfill the request.

Response Code 511 Network Authentication Required: The client needs to authenticate to gain network access.


These response codes help to find and fix issues in your requests and explain if a request was successful or not.


testingapitestingpostmansqaapi