Take a batch of 30 video jobs that each render for about four minutes. Poll each one every two seconds and you send 120 status requests per job, 3,600 for the batch, at a rate of 900 a minute. Mantinea's API allows 600 requests a minute per key, so the batch earns its own 429 errors partway through. Switch to the API's long-poll wait of up to 50 seconds per request and the same batch needs about five requests per job, roughly 150 in total, at under 40 a minute. Facts here come from Mantinea's public docs and OpenAPI 3.1 spec as of November 2026; check the exact parameter names on the API and MCP help page before writing production code.
The request maths
| Batch | Render time per job | Tight loop (every 2 s) | Long-poll (50 s waits) |
|---|---|---|---|
| 1 job | 4 min | 120 requests | about 5 |
| 30 jobs | 4 min | 3,600 requests, 900/min | about 150, under 40/min |
| 30 jobs, polled from one key with other traffic | 4 min | Over the 600/min limit | Far under it |
Mantinea's FAQ says generations usually take a few minutes as background jobs, so the four-minute figure is a fair planning number. The limit is 600 requests and 60 paid starts per minute per key.
Two costs follow from the tight loop. The first is compute: a serverless worker or CI runner that bills per execution cycle pays to sit in sleep(2). The second is risk to money already committed. A poller that hits 429s, times out and restarts a job creation call without its idempotency key starts a second paid render, which is 450 credits ($4.50) for a 30-second talking-actor ad on the standard 15-credits-a-second route.
How the 50-second wait behaves
A long-poll request asks the server to hold the connection for up to 50 seconds while it waits for the job to reach a terminal state: succeeded, failed or canceled.
| Job finishes | Server responds |
|---|---|
| At second 18 of the wait | At second 18, with the completed payload |
| After second 50 | At second 50, with the current status; the client opens the next wait |
So a client makes about one request every 50 seconds per job, against 30 a minute in a two-second loop. The 50-second cap also sits under the 60-second idle timeout that many load balancers, reverse proxies and serverless HTTP clients use, so the request ends before a gateway drops it with a 504.
A replacement for the loop
The route and wait parameter below are placeholders; take the real names from the OpenAPI 3.1 spec.
const BASE = "https://app.mantinea.com/api/v1";
export async function waitForJob(id: string, maxMs = 10 * 60_000) {
const stop = Date.now() + maxMs;
while (Date.now() < stop) {
const res = await fetch(`${BASE}/<GET_JOB_PATH>/${id}?<WAIT_PARAM>=50`, {
headers: { "<AUTH_HEADER>": process.env.MANTINEA_READ_KEY! },
signal: AbortSignal.timeout(65_000), // longer than the 50 s server wait
});
if (res.status === 429) { await new Promise(r => setTimeout(r, 5_000)); continue; }
if (!res.ok) throw new Error(`status ${res.status}`);
const job = await res.json();
if (["succeeded", "failed", "canceled"].includes(job.status)) return job;
}
throw new Error(`job ${id} still running after ${maxMs / 1000}s`);
}
Set the client timeout above 50 seconds. A default 30-second read timeout drops the connection before the server answers, and the client retries for nothing. Sixty to sixty-five seconds is a safe setting.
Poll with a read-scoped key. Keys come in read, generate and admin scopes, and rate limits apply per key, so status waits on a read key leave the generate key's 600-a-minute allowance for starting jobs. A read key also cannot spend.
If you have not made a first call yet, the curl quickstart sets up the key and job.
Long-poll or webhook
| Situation | Use | Why |
|---|---|---|
| A laptop script making five pitch ads | Long-poll | No public endpoint needed; code reads top to bottom |
| CI jobs, local tools, workers behind NAT | Long-poll | Same |
| A product feed starting 40 localized ads overnight | Webhooks | No idle connections; retries at 1 min, 5 min, 30 min, 2 h, 6 h and 12 h |
| Slack or email notifications on completion | Webhooks | Push, not pull |
| A webhook that never arrived | Long-poll as fallback | Catches a missed delivery |
Webhooks need a public HTTPS endpoint and a check of the X-Autonomous-Signature header ("Autonomous" is an older product name). Long-poll holds a worker or thread while it waits. Many production teams use both: webhooks to ingest finished renders and trigger the next step (Brand finish, resize, a review link in Slack), and long-poll when a job's expected window passes with no event, or inside an internal tool where someone clicks "Generate preview" and waits.
Protect the start call too
Status polling is free of paid starts, but the call that creates the job is not. If job creation times out, retry it with the same idempotency key so you do not render and pay for the same ad twice. Idempotency keys in the Mantinea API has the pattern. Failed or canceled jobs are refunded automatically.
Before production
- Wait parameter and route names taken from the live spec
- HTTP client timeout set to 60 to 65 seconds
- Status checks on a read-scoped key
-
429handling backs off instead of hammering - Idempotency keys on every job creation call
- Webhooks for unattended batches, long-poll as the fallback
The REST API, long-poll waits, scoped keys and signed webhooks are on every plan from Starter ($29 a month, 2,900 credits) and on the 14-day trial (1,000 credits, no card).