Errors
Understand API errors and how to handle them
The API uses standard HTTP status codes and returns consistent error responses.
Error Response Format
All errors follow this structure:
{
"error": "Error Type",
"message": "Detailed error message"
}HTTP Status Codes
| Status | Description |
|---|---|
200 OK | Request succeeded |
400 Bad Request | Invalid request parameters |
401 Unauthorized | Missing or invalid API key |
404 Not Found | Resource not found |
429 Too Many Requests | Rate limit exceeded |
500 Internal Server Error | Server error |
501 Not Implemented | Endpoint not implemented |
Common Errors
Authentication Errors
401 Unauthorized
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}Causes:
- Missing
x-api-keyheader - Invalid API key
- Revoked API key
Solution: Verify your API key is correct and included in the request header.
Rate Limit Errors
429 Too Many Requests
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Please retry after 60 seconds."
}Solution: Implement rate limit handling using the X-RateLimit-Reset header. See Rate Limits for details.
Not Found Errors
404 Not Found
{
"error": "Not Found",
"message": "App not found"
}Causes:
- Invalid app handle
- App removed from the marketplace
- Incorrect category or developer handle
Solution: Verify the handle/resource ID is correct.
Server Errors
500 Internal Server Error
{
"error": "Internal Server Error",
"message": "An unexpected error occurred"
}Solution: Retry the request after a delay. If the error persists, contact support.
Error Handling Best Practices
1. Always Check Response Status
const response = await fetch(url, {
headers: { 'x-api-key': apiKey }
});
if (!response.ok) {
const error = await response.json();
console.error(`Error ${response.status}:`, error.message);
throw new Error(error.message);
}
const data = await response.json();2. Implement Retry Logic
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const response = await fetch(url, options);
if (response.ok) return await response.json();
// Don't retry client errors (4xx)
if (response.status >= 400 && response.status < 500) {
const error = await response.json();
throw new Error(error.message);
}
// Retry server errors (5xx) with exponential backoff
if (response.status >= 500) {
const waitTime = Math.pow(2, attempt) * 1000;
await new Promise(resolve => setTimeout(resolve, waitTime));
continue;
}
} catch (error) {
if (attempt === maxRetries - 1) throw error;
// Network error - retry
await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)));
}
}
}3. Handle Specific Error Codes
function handleApiError(status, message) {
switch (status) {
case 401:
// Redirect to login or show auth error
break;
case 429:
// Show rate limit message and retry time
break;
case 404:
// Show not found message
break;
case 500:
// Show generic error with retry option
break;
default:
// Show generic error
}
}4. Log Errors for Debugging
async function makeRequest(url, options) {
try {
const response = await fetch(url, options);
if (!response.ok) {
const error = await response.json();
// Log error details
console.error({
url,
status: response.status,
error: error.error,
message: error.message,
timestamp: new Date().toISOString()
});
throw new Error(error.message);
}
return await response.json();
} catch (error) {
// Log network errors
console.error('Network error:', error.message);
throw error;
}
}Getting Help
If you encounter an error not documented here, or if an issue persists:
- Check the API Reference for endpoint-specific requirements
- Review Rate Limits to ensure you're within quotas
- Contact support at support@appmarketscraper.com
When contacting support, please include:
- The endpoint you were calling
- The error response you received
- Your request parameters (without sensitive data)
- Your API key prefix (first 8 characters)