API Error Messages
These are a list of possible API error messages for HTTP and Chat API, including status codes and descriptions. These errors help diagnose issues that are related to request validation, authentication, configuration, and data formatting. Use this reference to troubleshoot and resolve API-related issues efficiently.
Common Error Codes
The AI Defense API returns standardized Chat and HTTP status codes to indicate the success or failure of a request. Below is a list of common error codes and their meanings:
| Status Code |
Description |
| 400 |
Bad Request: The request is malformed or missing required parameters. Check the request body and headers for errors. |
| 400 |
Invalid Integration Type: The provided integration_type is not valid. Ensure that you are using a supported integration type. |
| 401 |
Unauthorized: Authentication failed due to a missing or invalid API key. Verify your API credentials. |
| 403 |
Forbidden: The request is authenticated but does not have permission to access the resource. Ensure your API key has the necessary permissions. |
| 500 |
Internal Server Error: An unexpected error occurred on the server. Try again later or contact support if the issue persists. |
Chat API Errors
| Status Code |
Error Message |
Description |
| 400 |
Failed to parse request headers: failed to get metadata from incoming gRPC context |
Request headers are malformed or missing required metadata. |
| 400 |
Failed to parse request headers: invalid context header: x-aidefense-context |
The provided context header is incorrect. |
| 400 |
Input messages not found for inspection |
The request did not contain any input messages. |
| 400 |
Failed to get content: last message in input list cannot be empty. |
The last message in the input sequence cannot be blank. |
| 400 |
Failed to get content: given role is invalid, it should be one of assistant, user, or system. |
The system does not recognize the assigned role as valid. |
| 400 |
Failed to get content: buildOpenAIResponseFromMessages: unable to parse prompt content. |
The AI model could not process the provided prompt. |
| 400 |
Failed to get content: buildOpenAIResponseFromMessages: unable to parse response content. |
The system could not parse the response content from the AI model. |
HTTP API Errors
| Status Code |
Error Message |
Description |
| 400 |
HTTP request is missing. |
The request payload is empty or missing. |
| 400 |
HTTP meta is missing. |
The necessary metadata for processing is not included. |
| 400 |
Config is missing. |
Required configuration parameters are absent. |
| 400 |
Destination URL is missing. |
No target URL specified in the request. |
| 400 |
Invalid URL |
The provided URL format is incorrect. |
| 400 |
Request body is not in base64: |
The request body must be base64-encoded, but it is not. |
| 400 |
Request body is not in valid format. |
The structure of the request body does not match expectations. |
| 400 |
Response body is not base64. |
The response body must be base64-encoded, but it is not. |
| 400 |
Response body is not in valid format. |
The structure of the response body is incorrect. |
Sample Error Codes
{
"code": 400,
"message": "Bad Request: Invalid JSON"
},
{
"code": 400,
"message": "Invalid integration type. This is for internal use only."
},
{
"code": 400,
"message": "Failed to get content: last message in input list cannot be empty."
},
{
"code": 400,
"message": "Input messages not found for inspection."
}