Rate limits

Token buckets, announced on every answer. One bucket per caller, shared with MCP, and one per file for writes. With Redis the buckets are shared by every node of a cluster.

The buckets

BucketApplies toDefaultSetting ([host.api])
subjectEvery request of one caller: the host key, or a token's sub10 requests a second, burst 30rate_per_sec, burst
file-writesPOST and DELETE on one file, from everyone5 a second, burst 10file_writes_per_sec, file_burst

MCP calls take from the same subject bucket as the API. [host.ai] mcp_rate_per_min still sets the rate when [host.api] does not.

The headers

Every answer says where you stand (draft IETF RateLimit header fields):

RateLimit-Policy: "subject";q=30;w=3, "file-writes";q=10;w=2
RateLimit: "subject";r=29;t=1
HeaderMeaning
RateLimit-PolicyThe buckets that apply: q is the burst, w the seconds an empty bucket takes to refill. file-writes appears on writes only.
RateLimitThe bucket closest to empty: r requests remaining, t seconds until it is full again.

When a bucket is empty

The answer is 429 RATE_LIMITED with Retry-After (seconds). Wait that long, then retry; keep the same Idempotency-Key for a write.

HTTP/1.1 429 Too Many Requests
Content-Type: application/problem+json
Retry-After: 1
RateLimit: "subject";r=0;t=3

{"type": "urn:opencanvas:problem:rate-limited", "title": "Too Many Requests", "status": 429,
 "detail": "too many requests (subject limit); retry later", "code": "RATE_LIMITED"}

The clients retry 429 and 503 after Retry-After (else 500 ms doubling, at most 30 seconds), 3 times by default. In your own code:

Retry after 429
for attempt in 1 2 3 4; do
  status=$(curl -s -o page.json -w '%{http_code}' -D headers.txt \
    "https://canvas.example.com/api/v1/files/doc_1" \
    -H "X-OpenCanvas-Host: acme" -H "X-OpenCanvas-Key: $OC_API_KEY")
  [ "$status" != 429 ] && break
  sleep "$(awk 'tolower($1) == "retry-after:" { print $2 + 0 }' headers.txt)"
done

Other limits

  • At most 100 event streams per file on one server (429 TOO_MANY_STREAMS).
  • At most 200 rows per rows:upsert and per page of queryRows; at most 100 blocks per page of listBlocks.
  • Import files up to 5 MiB; CSV up to 10,000 rows and 200 columns (413 IMPORT_TOO_LARGE).
  • A batch that deletes more than 5 blocks needs "confirm": true.

Last changed .