Errors and Status Codes

Tsara returns an HTTP status code and a JSON response envelope. Use both: the HTTP code determines your retry strategy, while message and optional errors explain what needs attention.

Common status codes

CodeMeaningRecommended action
200Request accepted or completedInspect data.status for asynchronous resources
400Invalid input or unsupported combinationCorrect the request before retrying
401Missing, invalid, expired, or incorrect credential typeCheck authentication and environment
403Authenticated but the feature or action is not availableCheck business access and feature configuration
404Resource was not found for the authenticated businessVerify the identifier and environment
409Conflict, duplicate request, invalid state, or insufficient available balanceRead message; reconcile before retrying
422Structured validation failureDisplay or log field-level errors
500Unexpected application errorRetry cautiously and escalate if persistent
502A downstream operation failed or was rejectedReconcile status before attempting another money movement
503A required service is temporarily unavailableRetry with backoff using the same idempotency key where supported

Validation example

{
  "success": false,
  "status": "failed",
  "status_code": 422,
  "message": "Validation failed",
  "errors": {
    "amount": ["Amount is required."],
    "currency": ["Currency is not supported."]
  }
}

Retry safely

  • do not automatically retry 400, 401, 403, 404, or 422 responses without changing the cause
  • for timeouts, 500, 502, or 503, first query the resource by your reference when a status endpoint exists
  • reuse the same idempotency key on retry when the endpoint supports it
  • never generate a new business reference merely because the client timed out; the original operation may still complete
  • use bounded exponential backoff instead of tight polling loops

Preserve diagnostic context

Log the HTTP code, top-level message, your business reference, the Tsara identifier, and the resource status. Never log secret keys, webhook secrets, OTPs, or full sensitive identity values.