ledger_masters
Read a TallyPrime company's ledgers with opening balances, plus optional GSTIN, PAN, MSME, group ancestry, and GST duty-head details for compliance.
Instructions
Return a company's ledger masters, each with its opening balance as of the start of the books (opening_balance, opening_balance_as_of), on a freshly observed supported product and mode. fields=basic (the default) or fields=compliance, which adds paired party-master observations (GSTIN, PAN, MSME, bank, contact and address), each ledger's group ancestry and its gst_duty_head. GSTIN (compliance): party_gstin is the GSTIN in force on party_gstin_as_of (the optional as_of, YYYYMMDD or YYYY-MM-DD such as 20260331, else this computer's date; without fields=compliance, as_of is refused as ledger_masters_as_of_requires_compliance), taken from the ledger's dated registration history, or from the flat GSTIN field only when that history is empty or not returned (an empty flat field names no GSTIN). party_gstin_status: in_force, flat_field, no_gstin_in_force (a history with no GSTIN in force on that date; party_gstin_registration_type says whether that entry is registered), not_reported, or history_unreadable, which fails closed (an undated, misdated, malformed, repeated or contradictory history: party_gstin is null and the flat field unused). party_gstin_flat is always the flat field as read; gstin_sources_disagree is true when it names a GSTIN the in-force entry does not: both are reported, neither is chosen. For another date, such as a transaction's, pass it as as_of or read the dated compliance.gst_registrations. Duty head (compliance): gst_duty_head is recognized (head: cgst, igst, state_tax, sgst_utgst, ut_tax or cess; raw: the spelling Tally returned), unrecognized (raw kept), not_tax_ledger, contradictory or absent. state_tax (raw State Tax) and sgst_utgst (raw SGST/UTGST) are two spellings Tally has returned for a state-side head, kept apart: to sum state tax, include both. Ancestry (compliance): chain (nearest group first, each hop's name and reserved_name), complete (true only if resolved to the reserved account root) and gap (null when complete, else why it stopped: no_parent, group_absent, group_name_repeated, reserved_name_missing, cycle or exhausted). An incomplete chain is never padded or guessed: chain is exactly what was resolved, so check complete before treating it as exhaustive. A reserved_name starting with U+FFFD #4; is a Tally reserved value (written ); U+FFFD#4; Primary is the account root, not a group a user named Primary. Group filter: group filters by group name. group_scope "immediate" (the default) matches only the ledger's own parent and does NOT include ledgers under sub-groups of group; "ancestry" matches anywhere in the resolved chain, the whole subtree (a ledger under Bank OD A/c matches Loans (Liability)), with either fields value, and a gap in a chain never counts as a match. A group filter reads the group collection (one more paired read with fields=basic) and returns group_filter: excluded_subgroup_ledgers (count left out for sitting under a sub-group of group, always 0 under ancestry scope, with group_count and up to 20 of those sub-groups in groups) and unresolved_ancestry_ledgers (ledgers not returned whose chain stops short of group, so whether they belong under it is unknown; counted over the whole book). GST details (compliance, opt-in): include_gst_details (a boolean, default false; with any other fields it is refused as ledger_masters_gst_details_requires_compliance) adds compliance.gst_details to each ledger: observation is not_observed (Tally returned no such list), entries (each dated entry with applicable_from, taxability, source, itc_eligible and states; each state row has state_name, slab_rates_present and rates with duty_head, valuation_type and a rate whose kind is absent, empty, zero or value with raw as sent and decimal; other_content_skipped says content was not read) or unreadable (a defect for this ledger only). absent, empty, zero and value mean different things and are never merged. These are Tally's ledger-level details as sent: HSN/SAC and type of supply are not returned because no capture shows them, the place of supply is in the registration history, and slab rates are only flagged. Measured on one 14-ledger lab book of TallyPrime 7.1 Silver; this was not yet run through this tool on a live Tally. Without the flag every request and result is unchanged and carries no gst_details. The read is admitted at 8,000 bytes a ledger instead of 3,750, a margin over the one capture (a ledger with an empty list 2,138 to 2,704 bytes; one dated entry 5,248 to 5,394; UTF-16 bytes of the ledger's own element), not a measured ratio; a large book may be read in more parts or refused as too large. Large books (compliance): when the master-alteration mark (an upper bound on the ledgers, since every master raises it) puts the estimated response over budget, the ledgers are counted first, then read whole or, if the count does not fit, in parts by parent group; every counted ledger must come back exactly once, or the whole call is refused. Above a mark of 22,857 the count runs in AlterID-span slices of at most 4,000, one GUID-only request each; above 400,000 the call is refused before any ledger read (cause ledger_catalogue_too_large, with size), even for a company with fewer ledgers. Each refusal names its cause: parent_over_budget, parent_partition_too_many_parts, parent_complement_over_budget, ledger_without_parent, parent_name_unsupported (with unsupported_parent_ledgers), parent_partition_duplicate_ledger_identity, the parent_part_* coverage causes, parent_part_response_too_large, ledger_span_slice_over_bound, ledger_span_duplicate_identity, ledger_span_census_empty, ledger_span_slice_malformed, ledger_span_identity_mismatch, ledger_span_slice_response_too_large or ledger_count_catalogue_too_large. A size refusal refuses again on retry; fields=basic still reads the book. For ledger_count_differs (two counts, or a count and the ledgers read, disagree) or ledger_count_company_differs (Tally's own ledger count exceeds the census's), retry once while the book is quiet; for ledger_count_company_invalid (that count's answer was damaged) or ledger_count_company_response_too_large, retry once, then use fields=basic. A counted read reports ledger_count_cross_check.status: matched, company_count_lower, or unavailable (no count in Tally's answer, so no check ran). Currencies (compliance): a book with several Currency masters is read through the base Tally identifies: only plain base-currency ledgers are returned (ledgers_scope base_currency_ledgers_only); ledgers kept in another currency (foreign_currency_ledgers_excluded) and base-currency ledgers whose balances Tally shows in another currency (base_currency_ledgers_mixed_excluded) are named, never read. Paging: offset 0 always reads Tally afresh and holds the read; later pages are served from it while the book extent, ALTMSTID and ALTVCHID included, is unchanged, and each result reports snapshot. Pass the first page's snapshot_id on later pages to be refused as listing_snapshot_changed (cause book_changed_since_first_page or snapshot_not_held) rather than continue from a different read. With fields=compliance, repeat the first page's as_of: a snapshot serves only pages read as of the same date, so a later page without it (or across midnight) reads afresh, or is refused if it names the snapshot; the same holds for include_gst_details: a later page called without include_gst_details reads afresh and returns rows without gst_details (snapshot.reused false), and only a call that names snapshot_id is refused. A change that moves neither mark is not seen, so a later page can be up to 10 minutes old; every screen action measured so far moved one (a regroup, an opening change, a ledger create or delete, a voucher delete, a cancel, a save with no change; protocol reference section 11c.5, one run each). For what parties owe or are owed now, by their open bills, use outstandings instead. Each call appends metadata-only receipt lines (tool, company, counts, request and response fingerprints; no book content) to ComplyEaze Bridge's local log on this computer; it writes nothing to Tally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | Optional, with fields=compliance only: the day the GSTIN in force is read for (YYYYMMDD or YYYY-MM-DD). Left out, this computer's date. | |
| group | No | Optional: return only the ledgers under this group name; which ones count follows group_scope. | |
| limit | No | The most rows to return on this page. The default and the maximum are this server's row limit (500 unless it is configured otherwise). | |
| fields | No | basic (the default) or compliance, which adds the party-master observations, each ledger's group ancestry and its gst_duty_head; the description says what each holds. | basic |
| offset | No | How many rows to skip before this page: 0, the default, is the first page. | |
| group_scope | No | With group: immediate (the default) matches only a ledger's own parent; ancestry matches any group in its resolved chain, the whole subtree. | immediate |
| snapshot_id | No | Optional, on a later page only: the first page's snapshot_id, so the call is refused (listing_snapshot_changed) rather than continuing from a different read. | |
| company_guid | Yes | The company's company_guid, as list_companies returns it. | |
| include_gst_details | No | Optional boolean, default false, with fields=compliance only (any other fields is refused as ledger_masters_gst_details_requires_compliance): add each ledger's dated GST rate details as compliance.gst_details. They are Tally's ledger-level details as sent, per dated entry and state row; a rate is absent, empty, zero or a value, never merged. HSN/SAC and type of supply are not returned; slab rates are only flagged. Measured on one 14-ledger lab book; not yet run through this tool on a live Tally. The read is admitted at 8,000 bytes a ledger instead of 3,750, a margin over the one capture (a ledger with an empty list 2,138 to 2,704 bytes; one dated entry 5,248 to 5,394; UTF-16 bytes of the ledger's own element), not a measured ratio; a large book may be read in more parts or refused as too large. On later pages repeat `include_gst_details` as well as `as_of`: a later page called without `include_gst_details` reads afresh and returns rows without `gst_details` (`snapshot.reused` false), and only a call that names snapshot_id is refused. |