Plan limits

Read your limits and usage before you hit them, and know what each refusal means.

Docs menu

Read your limits and usage

tenant.usage.self answers your app's exact usage next to each limit (storage bytes, documents, requests per minute, and the function limits: CPU, memory, concurrency, timeout, body and value sizes), with null for any limit not set.

{"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's own requests_per_minute or request_budget (set when the key is created, or with account.key.update / tenant.key.update) answers 429 with Retry-After once spent; a request_budget never refills; raise it or rotate the key. Add your own rules with rate_limit.set (at most max_requests per window_seconds, counted per ip, token or tenant) for traffic you want bounded beyond the app-wide limit.

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

Always read Retry-After and wait 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.