| Status code | 504 |
|---|---|
| Status text | Gateway Timeout |
| Category | 5xx Server Error |
| Response has body | Usually |
| Specification | RFC 9110 |
What does 504 Gateway Timeout mean?
A gateway or proxy did not receive a timely response from the upstream server. It belongs to the 5xx Server Error class, which means the server failed to fulfil an apparently valid request. The problem is on the server side.
When do APIs return 504?
A slow database query, a long-running operation, or an upstream dependency that hung.
How to fix a 504 Gateway Timeout
The request may still be processing on the server despite the timeout — be careful about blindly retrying non-idempotent operations, or you may create duplicates. For genuinely slow work, the API should move to an asynchronous pattern returning 202.
Reproduce a 504 response
The fastest way to understand a status code is to trigger one and read the full response. Open the
API tester and send a request to https://httpbin.org/status/504 — you will
see the 504 status along with every response header the server sent. Comparing those headers against
a working request is often what reveals the cause.
When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.
Related 5xx status codes
500 Internal Server Error
The server hit an unexpected condition and could not complete the request.
501 Not Implemented
The server does not support the functionality required to fulfil the request.
502 Bad Gateway
A server acting as a gateway or proxy received an invalid response from the upstream server.
503 Service Unavailable
The server is temporarily unable to handle the request.
507 Insufficient Storage
The server cannot store the representation needed to complete the request.