Files
sxchnge/backend/contracts/sendico/api/ledger_accounts/balance.yaml
T

59 lines
2.5 KiB
YAML

get:
tags: [Ledger Accounts]
summary: Get ledger account balance
description: |
Returns the canonical balance for the requested ledger account.
Without `as_of`, the response is the current materialized balance and includes
current metadata fields `version` and `lastUpdated`.
With `as_of`, the response is an event-time accounting balance reconstructed
from posted statement-entry deltas where `eventTime <= as_of`. Entries exactly
equal to `as_of` are included. This is not a historical snapshot of materialized
balance state and not "what the system knew" at that clock time. Late or
backdated postings with older `eventTime` can change historical responses for
the same `as_of`. Historical responses include `ledgerAccountRef`, `balance`,
and canonical UTC `asOf`, and omit `version` and `lastUpdated` because no
historical snapshot/version semantics are defined.
Historical balance is valid only if every account-affecting committed posting
writes matching statement entries in the same transaction as balance updates.
operationId: ledgerAccountBalanceGet
security:
- bearerAuth: []
parameters:
- $ref: ../parameters/organizations_ref.yaml#/components/parameters/OrganizationsRef
- $ref: ../parameters/ledger_account_ref.yaml#/components/parameters/LedgerAccountRef
- name: as_of
in: query
required: false
description: |
Optional RFC3339 event-time cutoff for historical balance reconstruction.
Timezone offsets are accepted and returned as canonical UTC `asOf`.
schema:
type: string
format: date-time
example: '2026-04-23T14:30:00+02:00'
responses:
'200':
description: Ledger account balance
content:
application/json:
schema:
allOf:
- $ref: ../response/response.yaml#/components/schemas/BaseResponse
- type: object
properties:
data:
$ref: ./response/balance.yaml#/components/schemas/LedgerAccountBalanceData
'400':
$ref: ../response/operation.yaml#/components/responses/BadRequest
'401':
$ref: ../response/operation.yaml#/components/responses/Unauthorized
'403':
$ref: ../response/operation.yaml#/components/responses/Forbidden
'404':
$ref: ../response/operation.yaml#/components/responses/NotFound
'500':
$ref: ../response/operation.yaml#/components/responses/InternalServerError