The API returns structured errors with stable codes. Branch on theDocumentation Index
Fetch the complete documentation index at: https://docs.api.bsa.ai/llms.txt
Use this file to discover all available pages before exploring further.
code field, not the human-readable message.
Error envelope
Any non-2xx response has the following body:invalid_argument), the body wraps a list of
field errors:
message is a JSON-encoded array of {field, error} pairs.
Status code mapping
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_argument | Malformed body, missing required field, invalid path/query param |
| 401 | unauthenticated | Missing/invalid/expired token, or non-admin subject |
| 403 | permission_denied | Token recognized but caller lacks permission for this resource |
| 404 | not_found | Resource does not exist |
| 409 | aborted | State conflict — e.g. attempting to disburse an unapproved loan |
| 500 | internal | Unexpected upstream failure (LMS or credit service unavailable) |
| 503 | unavailable | Service is temporarily unavailable |
Upstream errors
When LMS or the credit service returns its own structured error (e.g. validation against LMS’s business rules), the wrappers API preserves the upstream message in themessage field. You’ll see
substrings like error.msg.loan.must.be.approved in there — these
come straight from LMS and can be used to branch on specific
business-rule failures.
Field-level details
When LMS rejects a request with multiple field errors, each one is appended to the message in[fieldName: detail; ...] form. Example:
[ to read each rejected field individually. The
top-level globalisation code (validation.msg.validation.errors.exist)
plus the per-field codes (visible in LMS’s developer messages) give you
enough specificity to branch programmatically.
Retrying
| Code | Retry? |
|---|---|
unavailable | Yes, with backoff |
internal | Yes once, then surface to caller |
aborted | No — fix the request or the resource state |
invalid_argument, not_found, unauthenticated, permission_denied | No — client-side fix |

