Trancent Docs

Period Closes

A period close marks the end of an accounting period (e.g. a billing month). It creates a permanent, auditable record in the journal and enables quota resets, credit expirations, and rollover grants.

Base URL: https://api.trancent.dev — all paths below are relative to this.


Close a period

POST /v1/ledgers/:ledgerId/period-closes

Request body

{
  "periodId": "2026-03",
  "reason": "Monthly billing cycle close"
}
FieldTypeRequiredDescription
periodIdstringyesA caller-supplied identifier for the period (e.g. 2026-03, Q1-2026)
reasonstringnoOptional human-readable reason for the close

Response — 201 Created

{
  "closeId": "01HXS...",
  "periodId": "2026-03",
  "closedAt": "2026-04-01T00:00:12.345Z"
}

Idempotency

Period closes are idempotent — closing the same periodId twice returns the existing close record without creating a duplicate. This makes it safe to retry close operations without side effects.

Merkle integrity

At close time, Trancent computes a Merkle hash tree over all journal entries in the period. The root hash is stored alongside the close record. Any party can later recompute the tree from the entries and compare the root — a mismatch indicates data divergence. This provides a lightweight, auditable checksum that survives exports and backups.


List period closes

GET /v1/ledgers/:ledgerId/period-closes
ParameterTypeDefaultDescription
limitinteger50Page size
offsetinteger0Pagination offset

Response — 200 OK

{
  "closes": [
    {
      "closeId": "01HXS...",
      "periodId": "2026-03",
      "closedAt": "2026-04-01T00:00:12.345Z"
    }
  ]
}

Constraints

  • Journal entries cannot be written to a closed period.
  • Existing entries in a closed period cannot be reversed.
  • A ledger in closed state cannot have new period closes.

Error responses

StatusCodeMeaning
400VALIDATION_ERRORMissing periodId or invalid input
401Invalid API key or signature
404Ledger not found or not owned by caller’s org

All errors follow the RFC 9457 problem detail format.