Skip to content

Response and error model

The Spring Boot API returns a shared JSON envelope named ApiResponse<T>.

Response envelope

Typical response fields are:

FieldTypeMeaning
successbooleanWhether the request was handled successfully
codenumberApplication-level status code, often aligned with HTTP status
messagestring | nullHuman-readable status or error message
dataT | nullThe successful payload
timestampdatetimeResponse creation timestamp
errorobject | nullOptional structured error details

Successful responses normally look like:

json
{
  "success": true,
  "code": 200,
  "data": {},
  "timestamp": "2026-04-12T12:34:56"
}

Error responses normally look like:

json
{
  "success": false,
  "code": 401,
  "message": "Authentication required",
  "timestamp": "2026-04-12T12:34:56"
}

Common HTTP statuses

HTTP statusTypical meaning in this repo
400Validation failure, malformed JSON, missing parameter, or business-rule rejection
401Missing or invalid authentication, including expired or invalid refresh token flows
403Authenticated but not authorized
404Resource or route not found
405Method not allowed for an existing path
415Unsupported media type
429Rate limit or quota exceeded
500Unhandled server-side error
507Global storage limit exceeded

Current backend error behavior

Important details from the current exception mapping:

  • Validation failures currently return 400 with a generic message such as Parameter validation failed
  • Auth failures return 401
  • Access control failures return 403
  • Rate limits return 429 and may include Retry-After
  • Unknown server failures return a generic System error

Rate limiting and quotas

Some protected operations are subject to rate or quota controls.

When a request is throttled:

  • HTTP status is 429
  • Retry-After may be present
  • X-RateLimit-Remaining: 0 may be present for request-rate limits

Quota failures also use 429, but they represent product usage exhaustion rather than a short-lived request burst.

BFF proxy errors

The Next.js BFF can also generate non-backend responses before a request reaches Spring Boot:

StatusMessageMeaning
500Proxy misconfiguredRequired BFF env vars are missing
502Upstream fetch failedThe BFF could not reach the backend
404Not foundThe browser requested a non-/api/bff/api/v1/* path

These BFF responses are plain JSON error objects, not the backend ApiResponse<T> envelope.