DocsGet startedRate limits & timeouts

Rate limits & timeouts

Throttles, the 29-second ceiling, and streaming long runs.

Two limits shape how you call this API: a request rate, and a hard 29-second ceiling on how long any single HTTP request can take. The second one matters more than the first, because index calculation is genuinely slow work and the ceiling is not negotiable.

Request rate

SurfaceLimitScopeOver limit
REST API~60 requests/minPer API key (gateway usage plan)Gateway throttle response
MCP server60 requests/minPer team429 with Retry-After
MCP server, signed out30 requests/minPer IP address429 with Retry-After

The REST throttle is a usage plan attached to the API key, so it only applies to requests the gateway validated a key for. Because it is per key, one busy batch job can starve everything else sharing that key — issue separate keys for separate workloads.

The MCP server counts per team, not per key, and uses a fixed 60-second window rather than a rolling one. The window resets on a boundary, so a burst that exhausts the budget early leaves you blocked for the remainder of that minute and then fully replenished.

MCP 429 body
{
"error": "Rate limit exceeded for this team. Retry shortly.",
"code": "rate_limited"
}

Honour `Retry-After`

The MCP 429 carries a Retry-After header. Sleeping for that value is strictly better than a blind exponential backoff, because the fixed window means the header tells you exactly when the budget resets rather than approximately.

The 29-second ceiling

API Gateway's integration timeout is 29 seconds. It is an AWS-side maximum, not a setting anyone can raise, and every route that does its work inline inherits it — /execute and /chat among them. The MCP server runs on its own gateway, where the same ceiling is 30 seconds.

If the work behind such a request has not finished by then, the connection is cut regardless of what the worker is doing. The worker usually carries on, which means a timed-out request is not proof the work failed.

A timeout is not a failure signal

Do not treat a cut connection as "the run did not happen" and retry blindly — you may end up with the same expensive computation running twice. Where an endpoint gives you an id to poll, poll it.

This ceiling explains a design decision you will meet elsewhere and might otherwise find arbitrary: the long-running backtest and deploy paths never hold a response open on the run. They validate, launch the job, and return a bkt_... id immediately, so the call always answers cleanly instead of being severed mid-response. This is true on both surfaces — REST POST /simulate (poll GET /backtests/{backtest_id}) and POST /workflows, and the MCP run_backtest / deploy_index tools (poll get_backtest) — because they share one engine.

The polling pattern

  1. 1

    Launch the run

    REST POST /simulate (or the MCP run_backtest tool) validates, starts the work in the background and returns an id immediately — a bkt_... for a backtest, plus an idx_... for a deploy via POST /workflows / deploy_index. The launch never holds the response open on the computation, so it cannot be severed mid-run.

  2. 2

    Poll the id

    GET /backtests/{backtest_id} over REST — or the MCP get_backtest tool — reads the persisted result. It absorbs the in-flight window server-side, waiting a few seconds and re-checking rather than bouncing an instant "running" back, so a poll that arrives just before the result lands still resolves in that one call and back-to-back polling stays cheap.

  3. 3

    Read the outcome

    Status settles on completed or failed; a completed deploy also surfaces its deployed_index_id here. Keep the interval well clear of the 60/min throttle — a few seconds between polls is plenty for work measured in minutes.

Streaming over WebSocket

Polling tells you when something finished. For long runs where you also want progress as it happens, the worker streams alongside the poll.

Connect to wss://846dfj97pc.execute-api.eu-west-1.amazonaws.com/prod/, then pass your connection identifier into /execute or /simulate as websocket_id or connection_id. The HTTP request returns promptly with the backtest_id and the worker pushes frames down the socket as the run progresses.

FrameMeaning
execution_startThe worker has picked up the run
execution_completeThe run finished; results are attached
execution_errorThe run failed
backtest_errorA backtest-specific failure

Two ways past the ceiling, for two jobs

Polling a backtest_id and streaming a socket both escape the 29-second ceiling; they answer different questions, and both are available over plain REST and MCP alike. The poll (GET /backtests/{backtest_id} / get_backtest) tells you when a run finished and hands you the persisted result — durable and stateless, the path to reach for by default. The socket shows progress as it happens, which a live UI wants; it is an addition to the poll, not a replacement. Use the poll to retrieve, the socket to watch.

Response size caps

Long histories are large. get_index_values on the MCP server caps a series at 5000 points and evenly downsamples anything longer, always keeping the latest point so the most recent value is never dropped.

The response reports what happened: {count, returned, downsampled}. count is the true number of points in the range, returned is how many you got, and downsampled tells you whether the series you are holding is a thinned view. Check that flag before computing anything path-dependent — drawdown and realised volatility both change meaningfully on a downsampled series.

For a complete series, narrow the date range and page through it, or read index-values-eod through GET /query with its cursor.

Pagination

Only GET /query paginates with a cursor. The cursor is an opaque base64 string; pass it back to get the next page, and treat cursor: null as the end of the data. Do not parse or construct one.

The list endpoints — GET /workflows and GET /deliveries/{id} — are unpaginated full scans. They return everything your team has. That is fine at current sizes and worth knowing about before you build a UI that calls one on every keystroke.

Retry guidance

  • Retry 429 and 500. Do not retry 400, 401, 403 or 404 — nothing about the request will have changed.
  • On 429, sleep for Retry-After when it is present rather than guessing.
  • Otherwise use exponential backoff with jitter, starting around one second, and cap the total attempts. Synchronised retries from several workers turn one throttle into a sustained one.
  • Never retry a timed-out long run without first checking whether it completed — use the returned id, not a fresh request.
  • Keep polling intervals inside the 60/min budget; polls and real work share the same throttle.
  • Cache the operation catalog from GET /schema. It changes rarely and there is no reason to re-fetch it per request.