1.2 KiB
1.2 KiB
Points Balance Protocol (Frontend <-> Backend)
This document defines the read-only points balance contract for authenticated users.
Protocol verification status:
- Backend route source:
backend/src/v1/points/router.py - Backend service source:
backend/src/v1/points/service.py - Response schema source:
backend/src/v1/points/schemas.py
Compatibility strategy
- Additive evolution only.
- Existing response fields are stable and must remain backward-compatible.
Route
GET /api/v1/points/balance
Authorization
- Requires authenticated session.
- User identity is derived from verified backend auth context.
Response (200)
{
"balance": 120,
"frozenBalance": 20,
"availableBalance": 100,
"runCost": 20,
"canRun": true
}
Field rules:
balance: integer>= 0frozenBalance: integer>= 0availableBalance: integer>= 0, computed asmax(balance - frozenBalance, 0)runCost: integer> 0, current value20canRun: boolean, equivalent toavailableBalance >= runCost
Error contract linkage
- RFC7807 + extension
code, optionalparams. - Shared registry:
docs/protocols/common/http-error-codes.md.