Error Codes Reference
Comprehensive list of API error codes with causes and solutions.
Error Response Format
All errors follow this consistent structure:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description",
"details": { ... }
},
"meta": {
"request_id": "req_abc123xyz"
}
}Error Handling Example
async function extractMetadata(url: string) {
const response = await fetch(
`https://api.katsau.com/v1/extract?url=${encodeURIComponent(url)}`,
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
const data = await response.json();
if (!data.success) {
// Handle specific error codes
switch (data.error.code) {
case 'RATE_LIMIT_EXCEEDED':
// Wait and retry
await sleep(parseInt(response.headers.get('Retry-After') || '5') * 1000);
return extractMetadata(url);
case 'TARGET_TIMEOUT':
// Try with longer timeout or skip
console.warn(`Timeout for ${url}, skipping...`);
return null;
case 'INVALID_URL':
throw new Error(`Invalid URL: ${url}`);
default:
throw new Error(`API Error: ${data.error.message}`);
}
}
return data.data;
}HTTP Status Codes
Authentication Errors
MISSING_API_KEY401No API key provided in request
The Authorization header is missing or empty
Add the Authorization header with your API key: Authorization: Bearer ks_live_xxx
INVALID_API_KEY401API key is malformed or does not exist
The API key format is wrong or was deleted
Check your API key in the dashboard. Keys should start with ks_live_ or ks_test_
API_KEY_REVOKED401API key has been revoked
The key was manually revoked from the dashboard
Generate a new API key from the dashboard and update your application
API_KEY_EXPIRED401API key has expired
Test keys expire after 30 days of inactivity
Create a new test key or upgrade to a live key for permanent access
Validation Errors
MISSING_URL400Required URL parameter not provided
The url query parameter is missing from the request
Add the url parameter: /v1/extract?url=https://example.com
INVALID_URL400URL is malformed or uses unsupported protocol
The URL format is invalid or uses a protocol other than http/https
Ensure the URL starts with http:// or https:// and is properly encoded
URL_TOO_LONG400URL exceeds maximum length
URLs longer than 2048 characters are not supported
Use a URL shortener or reduce query parameters in the target URL
INVALID_PARAMETER400One or more parameters have invalid values
A parameter value is outside accepted range or wrong type
Check the API documentation for valid parameter values
INVALID_BODY400Request body is not valid JSON
POST request body contains malformed JSON
Validate your JSON using a JSON linter before sending
Rate Limiting Errors
RATE_LIMIT_EXCEEDED429Too many requests in a short time window
You have exceeded the requests per second limit for your plan
Implement exponential backoff. Check X-RateLimit-Reset header for retry time
// Implement retry with exponential backoff
async function fetchWithRetry(url, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || Math.pow(2, i);
await new Promise(r => setTimeout(r, retryAfter * 1000));
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}QUOTA_EXCEEDED403Monthly request quota has been reached
You have used all requests included in your plan for this billing period
Upgrade your plan or wait for the next billing cycle to reset your quota
CONCURRENT_LIMIT429Too many concurrent requests
You have exceeded the maximum number of parallel requests
Queue requests and limit concurrency. Use Promise.all with batching
Target URL Errors
TARGET_UNREACHABLE502Could not connect to target URL
The target server is down, blocking our requests, or DNS resolution failed
Verify the URL is accessible. Some sites block automated requests
TARGET_TIMEOUT504Target URL did not respond in time
The target server took longer than 10 seconds to respond
The target site may be slow. Try again later or use caching
TARGET_BLOCKED403Target URL blocked our request
The target site has bot protection or blocks our IP range
Some sites cannot be scraped. Consider using their official API instead
TARGET_SSL_ERROR502SSL/TLS certificate validation failed
The target site has an invalid or expired SSL certificate
Contact the target site owner to fix their SSL certificate
ROBOTS_BLOCKED403Target URL disallows crawling via robots.txt
The site robots.txt file blocks automated access
Respect robots.txt or contact the site owner for permission
Content Errors
PARSE_ERROR422Could not parse page content
The HTML is malformed or uses unsupported encoding
Ensure the target page returns valid HTML with proper charset
NO_METADATA422No metadata found on page
The page has no Open Graph, Twitter Card, or standard meta tags
The page may be a SPA that requires JavaScript rendering
CONTENT_TOO_LARGE413Page content exceeds size limit
The HTML response is larger than 10MB
We cannot process extremely large pages. Contact support for enterprise limits
Server Errors
INTERNAL_ERROR500An unexpected server error occurred
Something went wrong on our end
Retry the request. If persistent, contact support with the request_id
SERVICE_UNAVAILABLE503Service temporarily unavailable
We are experiencing high load or performing maintenance
Wait a few minutes and retry. Check status.katsau.com for updates
Error Handling Best Practices
- Always check the success field before accessing response data
- Log the request_id from the meta object for debugging
- Implement exponential backoff for rate limit and server errors
- Use the error code for programmatic error handling, not the message
- Monitor rate limit headers (X-RateLimit-*) to avoid hitting limits