Reaktly Docs
Integrations

Error Handling

Handle errors and implement retry logic for reliable ingestion.

HTTP Status Codes

CodeMeaningAction
200Success — item queued✅ Continue
400Bad request — validation errorFix the payload
401Unauthorized — invalid API keyCheck your API key
403Forbidden — insufficient scopes or expired keyVerify key has iq:import scope
413Payload too largeReduce batch size or content length
429Rate limitedBack off and retry
500Server errorRetry with exponential backoff

Retry Strategy

Implement exponential backoff with jitter for resilient integrations:

async function ingestWithRetry(payload: any, maxRetries = 3) {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    const response = await fetch('https://api.reaktly.com/ingest', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': process.env.REAKTLY_API_KEY!,
      },
      body: JSON.stringify(payload),
    });

    if (response.ok) return response.json();

    const isRetryable = [429, 500, 502, 503].includes(response.status);
    if (!isRetryable || attempt === maxRetries) {
      throw new Error(`Ingestion failed: ${response.status}`);
    }

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

On this page