Skip to content
noxstock
Guides

Errors and retries

Read noxstock error envelopes and retry only when it is safe.

Every error response uses this shape:

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded. Please slow request rate and retry.",
    "retryable": true
  }
}

Retry policy

CodeHTTPRetry?What to do
UNAUTHORIZED401NoCheck X-API-Key; rotate/recreate if revoked.
PLAN_UPGRADE_REQUIRED403NoUpgrade to Starter/Builder or use free routes.
SYMBOL_INVALID400NoFix ticker format.
SYMBOL_UNKNOWN404NoUse /v2/search and /v2/coverage.
PARAM_INVALID400NoFix query params.
RATE_LIMITED429YesWait Retry-After or until X-RateLimit-Reset.
UPSTREAM_UNAVAILABLE503YesRetry with backoff.
AUTH_UPSTREAM_UNAVAILABLE503YesRetry shortly; API key verification is temporarily unavailable.
PREREQUISITE_MISSING409No/conditionalCall the underlying route first if your workflow depends on cached prerequisites.

JavaScript retry example

async function requestWithRetry(url: string, apiKey: string, attempts = 3) {
  for (let attempt = 1; attempt <= attempts; attempt++) {
    const res = await fetch(url, { headers: { "X-API-Key": apiKey } });
    const body = await res.json();

    if (res.ok) return body.data;

    const retryable = body?.error?.retryable === true;
    if (!retryable || attempt === attempts) throw new Error(body.error.message);

    const retryAfter = Number(res.headers.get("Retry-After") ?? "1");
    await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
  }
}

Common mistakes

  • Retrying UNAUTHORIZED after a key was revoked.
  • Treating PLAN_UPGRADE_REQUIRED as an outage.
  • Ignoring Retry-After on 429/503.
  • Parsing the response as raw endpoint data instead of { data }.