API Gateway 29 second timeout: calling a video API from Lambda

API Gateway REST APIs cut integrations at 29 seconds by default. Submit the video job, return 202, and take the result on a callback.

5 min readSume
All posts

Amazon API Gateway's documented integration timeout for REST APIs is 50 milliseconds to 29 seconds, for every integration type including Lambda. A video render takes longer than that, so don't hold the request open. Have your Lambda submit the job to Sume, return 202 with the job id, and let Sume call you back when the job is terminal.

AWS facts come from the API Gateway quota pages for REST APIs and HTTP APIs, the Lambda integration page and the Lambda timeout page, read 2026-09-29. Sume facts come from Jobs and results and Videos. Sume has no AWS connector: this is a plain HTTPS call from your function.

What are the API Gateway and Lambda timeouts?

Two clocks run at once. API Gateway stops waiting at its integration timeout, and Lambda stops your code at the function timeout. Lambda's own default is 3 seconds and it can go up to 900 seconds (15 minutes), so a function can be allowed to run far longer than the gateway will wait.

From AWS's REST API quotas, HTTP API quotas and Lambda timeout pages, read 2026-09-29.
LimitValueCan it be raised?
REST API integration timeout, Regional50 ms to 29 s, all integration typesYes, with a caveat (below)
REST API integration timeout, edge-optimized50 ms to 29 sNo
HTTP API maximum integration timeout30 sNo
Payload size (REST API)10 MBNo
Lambda function timeoutDefault 3 s, maximum 900 sSet per function

Can I raise the 29 second limit?

For Regional and private REST APIs, AWS's table marks the integration timeout as adjustable, with a footnote: you can raise it above 29 seconds, but that might require reducing your Region-level throttle quota for the account. It marks edge-optimized APIs as not adjustable, and HTTP APIs top out at 30 seconds. Raising it may cost throttle capacity, and a video job's length isn't something you control, so the more durable fix is to stop waiting.

How do I call Sume from a Lambda behind API Gateway?

Submit and return. POST /v1/videos answers 202 with the job id and status: pending, so the Lambda has nothing to wait for. Set the function timeout deliberately (its default is 3 seconds, and for this route it should stay under the gateway's 29 seconds), pass an Idempotency-Key built from your own order id, and keep the API key in the function's environment, not in the request from the browser.

export const handler = async (event) => {
  const { orderId, prompt } = JSON.parse(event.body ?? "{}");
  const res = await fetch("https://api.sume.com/v1/videos", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.SUME_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": `order-${orderId}-video`,
    },
    body: JSON.stringify({
      model: "seedance-2",
      prompt,
      callback_url: "https://api.example.com/hooks/sume",
    }),
  });
  if (!res.ok) return { statusCode: 502, body: "submit failed" };
  const job = await res.json();
  return { statusCode: 202, body: JSON.stringify({ job_id: job.id }) };
};

Why not use Sume's sync mode behind the gateway?

Sume's job endpoints that take a mode can wait for a terminal state with sync, but the wait is capped at 30 seconds, one second longer than a REST API's 29-second integration timeout, and the docs say video jobs routinely outlast it. When the wait runs out the response is still a 2xx with the job id, and the docs say to keep polling that job's status_url, not to submit a new one. /v1/videos has no mode field: it's asynchronous and returns the pending job. So the 202-and-callback pattern above is the direct fit.

How do I receive the result?

Add a second route to the same API that receives Sume's signed callback. Sume sends job.completed, job.failed or job.canceled, retries non-2xx responses up to 10 attempts 30 seconds apart by default, and allows 10 seconds per attempt, so verify the signature, store the event keyed by job_id, and return 2xx quickly. See Webhooks for the payload and the signature check.

A client timeout, such as the gateway giving up, doesn't cancel the job: Sume's docs say it keeps running and still bills. If your Lambda retries after a timeout, the same Idempotency-Key and the same body return the original job.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume