/

to search

Introducing Setu Changelog Check it out ↗

#Error codes

This guide documents all error codes returned by the Setu Insights API. Understanding these codes will help you handle errors gracefully and debug integration issues effectively.


#Error response structure

All API v3 error responses follow a consistent structure:

{
"timestamp": "2023-05-16T09:23:39.115Z",
"version": "0.73.1",
"txnid": "txn_12345",
"error": {
"code": "api_template_not_found",
"type": "validation",
"message": "Template with id tpl_123 not found",
"details": {
"template_id": "tpl_123",
"http_status": 404,
"param": "templateId"
}
}
}

The error object contains:

  • code—Unique identifier for programmatic error handling
  • type—Error category (validation, auth, internal, etc.)
  • message—Human-readable description
  • details—Additional context including the parameter causing the error

Always check the error code for programmatic error handling, and use the message for displaying errors to end users.


#Error codes reference

All possible error codes that we support:

CodeDescription
api_validation_errorGeneral validation error for requests
api_invalid_requestRequest format is invalid
api_empty_template_nameTemplate name cannot be empty
api_template_not_foundTemplate with specified ID not found
api_report_not_foundReport with specified ID not found
api_ref_id_not_foundRef ID not found
api_invalid_ref_idRef ID format is invalid
api_template_conflictTemplate configuration conflict
api_missing_linked_acc_refLinked account reference is missing
api_duplicate_ref_keyDuplicate Ref keys found
api_invalid_ref_keyRef key format is invalid
api_invalid_insight_nameInsight name format is invalid
api_insight_not_foundSpecified insight not found
ins_data_missingRequired data missing for insight computation
ins_insufficient_historyInsufficient transaction history
ins_invalid_formatData format is invalid for processing
ins_computation_errorError during insight calculation
auth_unauthorizedAuthentication required
auth_forbiddenAccess forbidden
rate_limit_exceededAPI rate limit exceeded
upstream_errorUpstream service error
internal_errorInternal server error
business_errorBusiness logic error

#Error types

Errors are categorized into the following types:

TypeDescription
validationInput validation errors (malformed data, missing required fields)
authAuthentication and authorization errors
internalInternal server errors
businessBusiness logic errors
insightInsight-specific processing errors
rate_limitRate limiting errors
upstreamUpstream service errors
configConfiguration errors

#API Error Codes

#Template Management

#GET /v3/template

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_template_not_found404Template not foundWhen requesting a template that doesn't existVerify the template ID is correct and exists

#POST /v3/template

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_empty_template_name400Template name cannot be emptyWhen creating a template without providing a nameProvide a valid template name
api_validation_error400Insights must be provided in a templateWhen creating a template without any insightsInclude at least one insight in the template
api_duplicate_ref_key400Duplicate ref_keys found in requestWhen the same ref_key is used multiple timesUse unique ref_keys for each insight in the template
api_invalid_ref_key400Invalid ref_key formatWhen ref_key contains spaces or special charactersUse only alphanumeric characters and underscores in ref_keys
api_invalid_insight_name400Invalid insight name formatWhen insight name doesn't follow the required naming conventionEnsure insight names follow the required naming convention
api_insight_not_found404Insights not found (case-sensitive)When requesting insights that don't existVerify insight names are spelled correctly and exist in the system

#Data Ingestion

#POST /v3/fiData

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_invalid_ref_id400Invalid ref_id formatWhen ref_id contains spaces or special charactersUse only alphanumeric characters and underscores in ref_id
api_missing_linked_acc_ref400Linked acc ref is required for each accountWhen account data is missing linked_acc_refEnsure all accounts have a valid linked_acc_ref field
internal_error500Data processing error or unexpected errorWhen data processing fails or unexpected exceptions occurContact support if the error persists

#Insight Generation

#POST /v3/insight

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_invalid_ref_id400Invalid ref_id formatWhen ref_id contains spaces or special charactersUse only alphanumeric characters and underscores in ref_id
api_ref_id_not_found404Unable to find ref_idWhen generating insights for a non-existent ref_idEnsure data has been uploaded for the ref_id first
api_template_not_found404Unable to find templateWhen using a template that doesn't existVerify the template ID is correct and exists

#GET /v3/insight

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_invalid_ref_id400Invalid report idWhen the report ID format is invalidProvide a valid report ID from the insight generation response
api_report_not_found404Unable to find reportWhen requesting a report that doesn't existVerify the report ID is correct and the report has been generated

