This document outlines the error codes returned by the moderation and classification APIs, along with the simplified HTTP status code mapping.
WalledProtect API Error Codes#
| Error Code | Description |
|---|
| INVALID_INPUT_TYPE | Input text is not of the expected type (string required). |
| TEXT_TOO_SHORT | Input text is shorter than the minimum required length. |
| TEXT_TOO_LONG | Input text exceeds the allowed maximum length. |
| INVALID_TOPIC_TYPE | Topic type argument is missing or invalid. |
| INVALID_PII_TYPE | PII types argument is missing or invalid. |
| INVALID_GREETING_TYPE | Greetings types argument is missing or invalid. |
| INVALID_INTENT_TYPE | Intent type argument is missing or invalid. |
| INSUFFICIENT_CREDITS_LEFT | Insufficient Walledai credits |
API Communication Errors#
| Error Code | Description |
|---|
| API_ERROR | WalledProtect API service returned an error status. |
| API_TIMEOUT | No response from WalledProtect API service within expected timeframe. |
| API_NETWORK_ERROR | Network issues prevented communication with WalledProtect API service. |
| API_RESPONSE_ERROR | Response from WalledProtect API service was invalid or unparseable. |
Response Parsing Errors#
| Error Code | Description |
|---|
| RESPONSE_PARSE_ERROR | Unable to parse or interpret response from WalledProtect service. |
| INVALID_SAFETY_SCORE | Safety score missing or outside valid range. |
| MISSING_CLASSIFICATION_FLAG | Expected classification flag (e.g. Safe/Unsafe) not found. |
System/Internal Errors#
| Error Code | Description |
|---|
| INTERNAL_ERROR | An unexpected failure occurred internally. |
WalledRedact API Error Codes#
| Error Code | Description |
|---|
| INPUT_SHORT | Input text is shorter than the minimum required length. |
| INPUT_LONG | Input text exceeds the allowed maximum length. |
| MISSING_USER_MSG | No user message found in conversation. |
| INVALID_INPUT | Invalid input type or format. |
| MISMATCHED_CONV_COUNT | Conversation message count mismatch. |
| INSUFFICIENT_CREDITS_LEFT | Insufficient Walledai credits |
API Communication Errors#
| Error Code | Description |
|---|
| MODEL_CALL_FAILED | Failed to call or communicate with the WalledRedact model service. |
Response Parsing Errors#
| Error Code | Description |
|---|
| UNEXPECTED_MODEL_OUTPUT | Model output parsing or formatting error. |
System/Internal Errors#
| Error Code | Description |
|---|
| UNKNOWN_ERROR | Unknown error / Fallback catch-all error. |
HTTP Status Code Mapping#
| Error Category | HTTP Status | Meaning |
|---|
| Authorization Errors | 403 | Any kind of authorization/auth error/ Insufficient Credits |
| Rate Limiting Errors | 429 | Too many requests / throttling |
| Client-Side Errors | 400 | All other client-side errors |
Example Error Responses#
Authorization Error Example#
{
"success": false,
"statusCode": 403,
"errorCode": "MISSING_API_KEY",
"message": "API key is missing or invalid"
}
Modified at 2025-09-02 05:55:47