Plan limits

Read your limits and usage before you reach a limit, and learn what each error means.

Docs menu

Read your limits and usage

tenant.usage.self returns your app's usage alongside each limit. These include storage bytes, documents, requests per minute, and function limits for CPU, memory, concurrency, timeout, and body and value sizes. An unset limit is null.

{"name": "substrio_tenant_usage_self", "arguments": {}}

tenant.limits reads your app's quota, document and request limits next to their live usage; account.usage reads an account's plan and usage counters across every app it has a plan or usage at.

curl -s $SUBSTRIO_URL/v1/_usage -H "Authorization: Bearer $SUBSTRIO_KEY"

Check usage before a batch import or a traffic spike, not after a request starts failing.

Function limits: CPU, heap and wall time

Every function call runs under these bounds unless your app has its own limit set:

Limit Default Over it
CPU time 5,000 ms per call 408 CF_CPU_TIMEOUT
JS heap 256 MB per isolate 413 CF_MEMORY_EXCEEDED
Wall clock 30 s waiting on fetch and timers the call fails naming the limit
Concurrency 512 calls of the app at once 429 over it

Keep a function inside these by paging large reads, avoiding unbounded loops over external data, and setting a request timeout shorter than the wall-clock limit so your own code raises the error rather than the server. See function-errors and errors-and-retries for what a limit failure looks like on the wire.

Rate limits and 429s

A key can have a requests_per_minute limit and a request_budget, set at creation or with account.key.update or tenant.key.update. A request over the per-minute limit returns 429 with Retry-After. An exhausted budget also returns 429, but it never refills. Raise the budget or rotate the key. You can add rules with rate_limit.set to bound traffic beyond the app-wide limit. Each rule permits at most max_requests per window_seconds, counted by ip, token, or tenant.

{"name": "substrio_rate_limit_set", "arguments": {"path": "/orders", "method": "POST", "by": "ip", "max_requests": 60, "window_seconds": 60}}

A rule counts the paths it names, even when a wider route serves them. A rule on /api/login limits that path under a wider route such as /api/*, and /api/feed stays open. A trailing slash, an escaped character, a doubled slash, and a dot segment all count against the rule, so a different spelling of a path does not avoid its limit. A pattern with a {capture} covers the whole route it matches.

When a response includes Retry-After, wait at least that long before retrying. See errors-and-retries for backoff.

Storage quotas and 507s

A write over the app's storage_bytes_limit or documents_limit answers 507 and stores nothing. Check tenant.usage.self against these limits (tenant.limits reads them) before a bulk write. Raise them by moving the account to a larger plan (account.plan.checkout returns the page to pay for one); a retry fails the same way until the limit changes.