Indax

Errors and limits

Every error, the rate limits, and how to retry.

Error format

Every HTTPS error is JSON with a code you can branch on and a message you can show:

{ "error": "rate_limited", "message": "More than 120 searches a minute with this key. Wait a moment, then try again." }
StatuserrorMeaningWhat to do
400invalidA field is missing or out of range. The message names it.Fix the request.
401unauthorizedNo key, a wrong key, or a revoked key.Check the key.
402credits_exhaustedYour plan's credits for this period are used up.Show a fallback; an admin adds credits.
403forbidden_originThe browser's site is not on the key's allowed websites.Add the site to the key in the Indax app.
403server_only_keyA server-only key was used from a browser.Use a website key in the browser.
404unknown_companydomain names a company that is not on the Indax network.Check the domain.
429rate_limitedToo many requests. Retry-After says how many seconds to wait.Wait, then retry.
429budgetChat is paused for today for your company.Retry tomorrow; search still works.
502search_failed, chat_failedIndax could not answer. Not charged.Retry once after 1 second.
503unavailableThe API is paused for maintenance.Retry later.

In chat, errors arrive as error objects with a code: busy (a message arrived before done), rate_limited, budget (chat paused for today), invalid (empty, too long, or 30 messages reached), model_error or chat_failed (try again). WebSocket close codes: see Chat.

Limits

LimitValue
Searches per key120 a minute
Chat messages per visitor (session_id, else IP address)20 every 10 minutes
Open chat sockets per IP address20
q200 characters
Chat message2,000 characters
Messages in one conversation30 visitor messages
Page context trail50 accepted, newest 20 used
Results per search page / per query50 / 100
Idle chat socketClosed after 15 minutes

Need higher limits? Email andre@indax.co.

Retry

async function withRetry(fn, tries = 3) {
  for (let i = 0; ; i++) {
    const res = await fn();
    if (res.ok || i === tries - 1) return res;
    if (res.status === 429) {
      await new Promise((r) => setTimeout(r, Number(res.headers.get("retry-after") || 2) * 1000));
    } else if (res.status >= 500) {
      await new Promise((r) => setTimeout(r, 1000 * (i + 1)));
    } else {
      return res; // 4xx other than 429: retrying will not help
    }
  }
}

Send the same x-request-id on each try, so a retried search is charged once.

On this page