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
}
}
{
"error": {
"code": "insufficient_credits",
"message": "No credits remaining. Visit dashboard to add funds."
}
}
HTTP Status Codes
Chuger API returns standard HTTP status codes. Most requests succeed with 200 OK. Review the table below for common codes.
| Status Code | Meaning | Action |
|---|---|---|
200 | Success | Process the response. |
400 | Bad Request | Check request parameters like URL format. |
401 | Unauthorized | Verify your Authorization header uses Bearer YOUR_API_KEY. |
429 | Rate Limit Exceeded | Implement exponential backoff. |
402 | Payment Required | Top up credits in your dashboard. |
500 | Server Error | Retry 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' })
}
);
import requests
import time
def fetch_with_retry(url, headers, max_retries=3):
for i in range(max_retries):
response = requests.post(url, headers=headers, json={"url": "https://example.com"})
if response.status_code == 429:
retry_after = int(response.headers.get('retry-after', 2 ** i * 1000)) / 1000
time.sleep(retry_after)
continue
if response.status_code == 200:
return response
raise Exception("Max retries exceeded")
# Usage
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
result = fetch_with_retry("https://api.chuger.com/v1/content", headers)
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.
Use /v1/content/bulk for multiple URLs in one call.
// Example bulk request
fetch('https://api.chuger.com/v1/content/bulk', {
method: 'POST',
headers: { 'Authorization': `Bearer ${YOUR_API_KEY}` },
body: JSON.stringify({
urls: ['https://example.com', 'https://example.org']
})
});
For AI assistants, ensure MCP client handles retries automatically.
// Parse Chuger-specific errors
const handleChugerError = (response) => {
const contentType = response.headers.get('content-type');
if (contentType && contentType.includes('application/json')) {
const error = response.json();
switch (error.code) {
case 'invalid_url':
console.error('Provide a valid HTTPS URL.');
break;
case 'blocked_domain':
console.error('Domain blocked by policy. Use proxy.');
break;
default:
console.error(`Chuger error: ${error.message}`);
}
}
};
Last updated today
Built with Documentation.AI