Documentation 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.
This walks through the common end-to-end flow: authenticate, create a
customer, submit a loan, approve it, and disburse it.
1. Obtain a token
The API lives on two hosts:
| Purpose | Host |
|---|
| Token issuance, authenticate, authorize | https://auth-api.bsa.ai |
| All other endpoints (customers, loans, repayments, credit, etc.) | https://api-dev.bsa.ai |
Get a token from the auth host using HTTP Basic with your account
credentials. The service signs with whichever RSA key it currently
considers active — you don’t pass a kid.
TOKEN=$(curl -sf --user "<email>:<password>" \
https://auth-api.bsa.ai/v1/auth/token | jq -r .token)
The response is {"token": "<JWT>"}. Tokens are valid for 365 days.
All examples below assume TOKEN is set and BASE=https://api-dev.bsa.ai.
2. Create a customer
curl -sf -X POST "$BASE/v1/customers" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"officeId": 1,
"firstname": "Ada",
"lastname": "Lovelace",
"active": true,
"activationDate": "2026-05-22"
}'
{
"id": "42",
"accountNo": "000000042",
"status": "Active",
"active": true,
"officeId": "1",
"firstname": "Ada",
"lastname": "Lovelace",
"displayName": "Ada Lovelace",
"activationDate": "2026-05-22"
}
Note the id field — "42" as a string. Pass it back exactly as
received.
3. Submit a loan application
curl -sf -X POST "$BASE/v1/loans" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"customerId": 42,
"productId": 1,
"principal": 5000,
"loanTermFrequency": 12,
"loanTermFrequencyType": 2,
"numberOfRepayments": 12,
"repaymentEvery": 1,
"repaymentFrequencyType": 2,
"interestRatePerPeriod": 1.5,
"amortizationType": 1,
"interestType": 0,
"interestCalculationPeriodType": 1,
"expectedDisbursementDate": "2026-06-01",
"submittedOnDate": "2026-05-22",
"loanType": "individual"
}'
The response includes the loan’s id (string), status, and
principal. See Create a loan for the full payload
reference.
4. Approve and disburse
Approve
curl -sf -X POST "$BASE/v1/loans/$LOAN_ID/approve" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"approvedOnDate": "2026-05-23"}'
Disburse
curl -sf -X POST "$BASE/v1/loans/$LOAN_ID/disburse" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"actualDisbursementDate": "2026-06-01"}'
Record a repayment
curl -sf -X POST "$BASE/v1/loans/$LOAN_ID/repayments" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"transactionDate": "2026-07-01",
"transactionAmount": 450
}'
Next steps