Skip to main content

Error Handling

Understanding and handling Wryn API errors.

Error Response Format​

All errors return this structure:

{
"error": {
"code": "invalid_request",
"message": "The 'url' parameter is required",
"details": {
"parameter": "url"
}
}
}

HTTP Status Codes​

StatusMeaningAction
200SuccessRequest completed
400Bad RequestFix request parameters
401UnauthorizedCheck API key
403ForbiddenContact support
404Not FoundVerify endpoint URL
429Too Many RequestsImplement rate limiting
500Server ErrorRetry or contact support

Error Codes​

Authentication Errors​

unauthorized - Invalid API key

{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}

forbidden - IP not whitelisted

{
"error": {
"code": "forbidden",
"message": "IP address not whitelisted"
}
}

Request Errors​

invalid_request - Missing or invalid parameters invalid_url - URL format is invalid rate_limit_exceeded - Too many requests

Scraping Errors​

page_not_found - Target page returned 404 timeout - Request took too long blocked - Unable to bypass anti-bot protection

Error Handling Example​

import requests

try:
response = requests.post(
'https://api.wryn.io/v1/scrape',
headers={'Authorization': f'Bearer {api_key}'},
json={'url': 'https://example.com'}
)
response.raise_for_status()
data = response.json()
except requests.exceptions.HTTPError as e:
if e.response.status_code == 429:
# Rate limited - wait and retry
time.sleep(60)
retry()
elif e.response.status_code == 401:
# Invalid API key
print("Check your API key")
else:
print(f"Error: {e.response.json()['error']['message']}")

Next Steps​