N Docs
← Back to site

Errors

2 min readUpdated November 23, 2026

Errors answer with an HTTP status and JSON. Check the status first, then code where there is one, and show error to people: it’s written in plain words.

{ "error": "A client with this external_id already exists", "code": "external_id_taken" }

Statuses#

StatusMeansWhat to do
400, 422Something in the request is wrong; error says what, like destination_url must be a full http:// or https:// address.Fix the request. Don’t retry as is.
401No key, or a wrong or revoked one.Check the key and header.
403The key can’t do this: read only, account paused, a plan limit (link_limit, click_limit) or a feature not on the plan.Show error. Upgrading or a different key may help.
404No such link, client or domain, or not yours.Check the id or reference.
409Already taken: an ending on that domain, an external_id, a domain.Choose another value.
429Too many requests for the key’s rate limit (rate_limited); wait the seconds it says.Wait, then retry.
503Something isn’t set up yet, like domains_not_set_up, or the database couldn’t be reached.Retry after a few seconds; check setup if it persists.

Codes you may want to handle#

CodeStatusMeaning
link_limit403The account has reached its link limit.
click_limit403The account reached its monthly click limit; new links wait until the month resets.
rate_limited429Too many requests this minute for this key.
external_id_taken409Another client already has this external_id.
domains_not_set_up503Domains over the API isn’t turned on.

Retrying safely#

Retry only 429 and 503, with a growing wait between tries (for example 1, 2, 4 seconds). Other errors won’t change by retrying.

async function call(url, opts, tries = 3) {
  for (let i = 0; i < tries; i++) {
    const res = await fetch(url, opts);
    if (res.status !== 429 && res.status !== 503) return res;
    await new Promise(r => setTimeout(r, 1000 * 2 ** i));
  }
  throw new Error('Nahnu Links API is busy, try again later');
}

Creating a link twice with the same ending is safe: the second call answers 409, not a duplicate link.