⚠️ BuggyBank is a QA practice site — not a real bank. Do not enter real personal or financial data.

API reference

Everything the UI does goes through this API, so you can test it directly with Postman, curl or Robot Framework. The UI and the API enforce the same rules.

Contents

Conventions

Authentication & sessions

Rate limiting

60 requests per minute per IP address across all /api endpoints, in fixed 1-minute windows (the window resets at the start of each clock minute). Request 61 in a window returns 429 RATE_LIMITED with a Retry-After header in seconds.

Errors

Every error has the same shape. Messages are deterministic: the same input gives the same text.

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Amount must be at least ₱1.00.",
    "fields": { "amount": "Amount must be at least ₱1.00." }
  }
}

fields appears on validation errors (one message per invalid field; message is the first one). Some errors add extra properties, listed below.

HTTPCodeWhen
400INVALID_JSONBody is not a JSON object
400VALIDATION_ERROROne or more fields fail format rules (see fields)
401UNAUTHORIZEDNo token, or unknown / logged-out token
401SESSION_EXPIREDIdle for 30+ minutes or older than 8 hours
401INVALID_CREDENTIALSWrong username/email or password. Adds attemptsRemaining when the user exists
403ACCOUNT_LOCKEDToo many failed logins. Adds lockedUntil, retryAfterSeconds
404NOT_FOUNDUnknown endpoint
404ACCOUNT_NOT_FOUNDAccount id does not exist or is not yours
404RECIPIENT_NOT_FOUNDNo account with that account number
404TRANSFER_NOT_FOUNDReference does not exist or you are neither sender nor recipient
405METHOD_NOT_ALLOWEDEndpoint exists but not for this method (see Allow header)
409EMAIL_TAKENEmail already registered (case-insensitive)
409USERNAME_TAKENUsername already registered (case-insensitive)
409ACCOUNT_ALREADY_CLOSEDClosing an account that is already closed
422INSUFFICIENT_FUNDSSource balance is lower than the amount
422DAILY_LIMIT_EXCEEDEDTransfer would take today's total above ₱100,000.00. Adds usedToday, remainingToday
422SAME_ACCOUNTSource and destination are the same account
422ACCOUNT_CLOSEDSource account is closed
422DESTINATION_CLOSEDDestination account is closed
422MAX_ACCOUNTS_REACHEDAlready 5 open accounts
422BELOW_MINIMUM_DEPOSITOpening deposit below ₱500.00 (Savings) / ₱1,000.00 (Checking)
422ACCOUNT_NOT_EMPTYClosing an account whose balance is not ₱0.00
422LAST_ACCOUNTClosing your only open account
429RATE_LIMITEDMore than 60 requests in the current minute. Adds retryAfterSeconds
500INTERNAL_ERRORUnexpected server error (please report it)

Auth

POST /api/auth/register

Creates a user and a Savings account with ₱50,000.00 demo funds (OPENING_BALANCE). Does not log in.

POST /api/auth/register
{ "fullName": "Juan Dela Cruz", "email": "juan@example.com", "username": "juan_qa",
  "password": "Str0ng!Pass", "confirmPassword": "Str0ng!Pass" }

201 Created
{ "user": { "id": 7, "fullName": "Juan Dela Cruz", "username": "juan_qa",
            "email": "juan@example.com", "createdAt": "2026-11-25T06:15:00.000Z" } }

Errors: 400 VALIDATION_ERROR, 409 EMAIL_TAKEN, 409 USERNAME_TAKEN. Email is checked before username.

POST /api/auth/login

identifier is a username or an email (anything containing @ is treated as an email). Both are case-insensitive.

POST /api/auth/login
{ "identifier": "juan_qa", "password": "Str0ng!Pass" }

200 OK   (also sets the bb_session cookie)
{ "token": "q2v...Xc", "tokenType": "Bearer", "expiresAt": "2026-11-25T14:15:00.000Z",
  "idleTimeoutSeconds": 1800, "user": { ... } }

401 { "error": { "code": "INVALID_CREDENTIALS", "message": "Invalid username/email or password.", "attemptsRemaining": 3 } }
403 { "error": { "code": "ACCOUNT_LOCKED", "message": "Account is locked due to too many failed login attempts. Try again later.",
                 "lockedUntil": "2026-11-25T06:30:00.000Z", "retryAfterSeconds": 900 } }

POST /api/auth/logout

Invalidates the current token server-side and clears the cookie. Using the token afterwards returns 401 UNAUTHORIZED.

200 OK
{ "message": "Logged out." }

User

GET /api/me

200 OK
{ "user": { "id": 7, "fullName": "Juan Dela Cruz", "username": "juan_qa", "email": "juan@example.com",
            "createdAt": "2026-11-25T06:15:00.000Z" } }

POST /api/me/reset