#Data Purging

#DELETE /v3/purge

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_invalid_ref_id400Invalid ref_id formatWhen ref_id contains spaces or special charactersUse only alphanumeric characters and underscores in ref_id
api_ref_id_not_found404Unable to find ref_idWhen purging data for a non-existent ref_idVerify the ref_id exists before attempting to purge
internal_error500Error purging dataWhen the purge operation failsContact support if the error persists

#Authentication & Authorization

Error CodeHTTP StatusDescriptionWhen it occursResolution
auth_unauthorized401Authentication requiredWhen API credentials are missing or invalid or client configuration cannot be accessedVerify x-client-id, x-client-secret, and x-product-account-id headers are correct
auth_forbidden403Access forbiddenWhen the client doesn't have permission for the requested resourceContact support to verify your access permissions

#Rate Limiting

Error CodeHTTP StatusDescriptionWhen it occursResolution
rate_limit_exceeded429Too many requestsWhen API rate limits are exceededImplement exponential backoff and reduce request frequency

#Generic Validation Errors

These errors occur when request validation fails at the API level.

Error CodeHTTP StatusDescriptionWhen it occursResolution
api_validation_error422Request validation failedWhen request body, query parameters, or headers fail validationCheck the error details for specific validation failures and correct the request format

#Example validation error response

{
"timestamp": "2023-05-16T09:23:39.115Z",
"version": "0.73.1",
"txnid": "txn_12345",
"error": {
"code": "api_validation_error",
"type": "validation",
"message": "Request validation failed",
"details": {
"total_errors": 2,
"error_message": [
"field required -> templateId",
"ensure this value has at least 1 characters -> refId"
]
}
}
}

#Insight Processing Errors

These errors occur during insight computation and are returned within successful API responses (2xx status) but with status: "error" for affected insights.

Error CodeDescriptionWhen it occursResolution
ins_data_missingRequired data is missing for insight computationWhen account data lacks necessary transactions or fieldsEnsure complete financial data is provided
ins_insufficient_historyInsufficient transaction historyWhen there's not enough historical data for analysisProvide data spanning a longer time period
ins_invalid_formatData format is invalid for processingWhen transaction or account data is malformedVerify data follows the ReBIT schema format
ins_computation_errorError occurred during insight calculationWhen the insight algorithm encounters an unexpected errorContact support if the error persists

#Example insight error response

{
"status": "Success",
"body": {
"accounts": [
{
"accountIdentifierKey": "acc_123",
"insights": [
{
"indicatorName": "salary_analysis",
"status": "error",
"error": {
"code": "ins_insufficient_history",
"type": "insight",
"message": "Insufficient transaction history for salary analysis",
"details": {
"required_months": 6,
"available_months": 2
}
}
}
]
}
]
}
}

#System Errors

Error CodeHTTP StatusDescriptionWhen it occursResolution
internal_error500Internal server errorWhen unexpected system errors, unhandled exceptions, or internal service failures occurContact support if the error persists
business_error400Business logic errorWhen business rules are violatedReview the error details and adjust your request accordingly
upstream_error502/503Upstream service errorWhen dependent services are unavailableRetry after a brief delay; contact support if the issue persists

#Example internal server error response

{
"timestamp": "2023-05-16T09:23:39.115Z",
"version": "0.73.1",
"txnid": "txn_12345",
"error": {
"code": "internal_error",
"type": "internal",
"message": "Internal Server Error",
"details": {
"exception_type": "ServiceConnectionError"
}
}
}

#Best Practices

  1. Programmatic handling—Always check the error code rather than parsing error messages for conditional logic
  2. User experience—Display the human-readable message to end users
  3. Debugging—Use the details object for additional context during troubleshooting
  4. Retry logic—Implement appropriate retry mechanisms for temporary errors (rate limits, upstream errors)
  5. Monitoring—Track error rates by code to identify systematic issues

#HTTP Status Code Reference

  • 400 Bad Request—Business logic errors, specific validation failures
  • 401 Unauthorized—Missing or invalid authentication
  • 403 Forbidden—Insufficient permissions
  • 404 Not Found—Resource doesn't exist
  • 422 Unprocessable Entity—Request validation failed (malformed requests)
  • 429 Too Many Requests—Rate limit exceeded
  • 500 Internal Server Error—Unexpected server errors
  • 502/503 Service Unavailable—Upstream service issues

Was this page helpful?