SonaCORE

Referência / Quadra Core API

GL Entries

4 operações em Quadra Core API 0.5.0.

GET/v1/gl/entries

List journal-entry legs by account or GL node

Auditor leg feed over the DR/CR read model (RFC-025).

Requires exactly one of ``account_id`` or ``gl_node_id``. The two modes paginate on different indexes — their cursors are index-specific and must never cross (laas-04 lore).

Raises: 400: INVALID_QUERY (neither/both of account_id and gl_node_id) or Invalid cursor

Parâmetros

NomeTipoDetalhe
account_idstring, opcionalquery Leg feed for one account (GSI1 mode)
gl_node_idstring, opcionalquery Leg feed for one COA node (GSI2 mode)
effective_fromstring, opcionalquery Inclusive lower bound on effective_at (ISO 8601)
effective_tostring, opcionalquery Inclusive upper bound on effective_at (ISO 8601)
layerstring, opcionalquery Filter legs by layer
limitintegerquery
cursorstring, opcionalquery

Respostas

StatusCorpoDetalhe
200GLEntryLegListResponseResposta bem-sucedida
422HTTPValidationErrorErro de validação
GET/v1/gl/entries/{tx_hash}

Entry-set drill-down for one confirmed transaction

Full entry set (header + legs) for one confirmed Hydra transaction.

A refused transaction (projection EXCEPTION marker, no SET header) returns 200 with ``exception`` populated and no legs — auditors must see refusals; only a completely unknown tx_hash is a 404.

Raises: 404: NOT_FOUND (no entry set and no refusal marker for tx_hash)

Parâmetros

NomeTipoDetalhe
tx_hashstringpathobrigatório

Respostas

StatusCorpoDetalhe
200GLEntrySetResponseResposta bem-sucedida
422HTTPValidationErrorErro de validação
GET/v1/gl/mapping-rules

Current transaction-type→node mapping ruleset

The CURRENT mapping ruleset. Version 0 with no rules means no operator ruleset has been appended yet — the built-in per-account-type defaults apply (RFC-025). Rule changes are prospective-only; entries stamp the ruleset_version they were projected under.

Respostas

StatusCorpoDetalhe
200GLMappingRulesetResponseResposta bem-sucedida
GET/v1/gl/trial-balance

Trial balance over an accounting-day range

Per-node DR/CR/net over the rollup counters (a Query per node — no scans) plus the graph-wide zero-sum flag. CUSTODY sums to zero by UTxO conservation; MEMO by the gl_squad_obligations counter-legs (RFC-025).

Raises: 400: INVALID_QUERY (from > to)

Parâmetros

NomeTipoDetalhe
fromstringqueryobrigatório Inclusive start accounting day (América/São_Paulo)
tostringqueryobrigatório Inclusive end accounting day (América/São_Paulo)
layerstringquery CUSTODY (default) or MEMO

Respostas

StatusCorpoDetalhe
200GLTrialBalanceResponseResposta bem-sucedida
422HTTPValidationErrorErro de validação

Esquemas

Os modelos que as operações acima aceitam e devolvem. Campos opcionais estão marcados como tal; um campo tipado como outro modelo está documentado sob o nome dele.

GLEntryLeg

One DR/CR leg of a projected entry set — a per-account net flow per asset.

CampoTipoDetalhe
account_idstringobrigatórioAccount the value moved in/out of
accounting_daystring, opcionalAmérica/São_Paulo (−03:00) accounting day
amount_centsintegerobrigatórioAbsolute leg amount in minor units
assetstringobrigatórioQBRL or VQBRL#<policy_hash>
direction"DR" | "CR"obrigatórioDR = value in, CR = value out
effective_atstringobrigatórioEntry-set effective timestamp (ISO 8601)
event_kindstring, opcionalEntry-set classification (TRANSFER_INTERNAL, DEPOSIT, ...)
gl_node_idstringobrigatórioCOA node the leg is classified to
layer"CUSTODY" | "MEMO"obrigatórioCUSTODY (QBRL) or MEMO (per-squad vQBRL)
legintegerobrigatórioLeg ordinal within the set (ordered over sorted account_id)
obligation_idstring, opcionalBacking obligation (obl_*) where one exists
tx_hashstringobrigatórioConfirmed Hydra transaction hash (entry-set id; cross-refs the journal)

