Error Codes
All errors return a consistent format with actionable suggestions.
Error Response Format
{
"error": {
"code": "error_code",
"message": "Human-readable description",
"suggestion": "How to fix it"
}
}
Error Reference
| Code | HTTP | Description | Suggestion |
invalid_api_key | 401 | API key missing or invalid | Check your API key in the dashboard |
rate_limited | 429 | Too many requests | Wait and retry, or upgrade |
session_not_found | 404 | Session ID doesn't exist | Check the session_id from sanitize |
session_expired | 410 | Session has expired | Sessions last 24 hours, re-sanitize |
empty_text | 400 | Text field is empty | Provide text to sanitize |
text_too_large | 413 | Text exceeds 100KB | Split into smaller chunks |
invalid_pattern | 400 | Regex pattern is invalid | Check your pattern syntax |
pattern_not_found | 404 | Pattern ID doesn't exist | List patterns to find valid IDs |
Rate Limits
| Tier | Requests/minute |
| Free | 60 |
| Pro | 1,000 |
| Team | 1,000 |
| Enterprise | Custom |
Rate Limit Headers
| Header | Description |
X-RateLimit-Limit | Your rate limit |
X-RateLimit-Remaining | Requests remaining |
X-RateLimit-Reset | Unix timestamp when limit resets |
Handling Errors in Python
from ambientmeta import AmbientMeta
from ambientmeta.errors import RateLimitError, SessionExpiredError
client = AmbientMeta()
try:
result = client.sanitize(text)
except RateLimitError as e:
print(f"Rate limited. Retry in {e.retry_after}s")
except SessionExpiredError:
print("Session expired, re-sanitize")