Skip to content

Error Codes

All IndepAI API errors follow a consistent format. This page documents all error codes and provides guidance on handling them.

{
"success": false,
"error": "Human-readable error message",
"code": "MACHINE_READABLE_CODE",
"details": [
{
"path": "fieldName",
"message": "Specific error for this field"
}
]
}
StatusMeaningWhen It Occurs
400Bad RequestInvalid input, validation failure
401UnauthorizedMissing or invalid authentication
403ForbiddenValid auth but insufficient permissions
404Not FoundResource doesn’t exist
409ConflictResource already exists or state conflict
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server error
503Service UnavailableService temporarily down

Missing or invalid authentication token.

{
"success": false,
"error": "Unauthorized",
"code": "UNAUTHORIZED"
}

Solution: Include a valid Bearer token in the Authorization header.

Terminal window
curl -H "Authorization: Bearer YOUR_TOKEN" ...

The JWT token has expired.

{
"success": false,
"error": "Token has expired",
"code": "TOKEN_EXPIRED"
}

Solution: Refresh your token using the refresh token.

User doesn’t have permission for this action.

{
"success": false,
"error": "Access denied",
"code": "FORBIDDEN"
}

Solution: Check user permissions or upgrade subscription tier.

Endpoint requires a paid subscription.

{
"success": false,
"error": "This feature requires a Pro subscription",
"code": "SUBSCRIPTION_REQUIRED"
}

Solution: Upgrade your subscription at /settings/billing.

Request body failed validation.

{
"success": false,
"error": "Validation failed",
"code": "VALIDATION_ERROR",
"details": [
{ "path": "currentAge", "message": "Must be between 18 and 100" },
{ "path": "annualExpenses", "message": "Must be greater than 0" }
]
}

Solution: Fix the fields indicated in details.

Request body is not valid JSON.

{
"success": false,
"error": "Invalid JSON in request body",
"code": "INVALID_JSON"
}

Solution: Ensure your request body is valid JSON.

A required field is missing.

{
"success": false,
"error": "Missing required field: annualIncome",
"code": "MISSING_FIELD"
}

Solution: Include all required fields in your request.

The requested resource doesn’t exist.

{
"success": false,
"error": "Asset not found",
"code": "NOT_FOUND"
}

Solution: Verify the resource ID exists.

The API endpoint doesn’t exist.

{
"success": false,
"error": "Endpoint not found",
"code": "ENDPOINT_NOT_FOUND"
}

Solution: Check the API documentation for correct endpoint paths.

Operation conflicts with current state.

{
"success": false,
"error": "Asset with this ISIN already exists",
"code": "CONFLICT"
}

Solution: Use a unique identifier or update the existing resource.

Too many requests in the time window.

{
"success": false,
"error": "Rate limit exceeded",
"code": "RATE_LIMITED",
"retryAfter": 3600
}

Solution: Wait for retryAfter seconds or upgrade your tier.

An unexpected error occurred.

{
"success": false,
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}

Solution: Retry after a moment. If persistent, contact support.

Database operation failed.

{
"success": false,
"error": "Database operation failed",
"code": "DATABASE_ERROR"
}

Solution: Retry after a moment. This is usually temporary.

The service is temporarily unavailable.

{
"success": false,
"error": "Service temporarily unavailable",
"code": "SERVICE_UNAVAILABLE"
}

Solution: Retry with exponential backoff.

async function callAPI(endpoint: string, body: object) {
const response = await fetch(`https://indepai.app/api/v1/${endpoint}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify(body),
});
const data = await response.json();
if (!data.success) {
switch (data.code) {
case "VALIDATION_ERROR":
// Show field-specific errors
data.details?.forEach((err) => {
showFieldError(err.path, err.message);
});
break;
case "UNAUTHORIZED":
case "TOKEN_EXPIRED":
// Redirect to login
redirectToLogin();
break;
case "RATE_LIMITED":
// Show rate limit message
showError(`Too many requests. Try again in ${data.retryAfter} seconds.`);
break;
case "INTERNAL_ERROR":
case "DATABASE_ERROR":
// Generic error with retry
showError("Something went wrong. Please try again.");
break;
default:
showError(data.error);
}
throw new Error(data.error);
}
return data;
}
import requests
def call_api(endpoint, body):
response = requests.post(
f"https://indepai.app/api/v1/{endpoint}",
json=body,
headers={"Authorization": f"Bearer {token}"}
)
data = response.json()
if not data.get("success"):
code = data.get("code")
if code == "VALIDATION_ERROR":
for detail in data.get("details", []):
print(f"Field {detail['path']}: {detail['message']}")
elif code == "RATE_LIMITED":
retry_after = data.get("retryAfter", 60)
print(f"Rate limited. Retry in {retry_after} seconds")
else:
print(f"Error: {data.get('error')}")
raise Exception(data.get("error"))
return data
Terminal window
# Wrong
curl -X POST /api/v1/calculator -d '{"currentAge": 30}'
# Correct
curl -X POST /api/v1/calculator \
-H "Content-Type: application/json" \
-d '{"currentAge": 30}'
Terminal window
# Wrong
curl -H "Authorization: YOUR_TOKEN" ...
# Correct
curl -H "Authorization: Bearer YOUR_TOKEN" ...
// Wrong
{ "currentAge": "30", "annualIncome": "80000" }
// Correct
{ "currentAge": 30, "annualIncome": 80000 }

If you encounter an error not listed here or need assistance:

  1. Check the API Reference for correct endpoint usage
  2. Review your request against the examples in guides
  3. Contact support@indepai.app with:
    • The full error response
    • Your request (without sensitive data)
    • Timestamp of the request