docs
Search docs, tools, errors… ⌘K
Dashboard

Get started / Errors and retries

Errors and retries.

Every error has a status, a machine-readable type and a request_id. Your agent can decide what to do from the type alone.

Error shape

{
  "error": {
    "type": "window_full",
    "message": "Search window full. 0 of 7,500 records left.",
    "meter": "search_records_5h", "resets_at": "2026-11-08T15:40:00Z", "charged": 0
  },
  "request_id": "req_8f21c0"
}

Error types

StatusTypeWhat to doRetry?
400invalid_requestFix the request. Don't retry as is.Don't retry
401unauthorizedCheck the key. Stop the run.Don't retry
402free_records_exhaustedFree records are gone. Ask the user to upgrade.Don't retry
403forbiddenThe key's access level doesn't allow this tool.Don't retry
404not_foundNothing to enrich for that input. Move on.Don't retry
409idempotency_conflictSame Idempotency-Key, different body.Don't retry
429window_fullWait for Retry-After seconds, then retry.Retry
429weekly_limitWeekly records limit reached. Resume after resets_at, or use an async job.Later
429too_many_concurrentWait for a running search to finish, then retry.Retry
500internal_errorRetry with backoff, same Idempotency-Key.Retry
503unavailableRetry with backoff. Check status.leadsets.ai.Retry

Rate-limit headers

HeaderMeaning
X-Leadsets-Records-RemainingRecords left in this tool's five-hour window
X-Leadsets-Requests-RemainingRequests left in this tool's five-hour window
X-Leadsets-Weekly-RemainingRecords left in this tool's weekly limit
X-Leadsets-Free-RemainingFree plan only: free records left
Retry-AfterOn 429: seconds until the window resets

Retrying safely

Send an Idempotency-Key on every paid call. A retry with the same key returns the first result and never counts the records twice. Keys last 24 hours.

const res = await ls.people.search(query, { idempotencyKey });
// The SDK retries 429 and 5xx for you, honouring Retry-After.
// Doing it yourself:
if (err.status === 429 && err.type === "window_full") {
  await sleep(err.retryAfter * 1000);
  return retry(query, { idempotencyKey });  // never double-charges
}

Records only when data comes back. Empty results and errors use no records. Every request counts toward the request window, hits and misses alike.

Previous
← Limits and costs
Next
search_people →