NeccessoryNeccessory
Cloud

Limits & quotas

Every limit on cloud measurements and the API, the per-key controls you set, and how to handle rate limiting.

Fixed limits apply to every organization. Per-key controls are yours to set: they cap traffic and spend for each integration separately.

Limits

LimitValue
Cloud session length20–180 seconds, default 60
Session tokenValid for 5 minutes, one measurement
Video fileUp to 256 MB, 20–180 seconds, at least 20 fps
Upload URLValid for 15 minutes
Uploaded fileDeleted when its job finishes, at most 1 hour after the upload URL was created
JSON request body256 KB. A larger body fails with 413 payload_too_large
Request signatureTimestamp within 5 minutes of server time; each nonce accepted once
idempotencyKey16–200 characters
userRef1–64 characters
Usage log, GET /sdk/v1/logs60 requests per minute per key
Report creation30 per hour per key
Organization webhooks5 endpoints
Webhook delivery3 attempts, 10 seconds each
Requests per minute per keyYour setting, up to 6,000

Per-key controls

Set them for each key in Console → Keys → Limits & scopes. Changes apply immediately.

ControlValuesWhen exceeded
Requests per minute0 (no limit) to 6,000429 rate_limited on any signed request
Cloud seconds per monthAny number, or no limit403 quota_exceeded when you create a session or job
Monthly spend ceilingAmount in USD, stored in tokens403 token_quota_exceeded when you create a session or job
Metric setsAny of hrv, bp, spo2, emotion, gaze; none selected means all403 feature_not_allowed when a session or job requests another set

Monthly quotas start over on the first day of each calendar month, UTC.

  • Cloud seconds. A session is refused when its durationSec does not fit into the seconds left this month. A video job is refused once the month's seconds are used up.
  • Spend ceiling. Checked against the estimated cost of the session or job — see Pricing.
  • Running measurements. A measurement that has started always finishes. Limits apply when you create the next one.
  • Test keys. The rate limit and metric sets apply. Cloud seconds and the spend ceiling do not.

The organization balance is a separate check: 403 insufficient_tokens when it cannot cover the estimate.

Read the current values

POST /sdk/v1/auth/test returns the calling key's settings:

FieldDescription
rateLimitPerMinRequests per minute. 0 means no limit
quotaSecondsMonthCloud seconds per month. null means no limit
tokenQuotaMonthMonthly spend ceiling, tokens. null means no limit
featuresAllowed metric sets. null means all
tokenBalanceThe organization's token balance

Rate limiting

When a limit applies to a request, the response carries three headers:

HeaderDescription
RateLimit-LimitRequests allowed in the current window
RateLimit-RemainingRequests left in the current window
RateLimit-ResetSeconds until the window resets

The window is one minute for the per-key limit and for the usage log, and one hour for report creation.

On 429 rate_limited, wait RateLimit-Reset seconds, or back off exponentially with jitter. Sign every retry again: a rate-limited request has already used its nonce, so resending the same signed request fails with 401 unauthorized.

async function withBackoff(send, maxAttempts = 5) {
  for (let attempt = 1; ; attempt += 1) {
    const res = await send();
    if (res.status !== 429 || attempt === maxAttempts) return res;
    const resetSec = Number(res.headers.get('RateLimit-Reset'));
    const delayMs = resetSec > 0 ? resetSec * 1000 : 1000 * 2 ** (attempt - 1);
    await new Promise((resolve) => setTimeout(resolve, delayMs + Math.random() * 500));
  }
}

const res = await withBackoff(() =>
  fetch('https://neccessory.com/sdk/v1/logs?limit=200', {
    headers: signedHeaders('GET', '/sdk/v1/logs', ''),
  }),
);

signedHeaders() is the signing helper from Cloud sessions. The function passed to withBackoff signs each attempt anew.

Limits API

GET /api/v1/limits returns the fixed limits. It needs no signature. Call it from your server — it is not available from the browser.

{
  "ok": true,
  "data": {
    "keyRateLimitPerMinMax": 6000,
    "orgWebhookLimit": 5,
    "webhookAttempts": 3,
    "measurementBaseDurationSec": 30,
    "cloudMinDurationSec": 20,
    "cloudMaxDurationSec": 180,
    "exportRowCap": 50000,
    "maxWindowDays": 366
  }
}
FieldDescription
keyRateLimitPerMinMaxHighest requests-per-minute value you can set on a key
orgWebhookLimitWebhook endpoints per organization
webhookAttemptsDelivery attempts per webhook event
measurementBaseDurationSecMeasurement length behind the reference price, seconds
cloudMinDurationSec, cloudMaxDurationSecAllowed cloud session length, seconds
exportRowCapMost rows in one console export
maxWindowDaysLongest custom date range in console views and exports, days

Every error code and its fix is listed in Errors.