GLEntryLegListResponse

Cursor-paginated leg feed (by account or by GL node).

CampoTipoDetalhe
itemsarray de GLEntryLegobrigatórioLeg rows, effective-time ordered
next_cursorstring, opcionalOpaque cursor; null when no more pages

GLEntrySetException

Refusal marker for a transaction whose entry set could not be projected.

CampoTipoDetalhe
confirmed_atstring, opcionalWhen the refusal was recorded
detailobject, opcionalRefusal specifics (imbalances, offending UTxOs)
reasonstringobrigatórioWhy the set was refused (UNBALANCED, UNATTRIBUTABLE, ...)

GLEntrySetResponse

Entry-set drill-down: header + legs (or the refusal marker).

CampoTipoDetalhe
accounting_daystring, opcionalAmérica/São_Paulo (−03:00) accounting day
balancedboolean, opcionalDR=CR held per (asset, layer) — always true for written sets
confirmed_atstring, opcionalSnapshot confirmation timestamp
correlationobject, opcionalsqd_id / swp_instance_id / evidence_id where applicable
effective_atstring, opcionalEntry-set effective timestamp (ISO 8601)
event_kindstring, opcionalNull when the set was refused (exception present)
exceptionGLEntrySetException, opcionalPresent iff the set was refused
layer_totalsobjectPer-'<asset>|<layer>' DR/CR totals
legsarray de GLEntryLegOrdinal-ordered legs
obligation_idsarray de stringBacking obligations (obl_*)
ruleset_versioninteger, opcionalMapping-ruleset version stamped at projection
tx_hashstringobrigatórioConfirmed Hydra transaction hash

GLMappingRule

One ordered mapping rule: match → COA node.

CampoTipoDetalhe
gl_node_idstringobrigatórioTarget COA node for matching legs
matchGLMappingRuleMatchobrigatórioConditions (missing key = wildcard)

GLMappingRulesetResponse

The CURRENT transaction-type→node mapping ruleset (versioned, prospective-only).

CampoTipoDetalhe
created_atstring, opcionalWhen this version was appended
created_bystring, opcionalOperator client id that appended it
rulesarray de GLMappingRuleOrdered, first-match-wins
versionintegerobrigatório0 = no operator ruleset yet (built-in per-type defaults apply)

GLTrialBalanceNode

One COA node's aggregate over the queried period/layer.

CampoTipoDetalhe
cr_centsintegerobrigatórioSum of CR over the period
dr_centsintegerobrigatórioSum of DR over the period
entry_countintegerobrigatórioEntry sets that touched this node in the period
gl_node_idstringobrigatórioCOA node id (GL account row)
namestring, opcionalHuman-readable node name
net_centsintegerobrigatóriodr−cr for DR-normal nodes, cr−dr for CR-normal (D2 rendering)
normal_balancestring, opcionalNormal balance side (DR|CR)
parent_account_idstring, opcionalParent GL node (sub-GL accounts)
typestring, opcionalNode type (ASSET, LIABILITY, TRANSIT, REVENUE, EXCEPTION)

GLTrialBalanceResponse

Trial balance over an accounting-day range (rollup-Query-backed, no scans).

CampoTipoDetalhe
cr_total_centsintegerobrigatórioGraph-wide CR total for the layer/period
dr_total_centsintegerobrigatórioGraph-wide DR total for the layer/period
fromstringobrigatórioInclusive start accounting day (yyyy-mm-dd)
layerstringobrigatórioCUSTODY (default) or MEMO
nodesarray de GLTrialBalanceNodeobrigatórioPer-node aggregates
tostringobrigatórioInclusive end accounting day (yyyy-mm-dd)
zero_sumbooleanobrigatóriodr_total == cr_total (the graph-wide invariant, raw dr/cr)

HTTPValidationError

CampoTipoDetalhe
detailarray de ValidationError

ValidationError

CampoTipoDetalhe
ctxobject
inputnão declarado
locarray de string ou integerobrigatório
msgstringobrigatório
typestringobrigatório