Skip to main content

Retry Guidelines

When API calls or async operations fail, following proper retry patterns ensures your integration is resilient without risking account safety.

When to Retry

Error TypeRetry?Strategy
429 Too Many Requests✅ YesRetry after some time
500 Internal Server Error✅ YesExponential backoff
PROXY_ERROR✅ YesRetry after checking proxy status
SESSION_EXPIRED✅ YesRe-authenticate, then retry
WRONG_PASSWORD❌ NoFix credentials
ACCOUNT_RESTRICTED❌ NoAccount needs manual attention
CANT_RESEND_YET⏳ WaitCannot re-invite the same person within two weeks
QUEUE_TIMEOUT_THRESHOLD_EXCEEDED✅ YesRe-submit the request; reduce queue pressure by spreading workload

Exponential Backoff

For transient errors, use exponential backoff with jitter:

async function retryWithBackoff(fn, maxRetries = 5) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
return await fn();
} catch (error) {
if (attempt === maxRetries - 1) throw error;

// Don't retry client errors (except 429)
if (error.status >= 400 && error.status < 500 && error.status !== 429) {
throw error;
}

const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
const jitter = delay * (0.5 + Math.random() * 0.5);
await new Promise((resolve) => setTimeout(resolve, jitter));
}
}
}

Rate Limit Handling

When you receive a 429 response:

  1. Stop sending requests for that account immediately
  2. Queue any pending requests
  3. Resume after the wait period
warning

Never retry immediately after a 429. Doing so may compound the rate limit issue and could trigger LinkedIn safety flags.