instaenv
DevelopersGet an API key

Developers

Rate limits

Each API key can make 120 requests per minute. Every response tells you where you stand.

Headers

HeaderMeaning
RateLimit-LimitRequests allowed per window (120).
RateLimit-RemainingRequests left in the current window.
RateLimit-ResetSeconds until the window resets.
Retry-AfterOnly on 429: seconds to wait before retrying.
HTTP
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
RateLimit-Limit: 120
RateLimit-Remaining: 0
RateLimit-Reset: 23
Retry-After: 23

{"error":{"code":"rate_limited","message":"Too many requests. Retry in 23 seconds."}}

Staying under the limit

  • Use webhooks instead of polling for changes.
  • Ask for 100 items per page when you walk a list.
  • Use updated_since to fetch only what changed.
  • On 429, wait for Retry-After and retry; do not retry in a tight loop.
async function instaenvFetch(url, init = {}, attempt = 0) {
  const res = await fetch(url, init);
  if (res.status === 429 && attempt < 5) {
    const waitSeconds = Number(res.headers.get("Retry-After")) || 2 ** attempt;
    await new Promise((resolve) => setTimeout(resolve, waitSeconds * 1000));
    return instaenvFetch(url, init, attempt + 1);
  }
  return res;
}