504 Gateway Timeout

A gateway or proxy did not receive a timely response from the upstream server.

Status code504
Status textGateway Timeout
Category5xx Server Error
Response has bodyUsually
SpecificationRFC 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