GuidesTroubleshooting

Troubleshooting and Errors

Resolve common issues with API calls, understand error codes, and optimize for reliability.

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Too many requests. Retry after 60 seconds.",
    "retry_after": 60
  }
}

HTTP Status Codes

Chuger API returns standard HTTP status codes. Most requests succeed with 200 OK. Review the table below for common codes.

Status CodeMeaningAction
200SuccessProcess the response.
400Bad RequestCheck request parameters like URL format.
401UnauthorizedVerify your Authorization header uses Bearer YOUR_API_KEY.
429Rate Limit ExceededImplement exponential backoff.
402Payment RequiredTop up credits in your dashboard.
500Server ErrorRetry after a delay; contact support if persistent.

Always inspect the X-Request-Id header in responses to reference failed requests in support tickets.

Rate Limits and Credits

Chuger enforces rate limits per API key to ensure fair usage. Exceeding limits returns 429 Too Many Requests.

Monitor usage at app.chuger.com/dashboard. Each request consumes credits based on page complexity.

Debugging Failed Requests

Follow these steps to diagnose issues.

Check Logs

Review request logs in your dashboard under "History". Note the request_id and status.

Reproduce Locally

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.chuger.com/v1/content?url=https://example.com"

Compare headers and body with your original request.

Test Playground

Use the Playground to isolate URL-specific problems without code.

Contact Support

Provide X-Request-Id, full request/response, and URL.

Retry Strategies

Implement client-side retries for transient errors like 429 or 5xx.

const fetchWithRetry = async (url, options, maxRetries = 3) => {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch(url, options);
    if (response.status === 429) {
      const retryAfter = response.headers.get('retry-after') || Math.pow(2, i) * 1000;
      await new Promise(resolve => setTimeout(resolve, retryAfter));
      continue;
    }
    if (response.ok) return response;
  }
  throw new Error('Max retries exceeded');
};

// Usage
const result = await fetchWithRetry(
  'https://api.chuger.com/v1/content',
  {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${YOUR_API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ url: 'https://example.com' })
  }
);

Optimization Tips

Reduce latency and errors with these practices.

Cache responses locally for repeated URLs. Set TTL to 1 hour for dynamic content.

Use Cache-Control headers from Chuger responses to guide your cache.