Error Codes
Reference for API error responses.
Error Response Format
All errors return JSON with the following structure:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description"
}
}HTTP Status Codes
| Status | Code | Description |
|---|---|---|
400 | BAD_REQUEST | Invalid request format or missing required fields |
401 | UNAUTHORIZED | Missing or invalid API key |
403 | FORBIDDEN | API key doesn’t have permission for this operation |
413 | PAYLOAD_TOO_LARGE | File exceeds maximum size limit (10MB) |
415 | UNSUPPORTED_TYPE | File type not supported for scanning |
429 | RATE_LIMITED | Too many requests, check Retry-After header |
500 | INTERNAL_ERROR | Server error, please retry or contact support |
Example Error Responses
Invalid API Key
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API key"
}
}Rate Limited
{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Please retry later."
}
}Response headers include:
| Header | Description |
|---|---|
Retry-After | Seconds until you can retry |
X-RateLimit-Limit | Requests allowed per minute |
X-RateLimit-Remaining | Requests remaining in window |
File Too Large
{
"success": false,
"error": {
"code": "PAYLOAD_TOO_LARGE",
"message": "File exceeds 10MB limit"
}
}Unsupported File Type
{
"success": false,
"error": {
"code": "UNSUPPORTED_TYPE",
"message": "File type '.exe' is not supported"
}
}Handling Errors
Best practices for error handling:
import requests
response = requests.post(
"https://api.inkog.io/api/v1/scan",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": open("agent.py", "rb")}
)
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 60))
print(f"Rate limited. Retry in {retry_after} seconds")
elif response.status_code == 401:
print("Check your API key")
elif not response.ok:
error = response.json().get("error", {})
print(f"Error: {error.get('message')}")
else:
result = response.json()
print(f"Found {result['findings_count']} issues")Last updated on