Skip to content
All notes
24API TestingAPI TestingHTTP

Explain common HTTP Status Codes used in API Testing

HTTP Status Codes are three-digit numbers returned by servers to indicate the result of an HTTP request.

2xx - Success

  • 200 OK: Request successful (GET, PUT, PATCH)
  • 201 Created: Resource created successfully (POST)
  • 204 No Content: Success but no content to return (DELETE)

4xx - Client Errors

  • 400 Bad Request: Invalid request syntax
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Server refuses to authorize
  • 404 Not Found: Resource doesn’t exist
  • 405 Method Not Allowed: HTTP method not supported
  • 409 Conflict: Request conflicts with current state
  • 422 Unprocessable Entity: Validation errors
  • 429 Too Many Requests: Rate limit exceeded

5xx - Server Errors

  • 500 Internal Server Error: Generic server error
  • 502 Bad Gateway: Invalid response from upstream server
  • 503 Service Unavailable: Server temporarily unavailable
  • 504 Gateway Timeout: Upstream server timeout

Testing Scenarios

  • Verify correct status code for each operation
  • Test error handling (4xx, 5xx responses)
  • Validate response body matches status code
  • Check status codes for edge cases