Deletes all your accounts, transactions and transfers (so today's transfer-limit usage is cleared too), then creates a fresh Savings account with ₱50,000.00. Other users are not affected; transactions already in their accounts stay. No body. Returns the same shape as GET /api/accounts.

Accounts

GET /api/accounts

Your open accounts, oldest first, with masked numbers. totalBalance is the sum of all open accounts.

200 OK
{ "accounts": [
    { "id": 12, "accountNumber": "******4821", "maskedAccountNumber": "******4821", "type": "SAVINGS",
      "nickname": null, "balance": "48500.00", "status": "OPEN",
      "createdAt": "2026-11-25T06:15:00.000Z", "closedAt": null } ],
  "totalBalance": "48500.00" }

POST /api/accounts

Creates two transactions sharing one reference: TRANSFER_OUT on the source and OPENING_BALANCE on the new account.

POST /api/accounts
{ "type": "CHECKING", "nickname": "Bills", "sourceAccountId": 12, "openingDeposit": "1000.00" }

201 Created
{ "account": { "id": 13, "accountNumber": "5038816620", "maskedAccountNumber": "******6620", "type": "CHECKING",
               "nickname": "Bills", "balance": "1000.00", "status": "OPEN", ... },
  "reference": "BB-20261125-7KQ2ZD" }

Check order: 400 VALIDATION_ERROR → 422 MAX_ACCOUNTS_REACHED → 404 ACCOUNT_NOT_FOUND (source) → 422 ACCOUNT_CLOSED → 422 BELOW_MINIMUM_DEPOSIT → 422 INSUFFICIENT_FUNDS.

GET /api/accounts/:id

One of your accounts (open or closed) with the full account number. 404 ACCOUNT_NOT_FOUND otherwise.

200 OK
{ "account": { "id": 13, "accountNumber": "5038816620", "maskedAccountNumber": "******6620", ... } }

DELETE /api/accounts/:id

Closes the account. It must have a balance of exactly ₱0.00 and must not be your only open account. Closed accounts disappear from lists but their history stays.

Check order: 404 ACCOUNT_NOT_FOUND → 409 ACCOUNT_ALREADY_CLOSED → 422 LAST_ACCOUNT → 422 ACCOUNT_NOT_EMPTY.

200 OK
{ "account": { "id": 13, "status": "CLOSED", "closedAt": "2026-11-25T07:00:00.000Z", ... } }

Transfers

GET /api/recipients/lookup?accountNumber=5038816620

Shows who you are about to pay, for the confirmation screen. Returns only the recipient's first name.

200 OK
{ "maskedAccountNumber": "******6620", "firstName": "Maria", "isOwnAccount": false }

Errors: 400 VALIDATION_ERROR (field accountNumber), 404 RECIPIENT_NOT_FOUND, 422 DESTINATION_CLOSED.

POST /api/transfers

Same endpoint for own-account and external transfers: the destination is always an account number. kind in the response is OWN if the destination is yours, else EXTERNAL.

Creates a TRANSFER_OUT on the source and a TRANSFER_IN on the destination, atomically, sharing a reference BB-YYYYMMDD-XXXXXX (Manila date + 6 uppercase letters/digits).

POST /api/transfers
{ "fromAccountId": 12, "toAccountNumber": "5038816620", "amount": "1500.00", "note": "Rent share" }

201 Created
{ "transfer": { "reference": "BB-20261125-Q8M3TA", "kind": "EXTERNAL", "direction": "OUT", "status": "COMPLETED",
                "fromAccount": { "id": 12, "maskedAccountNumber": "******4821" },
                "toAccount": { "maskedAccountNumber": "******6620" },
                "senderFirstName": "Juan", "recipientFirstName": "Maria",
                "amount": "1500.00", "note": "Rent share", "createdAt": "2026-11-25T06:20:00.000Z",
                "sourceBalanceAfter": "47000.00" } }

Check order: 400 VALIDATION_ERROR → 404 ACCOUNT_NOT_FOUND → 422 ACCOUNT_CLOSED → 404 RECIPIENT_NOT_FOUND → 422 DESTINATION_CLOSED → 422 SAME_ACCOUNT → 422 INSUFFICIENT_FUNDS → 422 DAILY_LIMIT_EXCEEDED.

GET /api/transfers/:reference

Visible to the sender and the recipient. direction is from your point of view. Account ids are only included for your own side.

Transaction history

GET /api/transactions

Your transactions across all your accounts (including closed ones), 10 per page.

ParamValuesDefault
accountIdOne of your account idsall
typeOPENING_BALANCE, TRANSFER_IN, TRANSFER_OUTall
from, toYYYY-MM-DD (Manila dates, inclusive). Not in the future; from ≤ to; span at most 1 year (to ≤ from + 1 year). Either may be used alone.none
qPartial, case-insensitive match on reference or description. Max 100 chars.none
sortdate or amount (signed: debits sort below credits)date
orderasc or descdesc
pageInteger ≥ 1. A page past the end returns an empty items array.1
GET /api/transactions?type=TRANSFER_OUT&sort=amount&order=asc&page=1

200 OK
{ "items": [
    { "id": 88, "createdAt": "2026-11-25T06:20:00.000Z", "reference": "BB-20261125-Q8M3TA",
      "description": "Transfer to Maria ******6620", "type": "TRANSFER_OUT",
      "amount": "-1500.00", "runningBalance": "47000.00", "note": "Rent share",
      "account": { "id": 12, "maskedAccountNumber": "******4821" } } ],
  "page": 1, "pageSize": 10, "totalItems": 1, "totalPages": 1 }

runningBalance is the balance of that row's account right after the transaction. Errors: 400 VALIDATION_ERROR (fields named after the params), 404 ACCOUNT_NOT_FOUND.

GET /api/transactions/export

Same filters, search and sort as the list, without pagination (all matching rows). Returns text/csv as an attachment named buggybank-transactions-YYYYMMDD.csv.

Date (Asia/Manila),Reference,Description,Type,Amount,Running Balance,Account
2026-11-25 14:20:00,BB-20261125-Q8M3TA,Transfer to Maria ******6620,TRANSFER_OUT,-1500.00,47000.00,******4821

GET /api/health

No auth. mode tells you whether this deployment has the seeded bugs switched on.

200 OK
{ "status": "ok", "mode": "buggy", "time": "2026-11-25T06:20:00.000Z" }