API timeout

Updated 11 October 2026

Short answer

An API timeout means a request took longer than something in the chain would wait: your code's own timeout, a proxy (a 504), or a platform limit on how long functions can run. Find which. If every call times out, the API is unreachable or overloaded. If only some calls do, a particular operation is slow, usually a database query or a call the API makes to yet another service.

What's the problem

API calls hang and then fail with a timeout, a 504, or "request timed out", often only for certain endpoints or at busy times.

Why it happens

  • A slow operation inside the API: a heavy query or a large export.
  • The API calls another slow service and waits for it.
  • The API is overloaded or cold-starting (serverless functions starting up).
  • Network problems between your app and the API.
  • Timeouts set too short for what the request legitimately needs.

How to fix it

  1. Find which calls time out: all, or only certain endpoints or inputs.
  2. Time the API's internal steps with logs to find the slow part.
  3. Speed up or cache the slow step, or move long work to a background job and return immediately.
  4. Add retries with waits in your client for occasional timeouts, but not for ones that always fail.
  5. For third-party APIs, check their status page and published limits.

What Preventionlabs checks

One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go. With Cloudflare connected, it also shows which pages returned server errors (5xx) to visitors, and when; errors thrown by your Workers code; recent deploys and account changes, with their times. It doesn't call your API with your app's own requests or read your logs, so test the failing request directly as well.

Run your free report

Your first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.

Sources

  1. MDN Web Docs: 504 Gateway TimeoutreferenceThe HTTP 504 Gateway Timeout server error response status code indicates that the server, while acting as a gateway or proxy , did not get a response in time from the upstream server in order to complete the request.
  2. MDN Web Docs: 408 Request TimeoutreferenceThe HTTP 408 Request Timeout client error response status code indicates that the server would like to shut down this unused connection.
← All of API