Welcome to Nebutra Sailor Docs 🎉
ChangelogIntroductionLicensing
Help Center (External) ↗

Rate Limits

Understanding Nebutra's rate limit headers, per-tenant quotas, and how to handle 429 responses gracefully.

Overview

Nebutra enforces two types of limits:

  1. Rate limits — requests per second / minute, enforced per tenant, per endpoint
  2. Quotas — monthly usage caps (API calls, AI tokens), enforced per billing plan

Rate limit headers

Every API response includes these headers:

HeaderDescription
x-ratelimit-limitRequests allowed in the current window
x-ratelimit-remainingRequests remaining in the current window
x-ratelimit-resetUnix timestamp when the window resets
retry-afterSeconds to wait before retrying (only on 429)

Example response headers:

x-ratelimit-limit: 1000
x-ratelimit-remaining: 847
x-ratelimit-reset: 1743430800

Default limits by plan

PlanAPI calls/monthAI tokens/monthRequests/minute
FREE1,000100,00060
PRO100,0005,000,000600
ENTERPRISEUnlimitedUnlimitedCustom

Handling 429 responses

When you exceed a rate limit, the API returns:

HTTP/1.1 429 Too Many Requests
retry-after: 12

{
  "success": false,
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests. Retry after 12 seconds.",
    "details": {
      "limit": 60,
      "window": "1m",
      "retry_after": 12
    }
  }
}

Retry with exponential backoff

async function fetchWithRetry(url: string, options?: RequestInit, maxRetries = 3) {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    const res = await fetch(url, options);

    if (res.status !== 429) return res;

    if (attempt === maxRetries) throw new Error("Max retries exceeded");

    const retryAfter = parseInt(res.headers.get("retry-after") ?? "1", 10);
    const backoff = retryAfter * 1000 * Math.pow(2, attempt);

    await new Promise((resolve) => setTimeout(resolve, backoff));
  }
}

There's no client SDK to configure retries on — fetchWithRetry above (or your own HTTP client's retry policy) is the actual pattern, since backends/gateway is the only API surface.

Checking quota usage

Server-side, query current quota usage with @nebutra/metering:

import { getMetering } from "@nebutra/metering";

const metering = await getMetering();
const quota = await metering.getQuota(tenantId, "api_calls", "monthly");
// → {
//     meterId: "api_calls",
//     tenantId,
//     limit: 1000,
//     used: 847,
//     remaining: 153,
//     percentage: 84.7,   // 0–100, not a 0–1 fraction
//     period: "monthly",
//     periodStart: "2026-03-01T00:00:00Z",
//     periodEnd: "2026-04-01T00:00:00Z",
//   }

if (quota && quota.percentage > 90) {
  // Warn user / prompt upgrade
}

Quota warnings

Nebutra automatically sends transactional emails when a tenant reaches:

  • 80% of their monthly quota — warning email
  • 100% of their quota — exceeded email with upgrade prompt

You can customize these email templates in Sanity Studio or via Resend's template editor.

Raising limits

  • FREE → PRO: Upgrade from the billing settings page
  • PRO → ENTERPRISE: Contact us for custom limits
  • Temporary burst: For one-time high-volume operations, contact support

Related

Billing Model

Plan quotas and metering details.

Error Handling

Full error code reference and retry strategies.

How is this guide?

Edit on GitHub

Last updated on

On this page

Overview
Rate limit headers
Default limits by plan
Handling 429 responses
Retry with exponential backoff
Checking quota usage
Quota warnings
Raising limits
Related