Skip to main content

Rate Limits

Overview​

FileSpin limits how fast the API can be called, so that one busy integration cannot slow FileSpin down for everyone else. When a limit is reached, the API returns 429 Too Many Requests. Nothing is lost: the request was refused before it did any work, so it is safe to send again after waiting.

A refused request is not billed as an API call.

Your account's limit​

Each account has a request rate set by its subscription plan:

  • One limit per account. Every user, API key, OAuth app, the dashboard and the AI chat of the same account share it. Adding more API keys does not raise the limit.
  • Requests per second, with a burst. The account can briefly go above its rate, up to its burst size (for example, a dashboard page that loads many things at once), and then settles back to the rate.
  • Bulk calls count by size. A bulk call counts as one request for every 10 assets it carries. A bulk data call for 100 assets counts as 10.
  • Enterprise and custom plans have limits agreed for the account. If your integration needs more, contact Support.

Every response from a limited endpoint tells you where you stand:

HeaderMeaning
RateLimit-LimitYour account's limit, in requests per second
RateLimit-RemainingRequests you can still send right now without waiting
RateLimit-ResetSeconds until your allowance is fully refilled
Retry-AfterOnly on a 429: seconds to wait before retrying

These headers can be read by browser code too (they are listed in Access-Control-Expose-Headers).

The two kinds of 429​

A 429 from the rate limiter has a JSON body with a code that says why it was refused:

{
"status": "ERROR",
"message": "Too many requests for this account. Please slow down and retry shortly.",
"code": "rate_limited"
}
codeWhat happenedWhat to do
rate_limitedYour account sent requests faster than its plan allows.Wait Retry-After seconds, then send fewer requests per second.
service_busyFileSpin is busy right now. This is not caused by your account's usage.Wait Retry-After seconds and retry. The limit lifts by itself, usually within seconds.

Some 429 responses have no JSON body, for example when many requests come from one IP address without valid credentials. Treat them the same way: wait and retry.

Invalid requests​

Requests that can never succeed, such as asking again and again for an asset that does not exist or using an invalid API key, may be limited for longer and are not reset automatically. If you see this for a valid asset id or a valid API key, please contact Support.

Handling 429 responses​

  1. Always honour Retry-After. Wait at least that many seconds before sending the same request again.
  2. Back off when there is no header. Wait 1 second, then 2, then 4, and so on, with a little random jitter so that many workers don't all retry at the same moment.
  3. Watch RateLimit-Remaining. When it gets close to 0, slow down before you are refused.
  4. Spread work out. Run a large job at a steady rate instead of all at once, and use a small number of parallel workers. More parallel workers on one account do not get more requests through, because they share one limit.
  5. Use bulk endpoints and caching where the API offers them, so you need fewer calls.

An example in Python:

import random
import time

import requests


def call_filespin(method, url, **kwargs):
for attempt in range(6):
resp = requests.request(method, url, **kwargs)
if resp.status_code != 429:
return resp
wait = resp.headers.get("Retry-After")
if wait and wait.isdigit():
delay = int(wait)
else:
delay = 2 ** attempt
time.sleep(delay + random.uniform(0, 0.5))
return resp

If you need a higher limit or help with a limit you don't expect, contact the FileSpin Support team at support@filespin.io.