DIY Accounting Spreadsheets

Excel bookkeeping and accounting software for UK small businesses

The diya-gl format

A year of accounts in two text files, and the mapping, the checks and the evidence behind them.

What diya-gl is

diya-gl is the file format behind DIY Accounting's books pages, its command line tools and the spreadsheets it generates. A whole year of a small business's accounts is two text files in a zip. book.toml says who the business is, what period the books cover and what the chart of accounts holds. lines.jsonl holds one transaction per line. A sole trader's year runs to about 15 KB.

It is for people who want to own their accounting data outright. You can read it in a text editor, keep it in git and see what changed, and recalculate it in a browser or on a command line without Excel and without a server. This page is the specification: the fields, the figures they compute, the checks they have to pass, the zip they travel in, and the evidence that the figures agree with the spreadsheets we have shipped for twenty years.

The declared subset

Every field name in the two schemas is taken from the XBRL Global Ledger Taxonomy Framework 2015, the XBRL Standards Board's recommendation of 25 March 2015. The tables below name the element each field comes from.

That is a lineage and a published mapping, and this page claims nothing past what the tables show. XBRL GL runs no conformance programme and issues no certificate for a data format. A diya-gl file is TOML and JSON Lines; it is not an XBRL instance document, and no XBRL processor reads it.

The format names 48 elements, from four of the framework's modules: gl-cor (core), gl-bus (business), gl-muc (multicurrency) and gl-taf (tax audit file). No other element of the framework is named in either schema. The framework's nested tuples are flattened: an entry header and its detail are one line, and gl-cor:account becomes the pair accountMainID and accountMainDescription. Where a UK small business needs something the framework has no element for, the schema declares a diya-gl extension: a diya-gl: prefix on a field, or a whole table marked as one. There are 135 extension fields, and the tables below mark every one.

The schemas themselves are published beside this page: diya-gl-book-v2.schema.json and diya-gl-lines-v2.schema.json, both JSON Schema draft 2020-12. A longer commentary on the mapping is in diya-gl-docs.md.

Document info

The two tables at the head of book.toml: what period the file covers, and whose business it is.

FieldTypeXBRL GL 2015 elementMeaningRequired
documentInfotablegl-cor:documentInfoMetadata about this set of booksrequired
documentInfo.entriesTypestring, one of 12gl-cor:entriesTypeWhat kind of data this book contains. Enumeration from GL 2015 specification.required
documentInfo.languagestringgl-cor:languageISO 639-1 language codeoptional
documentInfo.creationDatestringgl-cor:creationDateWhen this book file was created (ISO 8601)optional
documentInfo.periodCoveredStartstringgl-cor:periodCoveredStartFirst day of the accounting period (ISO 8601)required
documentInfo.periodCoveredEndstringgl-cor:periodCoveredEndLast day of the accounting period (ISO 8601)required
documentInfo.defaultCurrencystringgl-cor:defaultCurrencyISO 4217 currency coderequired
documentInfo.entriesCommentstringgl-cor:entriesCommentFree text note about this bookoptional
documentInfo.diya-gl:vatStaggerGroupinteger, one of 3diya-gl extensionWhich of HMRC's three VAT stagger groups this business's quarters fall on. Group 1 ends Mar/Jun/Sep/Dec, group 2 Apr/Jul/Oct/Jan, group 3 May/Aug/Nov/Feb.optional
documentInfo.diya-gl:payrollYearStartstringdiya-gl extensionThe first day of the payroll calendar the Payslips workbook builds, when it differs from periodCoveredStart.optional
documentInfo.diya-gl:formatVersionstringdiya-gl extensionThe diya-gl-books format name and version this file is written as, e.g. "diya-gl-books/1".optional
documentInfo.diya-gl:engineVersionstringdiya-gl extensionThe npm package version and commit of the engine that wrote this file, e.g. "1.0.0+3f2a1b9c4d7e".optional
documentInfo.diya-gl:taxDataHashstringdiya-gl extensionA hash over every app/data/*.toml tax-year file, naming which rates this file's figures were calculated from.optional
documentInfo.diya-gl:templateHashstringdiya-gl extensionA hash over this product's own Excel template files, naming which workbook this file reproduces.optional
documentInfo.diya-gl:templateScorecardstringdiya-gl extensionThe published reconciliation check counts for this product's template, e.g. "132 passed, 0 warnings, 0 failed".optional
documentInfo.diya-gl:reconciledCommitstringdiya-gl extensionThe commit whose CI reconciliation run last passed for this product, the proof this file's figures rest on.optional
entityInformationtablegl-cor:entityInformation + gl-bus:organizationInformationWho this book belongs torequired
entityInformation.organizationIdentifierstringgl-bus:organizationIdentifierTrading name or legal entity namerequired
entityInformation.organizationDescriptionstringgl-bus:organizationDescriptionNature of the businessoptional
entityInformation.organizationAddressLinestringgl-bus:organizationAddressLineRegistered or trading address, first lineoptional
entityInformation.organizationTownstringgl-bus:organizationTownRegistered or trading address town/cityoptional
entityInformation.organizationPostcodestringgl-bus:organizationPostcodeRegistered or trading address postcodeoptional
entityInformation.organizationTelephonestringgl-bus:organizationTelephoneContact telephone numberoptional
entityInformation.taxRegistrationNumberstringgl-taf:taxRegistrationNumberHMRC Unique Taxpayer Reference (UTR)optional
entityInformation.taxAuthorityIdentifierstringgl-taf:taxAuthorityIdentifierTax authority identifieroptional
entityInformation.diya-gl:productstring, one of 7diya-gl extensionDIY Accounting product identifier. Determines which schema subset is active.optional
entityInformation.diya-gl:vatRegisteredbooleandiya-gl extensionWhether the business is VAT registeredoptional
entityInformation.diya-gl:basisOfAccountingstring, one of 2diya-gl extensionAccounting basis. Cash for sole traders, accrual for companies.optional
entityInformation.diya-gl:ninostringdiya-gl extensionNational Insurance Number (format: AB123456C)optional
entityInformation.diya-gl:vatNumberstringdiya-gl extensionVAT registration number (9 digits)optional
entityInformation.diya-gl:companyNumberstringdiya-gl extensionCompanies House number (8 digits, Company Accounts only)optional
entityInformation.diya-gl:cisRegisteredbooleandiya-gl extensionWhether the business is registered under the Construction Industry Scheme (CIS)optional
entityInformation.diya-gl:companiesHouseNamestringdiya-gl extensionThe first director's name as filed at Companies House, for the directors' report and CT600 (Company Accounts only).optional
entityInformation.diya-gl:mileageBasisstring, one of 2diya-gl extensionWhether the Taxi Driver return claims actual vehicle costs or the HMRC mileage allowance. Where absent, the calculator compares both and claims the higher, matching the shipped workbook's own comparison.optional

Accounts and registers

The chart of accounts, the registers a year-end needs (assets, hire purchase, members, charges) and the tax rates the period was calculated at. The rate tables hold HMRC's published figures for the year; the framework has no element for a rate table, so those rows name none.

FieldTypeXBRL GL 2015 elementMeaningRequired
directorsarray of tablesdiya-gl extensionCompany directors and their shareholdings (Company Accounts only). Used to populate Companysecretary.xlsx sheets.optional
directors[].namestringdiya-gl extensionDirector's full namerequired
directors[].rolestringdiya-gl extensionRole title (e.g. Managing Director, Company Secretary, Non-Executive Director)required
directors[].sharesintegerdiya-gl extensionNumber of shares heldoptional
directors[].appointedstringdiya-gl extensionDate of appointment (ISO 8601)optional
directors[].resignedstringdiya-gl extensionDate of resignation if applicable (ISO 8601)optional
employeesarray of tablesdiya-gl extensionEmployees on payroll. Used to populate Payslips.xlsx. Includes directors paid via PAYE.optional
employees[].employeeIDstringdiya-gl extensionUnique employee identifier (matches diya-gl:employeeID in lines)required
employees[].namestringdiya-gl extensionEmployee's full namerequired
employees[].rolestringdiya-gl extensionJob titleoptional
employees[].grossPaynumberdiya-gl extensionGross pay per period (monthly or weekly amount)required
employees[].payFrequencystring, one of 4diya-gl extensionPay frequencyrequired
employees[].taxCodestringdiya-gl extensionHMRC tax code (e.g. 1257L)required
employees[].niCategorystringdiya-gl extensionNI category letter (A=standard, C=over state pension age, H=apprentice under 25, M=under 21)optional
employees[].startDatestringdiya-gl extensionEmployment start date (ISO 8601)optional
employees[].isDirectorbooleandiya-gl extensionWhether this employee is also a company directoroptional
accountstablegl-cor:accountChart of accounts. Maps to gl-cor:account tuples. Organised by journal for spreadsheet column mapping.required
accounts.salestablegl-cor:accountMainIDSales/income account codes. Keys are gl-cor:accountMainID values.required
accounts.purchasestablegl-cor:accountMainIDPurchase/expense account codes. Keys are gl-cor:accountMainID values.required
accounts.banktablegl-cor:accountMainIDBank/cash account codes (Company Accounts). Keys are gl-cor:accountMainID values.optional
accounts.capitaltablegl-cor:accountMainIDCapital/equity account codes (Company Accounts). Keys are gl-cor:accountMainID values.optional
accounts.assetstablegl-cor:accountMainIDFixed/current asset account codes (Company Accounts). Keys are gl-cor:accountMainID values.optional
accounts.liabilitiestablegl-cor:accountMainIDLiability account codes (Company Accounts). Keys are gl-cor:accountMainID values.optional
openingBalancestablediya-gl extensionThe trial balance brought forward, reverse-engineered today from an opening journal by buildOpeningBalance(); this table lets a book state it directly. Every figure is positive; the balance sheet applies its own sign.optional
openingBalances.fixedAssetCosttablediya-gl extensionAn amount per fixed asset class.optional
openingBalances.fixedAssetCost.landBuildingsnumberdiya-gl extensionoptional
openingBalances.fixedAssetCost.plantMachinerynumberdiya-gl extensionoptional
openingBalances.fixedAssetCost.fixturesFittingsnumberdiya-gl extensionoptional
openingBalances.fixedAssetCost.computerTechnologynumberdiya-gl extensionoptional
openingBalances.fixedAssetCost.motorVehiclesnumberdiya-gl extensionoptional
openingBalances.fixedAssetDepreciationtablediya-gl extensionAn amount per fixed asset class.optional
openingBalances.fixedAssetDepreciation.landBuildingsnumberdiya-gl extensionoptional
openingBalances.fixedAssetDepreciation.plantMachinerynumberdiya-gl extensionoptional
openingBalances.fixedAssetDepreciation.fixturesFittingsnumberdiya-gl extensionoptional
openingBalances.fixedAssetDepreciation.computerTechnologynumberdiya-gl extensionoptional
openingBalances.fixedAssetDepreciation.motorVehiclesnumberdiya-gl extensionoptional
openingBalances.stocknumberdiya-gl extensionoptional
openingBalances.tradeDebtorsnumberdiya-gl extensionoptional
openingBalances.tradeCreditorsnumberdiya-gl extensionoptional
openingBalances.longTermDebtorsnumberdiya-gl extensionoptional
openingBalances.bankAccountstablediya-gl extensionOpening balance per bank account, keyed by the account code declared in accounts.bank.optional
openingBalances.payeDuenumberdiya-gl extensionoptional
openingBalances.vatDuenumberdiya-gl extensionoptional
openingBalances.cisDuenumberdiya-gl extensionoptional
openingBalances.netWagesDuenumberdiya-gl extensionoptional
openingBalances.wageDeductionsDuenumberdiya-gl extensionoptional
openingBalances.corporationTaxDuenumberdiya-gl extensionoptional
openingBalances.dividendsDuenumberdiya-gl extensionoptional
openingBalances.directorsLoannumberdiya-gl extensionoptional
openingBalances.longTermCreditorsnumberdiya-gl extensionoptional
openingBalances.shareCapitalnumberdiya-gl extensionoptional
openingBalances.retainedEarningsnumberdiya-gl extensionoptional
openingBalances.capitalReservesnumberdiya-gl extensionoptional
stocktablediya-gl extensionOpening and closing stock, and the physical count taken at each. materialsPercent is the share of net sales that is direct materials; the Stock sheet's bought and sold columns stay at zero without it.optional
stock.openingValuenumberdiya-gl extensionoptional
stock.closingValuenumberdiya-gl extensionoptional
stock.openingCountnumberdiya-gl extensionoptional
stock.closingCountnumberdiya-gl extensionoptional
stock.materialsPercentnumberdiya-gl extensionoptional
debtorsarray of tablesdiya-gl extensionNamed trade debtors at the opening or closing balance sheet date.optional
debtors[].counterpartystringdiya-gl extensionrequired
debtors[].invoicestringdiya-gl extensionoptional
debtors[].amountnumberdiya-gl extensionrequired
debtors[].timingstring, one of 2diya-gl extensionrequired
creditorsarray of tablesdiya-gl extensionNamed trade creditors at the opening or closing balance sheet date.optional
creditors[].counterpartystringdiya-gl extensionrequired
creditors[].invoicestringdiya-gl extensionoptional
creditors[].amountnumberdiya-gl extensionrequired
creditors[].timingstring, one of 2diya-gl extensionrequired
fixedAssetsarray of tablesdiya-gl extensionThe fixed asset register: one entry per asset held at the opening balance sheet date or bought in the year. A capital allowance's balancing allowance on disposal reads taxWrittenDownValue, not accumulatedDepreciation, because the two schedules run at different rates. class is optional: the Basic Sole Trader and Taxi Driver Fixed Assets sheets carry a flat list with no asset-class blocks, unlike the Self Employed and Company Schedule.optional
fixedAssets[].assetIDstringdiya-gl extensionIdentifier matched by diya-gl:assetID on the lines that buy or dispose of this asset.required
fixedAssets[].classstring, one of 5diya-gl extensionThe Schedule block this asset belongs to (Self Employed and Company only).optional
fixedAssets[].descriptionstringdiya-gl extensionoptional
fixedAssets[].costnumberdiya-gl extensionrequired
fixedAssets[].accumulatedDepreciationnumberdiya-gl extensionoptional
fixedAssets[].taxWrittenDownValuenumberdiya-gl extensionWritten down value carried forward on the capital allowances computation, brought forward for an asset already held at the opening balance sheet date.optional
fixedAssets[].acquiredDatestringdiya-gl extensionoptional
fixedAssets[].depreciationRatenumberdiya-gl extensionoptional
fixedAssets[].disposedDatestringdiya-gl extensionoptional
fixedAssets[].disposalProceedsnumberdiya-gl extensionoptional
hpAgreementsarray of tablesdiya-gl extensionHire purchase agreements financing an asset over a fixed term. The HPfinance sheet works out its own monthly payment, capital and interest split from these fields.optional
hpAgreements[].agreementIDstringdiya-gl extensionIdentifier matched by diya-gl:hpAgreement on the purchase line the agreement finances.required
hpAgreements[].descriptionstringdiya-gl extensionoptional
hpAgreements[].financeCompanystringdiya-gl extensionoptional
hpAgreements[].supplierstringdiya-gl extensionoptional
hpAgreements[].amountFinancednumberdiya-gl extensionrequired
hpAgreements[].adminChargesnumberdiya-gl extensionrequired
hpAgreements[].totalInterestnumberdiya-gl extensionrequired
hpAgreements[].termMonthsintegerdiya-gl extensionrequired
hpAgreements[].startDatestringdiya-gl extensionrequired
dividendsarray of tablesdiya-gl extensionDividends the board declared (Company Accounts only). The directors' report and the trial balance both read the declaration; the bank pays it in one or more instalments.optional
dividends[].declaredDatestringdiya-gl extensionoptional
dividends[].boardMeetingDatestringdiya-gl extensionrequired
dividends[].amountnumberdiya-gl extensionrequired
membersarray of tablesdiya-gl extensionThe register of members (Company Accounts only). A member is not always a director; directors[] holds the officers.optional
members[].memberIDstringdiya-gl extensionIdentifier matched by diya-gl:memberID on the dividend payment lines this member receives.required
members[].namestringdiya-gl extensionrequired
members[].sharesintegerdiya-gl extensionrequired
members[].nominalValuenumberdiya-gl extensionNominal value per share. The shipped register currently prices every holding at a single nominal value set for the whole company, so a per-member figure here is not yet read.optional
members[].acquiredDatestringdiya-gl extensionoptional
chargesarray of tablesdiya-gl extensionCharges and debentures registered over the company's assets (Company Accounts only). Each secures a creditor falling due after more than one year.optional
charges[].chargeDatestringdiya-gl extensionoptional
charges[].descriptionstringdiya-gl extensionThe charged asset, as it reads on the register (e.g. 'Motor vehicles, being the company's delivery van').optional
charges[].valuationnumberdiya-gl extensionrequired
charges[].holderstringdiya-gl extensionoptional
charges[].termsstringdiya-gl extensionoptional
charges[].boardMeetingDatestringdiya-gl extensionoptional
taxtableTax rates and thresholds. Values from HMRC published rates for the period. Used by validate and generate commands. Derived from gl-taf tax concepts.optional
tax.incomeTaxtableHMRC income tax rates and thresholds (England/Wales/NI)optional
tax.incomeTax.personalAllowancenumberoptional
tax.incomeTax.personalAllowanceTaperThresholdnumberoptional
tax.incomeTax.basicRatenumberoptional
tax.incomeTax.basicRateLimitnumberoptional
tax.incomeTax.higherRatenumberoptional
tax.incomeTax.higherRateThresholdnumberoptional
tax.incomeTax.additionalRatenumberoptional
tax.incomeTax.additionalRateThresholdnumberoptional
tax.nationalInsurancetableHMRC National Insurance rates (self-employed Class 2 + 4, employed Class 1)optional
tax.nationalInsurance.class2WeeklyRatenumberoptional
tax.nationalInsurance.class2SmallProfitsThresholdnumberoptional
tax.nationalInsurance.class4MainRatenumberoptional
tax.nationalInsurance.class4UpperRatenumberoptional
tax.nationalInsurance.class4LowerProfitsnumberoptional
tax.nationalInsurance.class4UpperProfitsnumberoptional
tax.nationalInsurance.class1EmployeeMainRatenumberoptional
tax.nationalInsurance.class1EmployeeUpperRatenumberoptional
tax.nationalInsurance.class1EmployeePrimaryThresholdnumberoptional
tax.nationalInsurance.class1EmployeeUpperEarningsLimitnumberoptional
tax.nationalInsurance.class1EmployerRatenumberoptional
tax.nationalInsurance.class1EmployerSecondaryThresholdnumberoptional
tax.nationalInsurance.employmentAllowancenumberoptional
tax.vattableHMRC VAT rates and thresholdsoptional
tax.vat.standardRatenumberoptional
tax.vat.reducedRatenumberoptional
tax.vat.registrationThresholdnumberoptional
tax.vat.flatRateSchemebooleanoptional
tax.vat.flatRatePercentagenumberoptional
tax.vat.staggerGroupinteger, one of 3Which of HMRC's three VAT stagger groups this business's quarters fall on.optional
tax.vat.firstPeriodEndstringThe end date of the first VAT return period the book's data covers, so the return cycle is data rather than inferred from the sheet's own dates.optional
tax.corporationTaxtableHMRC Corporation Tax rates (Company Accounts only)optional
tax.corporationTax.smallProfitsRatenumberoptional
tax.corporationTax.smallProfitsLimitnumberoptional
tax.corporationTax.mainRatenumberoptional
tax.corporationTax.mainRateThresholdnumberoptional
tax.corporationTax.associatedCompaniesintegeroptional
tax.capitalAllowancestableHMRC capital allowance ratesoptional
tax.capitalAllowances.annualInvestmentAllowancenumberoptional
tax.capitalAllowances.mainRateWDAnumberoptional
tax.capitalAllowances.specialRateWDAnumberoptional
tax.capitalAllowances.firstYearAllowanceRatenumberoptional
tax.mileagetableHMRC approved mileage rates (Taxi Driver / Self Employed)optional
tax.mileage.carFirst10000numberRate per mile, first 10,000 milesoptional
tax.mileage.carOver10000numberRate per mile, above 10,000 milesoptional
tax.mileage.motorcyclenumberoptional
tax.mileage.bicyclenumberoptional
tax.dividendstableDividend tax rates (Company Accounts — director extraction)optional
tax.dividends.allowancenumberoptional
tax.dividends.basicRatenumberoptional
tax.dividends.higherRatenumberoptional
tax.dividends.additionalRatenumberoptional
One account

Each four-digit account code in a section holds one of these.

FieldTypeXBRL GL 2015 elementMeaningRequired
accountMainDescriptionstringgl-cor:accountMainDescriptionHuman-readable account namerequired
accountTypestring, one of 9gl-bus:accountTypeGL account type enumerationoptional
diya-gl:columnstringdiya-gl extensionExcel column letter(s) for this account in the workbookoptional
diya-gl:sa103sBoxstringdiya-gl extensionSA103S box reference this account maps to (e.g. 'box10')optional
diya-gl:ct600Boxstringdiya-gl extensionCT600 box reference (Company Accounts only)optional
diya-gl:vatBoxintegerdiya-gl extensionVAT return box number (1-9) this account contributes tooptional

Transaction lines

One JSON object per line of lines.jsonl. Four fields are required on every line, and a journal line must also say which side it posts.

FieldTypeXBRL GL 2015 elementMeaningRequired
entryNumberstringgl-cor:entryNumberUnique transaction identifier within this bookoptional
lineNumberintegergl-cor:lineNumberLine within a multi-line journal entry (Company Accounts only)optional
sourceJournalIDstring, one of 6gl-cor:sourceJournalIDWhich journal/daybook this belongs torequired
enteredDatestringgl-cor:enteredDateDate keyed (ISO 8601)optional
enteredBystringgl-cor:enteredByUser or system that entered the transactionoptional
postingDatestringgl-cor:postingDateTax-relevant date (ISO 8601)required
accountMainIDstringgl-cor:accountMainIDNominal code from the chart of accounts in book.toml. Must name an account the book declares; enforced by the validator, not this schema.required
accountMainDescriptionstringgl-cor:accountMainDescriptionHuman-readable account nameoptional
accountSubIDstringgl-cor:accountSubIDSub-account or department codeoptional
accountSubDescriptionstringgl-cor:accountSubDescriptionSub-account descriptionoptional
debitCreditCodestring, one of 2gl-cor:debitCreditCodeD=Debit, C=Credit. Required on journal lines, because a journal line's sign is otherwise ambiguous.optional
amountnumbergl-cor:amountAlways positive, penny precisionrequired
amountCurrencystringgl-muc:amountCurrencyISO 4217 currency codeoptional
documentTypestring, one of 8gl-cor:documentTypeType of source documentoptional
documentReferencestringgl-cor:documentReferenceInvoice/receipt numberoptional
documentNumberstringgl-cor:documentNumberInternal document numberoptional
documentDatestringgl-cor:documentDateDate on source document (ISO 8601)optional
detailCommentstringgl-cor:detailCommentCustomer/supplier name or narrativeoptional
lineItemCommentstringgl-cor:detailCommentDescription of goods/servicesoptional
postingStatusstring, one of 3gl-cor:postingStatusEntry statusoptional
taxCodestring, one of 7gl-tafUK VAT code: S=Standard, R=Reduced, Z=Zero, E=Exempt, OS=Outside Scope, RC=Reverse Charge, NA=Not Applicableoptional
taxAmountnumbergl-cor:taxAmountVAT amount, always positiveoptional
taxRatenumbergl-taf:taxRateVAT rate as decimal (0.20 = 20%)optional
taxPointDatestringgl-taf:taxPointDateVAT tax point if different from postingDateoptional
taxDescriptionstringgl-cor:taxDescriptionHuman-readable tax descriptionoptional
paymentMethodstring, one of 9gl-bus:paymentMethodHow payment was made/receivedoptional
measurableQuantitynumbergl-bus:measurableQuantityNon-monetary quantity (miles, hours, units)optional
measurableUnitOfMeasurestring, one of 6gl-bus:measurableUnitOfMeasureUnit for measurableQuantityoptional
measurableDescriptionstringgl-bus:measurableQualifierWhat is being measuredoptional
diya-gl:bankCodestring, one of 19diya-gl extensionBank receipt/payment code, matching the analysis columns of the bank account workbooks. Transfers between accounts carry the letter of the account on the other side: BB=current, BS=savings, BC=cash, BD=credit card. Receipt only: K=interest received. Payment only: W=net wages, B=bank charges, J=interest paid, DV=dividend, RP=HMRC PAYE, RT=HMRC corporation tax. Either side: DR=trade debtor, CR=trade creditor, LDR=long term debtor, LCR=long term creditor, RV=HMRC VAT, RC=HMRC CIS, DL=directors loan, X=bank contra item. BC on a bank line with no other account on the other side is the workbook's own opening balance.optional
diya-gl:bankAccountIDstringdiya-gl extensionBank account code from book.toml accounts.bank (e.g. 1200=current, 1210=savings). Identifies which bank workbook this transaction belongs to.optional
diya-gl:employeeIDstringdiya-gl extensionEmployee identifier matching employees[] in book.toml. Used for payroll lines (sourceJournalID=payroll).optional
diya-gl:grossPaynumberdiya-gl extensionGross pay for this payroll period. Payroll lines only.optional
diya-gl:incomeTaxnumberdiya-gl extensionPAYE income tax deducted. Payroll lines only.optional
diya-gl:employeeNInumberdiya-gl extensionEmployee National Insurance deducted. Payroll lines only.optional
diya-gl:employerNInumberdiya-gl extensionEmployer National Insurance contribution. Payroll lines only.optional
diya-gl:netPaynumberdiya-gl extensionNet pay (gross - tax - employee NI). Payroll lines only.optional
diya-gl:cisDeductionnumberdiya-gl extensionCIS deduction amount withheld from sub-contractor payment. Purchases lines with CIS sub-contractors only.optional
diya-gl:hpAgreementstringdiya-gl extensionReference of the hire purchase agreement that finances this purchase, matching an id on book.toml hpAgreements[]. A purchase carrying one reaches the books as an ordinary trade creditor; the year-end journal then moves the amount financed onto creditors falling due after more than one year.optional
diya-gl:cisRatenumberdiya-gl extensionCIS deduction rate (0.20=20% standard, 0.30=30% higher, 0=gross payment). CIS lines only.optional
diya-gl:vatPeriodEndstringdiya-gl extensionThe VAT return period this line is declared on, when that period falls outside the accounting year the book covers. This is what makes a straddling entry representable: the line's postingDate sits in one accounting year, but its VAT is due on the return ending vatPeriodEnd.optional
diya-gl:assetIDstringdiya-gl extensionThe book.toml fixedAssets[] id this line moves: a capital purchase that registers the asset, or a disposal (an 'fs'-coded sale) that removes it.optional
diya-gl:memberIDstringdiya-gl extensionThe book.toml members[] id a dividend payment line settles.optional

Computed figures and their SA103S boxes

The three sole trader products fill the short self-employment pages, SA103S. The table gives every box on the 2026 form. figure means the product computes the box. derived means the page works it out from the profit and loss account. blank means the format carries nothing for that box, so it prints empty. Box numbers follow the 2026 form; nothing here is the HMRC document itself.

The last column is HMRC's own field name for the box in the Making Tax Digital Self Employment Business API, from HMRC's published SA103 mapping (sa103f_mapping_v3.csv, read 2026-09-04). 15 of the 34 boxes have one.

Self Employed books fill the full pages, SA103F, as well, and both they and Limited Company books fill a VAT return. Limited Company books file a CT600 and micro-entity accounts rather than SA103S. Every one of those views is on the product's own books page, and the figures behind them are on its reconciliation scorecard.

BoxLabelBasic Sole TraderTaxi DriverSelf EmployedMTD API field
9Your turnover, the takings, fees, sales or money earned by your businessfigurefigurefigureperiodIncome.turnover
10Any other business income not included in box 9figurefigurefigureperiodIncome.other
10.1Trading income allowanceblankblankblank
11Costs of goods bought for resale or goods usedfigurederivedfigureperiodExpenses.costOfGoods
12Car, van and travel expenses, after private use proportionfigurederivedfigureperiodExpenses.carVanTravelExpenses
13Wages, salaries and other staff costsfigurederivedfigureperiodExpenses.wagesAndStaffCosts
14Rent, rates, power and insurance costsfigurederivedfigureperiodExpenses.premisesRunningCosts
15Repairs and maintenance of property and equipmentfigurederivedfigureperiodExpenses.maintenanceCosts
16Accountancy, legal and other professional feesderivedderivedfigureperiodExpenses.professionalFees
17Interest and bank and credit card financial chargesderivedderivedfigureperiodExpenses.interestOnBankOtherLoans
18Phone, fax, stationery and other office costsderivedderivedfigureperiodExpenses.adminCosts
19Other allowable business expensesderivedderivedfigureperiodExpenses.otherExpenses
20Total allowable expensesderivedderivedfigure
21Net profit, if your business income is more than your expensesfigurefigurefigure
22Or, net loss, if your expenses exceed your business incomefigurefigurefigure
23Annual Investment Allowancefigurefigurefigureallowances.annualInvestmentAllowance
24Allowance for small balance of unrelieved expenditurefigurefigurefigure
24.1Zero-emission car allowanceblankblankblank
25Other capital allowancesfigurefigurefigure
25.1The Structures and Buildings Allowanceblankblankblank
25.2Freeport and Investment Zones Structures and Buildings Allowanceblankblankblank
26Total balancing charges, for example where you have disposed of items for more than their tax valuefigurefigurefigureadjustments.balancingChargeOther | adjustments.balancingChargeBpra
27Goods and/or services for your own usefigurefigurefigureadjustments.goodsAndServicesOwnUse
28Net business profit for tax purposesfigurefigurefigure
29Loss brought forward from earlier years set off against this year's profitsfigurefigurefigure
30Any other business income not included in box 9 or box 10figurefigurefigureadjustments.outstandingBusinessIncome
31Total taxable profits from this businessfigurefigurefigure
32Net business loss for tax purposesblankblankfigure
33Loss from this tax year set off against other income for 2025-26blankblankblank
34Loss to be carried back to previous years and set off against income (or capital gains)blankblankblank
35Total loss to carry forward after all other set-offs, including unused losses brought forwardblankblankfigure
36Voluntary Class 2 NICsblankblankblank
37Exempt from Class 4 NICsblankblankblank
38Total CIS deductions taken from your payments by contractorsblankblankfigure

The check catalogue

A book is read in three stages. The two JSON Schemas validate book.toml and every line of lines.jsonl. The validator then refuses a file whose lines reach an account the book does not declare, or name a hire purchase agreement, an asset or a member the registers do not hold. Last, the 27 book checks below run over the data itself.

A check passes or fails, and a failure names the entries that caused it; 13 of the rules are checks. A warning passes or warns and never blocks a save; 14 of them are warnings. Which rules a book runs depends on the product it declares. Every result is written to bookchecks.json in the zip.

Beside these, the engine runs its reconciliation checks: one for every figure the workbook and the engine both compute, compared to the penny. Those depend on the books in hand rather than on the format, and every one of them is published on the scorecards below.

IdWhat it readsSeverityProducts
book-accounts-in-chartEvery entry reaches an account the book's chart of accounts declares.checkall
book-amounts-whole-penceEvery amount is a whole number of pence.checkall
book-dates-in-periodEvery entry is dated inside the accounting period the book declares.checkall
book-duplicate-entriesNo two entries share the same journal, date, amount and detail without being each other's two sides.warningall
book-empty-detailEvery entry names who or what it was with.warningall
book-empty-monthEvery month between the first and last entry has at least one entry.warningall
book-negative-amountEvery sale and purchase amount is zero or more.warningall
book-vat-thresholdTurnover for the year against the VAT registration threshold for that year.warningall
book-bank-account-has-workbookEvery bank entry is on an account the package keeps a workbook for.checkSelf Employed
book-bank-code-analysedEvery bank entry is coded to a column its workbook analyses.checkSelf Employed
book-bank-line-has-sideEvery bank entry says whether it is a receipt or a payment.checkSelf Employed
book-fixed-asset-rows-fitEvery asset, disposal and hire purchase agreement has a row on the fixed asset schedule.checkSelf Employed
book-ltd-bank-code-analysedEvery bank entry is coded to a column its workbook analyses.checkLimited Company
book-ltd-bank-line-has-sideEvery bank entry says whether it is a receipt or a payment.checkLimited Company
book-ltd-fixed-asset-rows-fit-scheduleEvery asset, disposal and hire purchase agreement has a row on the fixed asset schedule.checkLimited Company
book-ltd-payroll-line-names-employeeEvery payroll entry names someone on the payroll.checkLimited Company
book-ltd-straddling-line-has-vat-periodEvery sale and purchase dated outside the period names the VAT return period it belongs to.checkLimited Company
book-payslip-names-employeeEvery payslip names someone the book employs.checkSelf Employed
book-bank-overdrawnThe bank book closes every month at zero or more.warningSelf Employed
book-cash-never-overdrawnThe cash book closes every month at zero or more.warningSelf Employed
book-employee-paid-every-monthEvery employee is paid in each month between their first and last payslip.warningSelf Employed
book-ltd-cis-on-subcontractor-lineEvery CIS deduction sits on a sub-contractor purchase.warningLimited Company
book-ltd-dividend-within-distributable-profitsDividends declared against the retained profits available to pay them.warningLimited Company
book-ltd-transfer-has-counter-legEvery transfer between the company's own accounts appears on both of them.warningLimited Company
book-taxi-fare-milesEvery fare day that carries miles elsewhere carries its own.warningTaxi Driver
book-taxi-miles-bandBusiness miles stay inside the higher-rate mileage band.warningTaxi Driver
book-taxi-vehicle-registerEvery vehicle bought is on the fixed asset register.warningTaxi Driver

The zip layout

The zip has no directories. Its entries are:

EntryWhat it holds
book.tomlThe business, the period, the chart of accounts and the registers. Always written.
lines.jsonlOne transaction per line, in canonical order. Always written.
report.jsonEvery figure the engine computed from the two files above, keyed by its cell reference. Always written.
bookchecks.jsonThe result of every check and warning in the catalogue above, sorted by id. Written when the writer has run them.
overtyped.jsonAny cell a person typed over in the workbook, so the next generation keeps it. Written when there is one.

Two writes of the same book produce the same bytes, on any machine and in any of the three surfaces (the browser page, the command line tool and the MCP server). The rules that make that hold:

The same book and lines also travel as one JSON file, with a { "format": "diya-gl-books", "version": 1, "product": ..., "book": ..., "lines": [...] } envelope, and as that JSON zipped. The books pages read all three, plus a workbook and a package zip.

Versioning and provenance

The format is diya-gl-books version 1. The two schemas are at v2, and the version is part of each schema's $id URL. A v1 existed but nothing outside this repository ever read it, so v2 replaced it in place.

Five stamps sit in the book's document info and at the head of report.json. They answer the question a file raises years later. Recalculate a 2026 book in 2030 and it either reproduces its report.json byte for byte, or names the stamp that differs.

StampValueWhat it answersStatus
format versiondiya-gl-books 1Can this tool read this filewritten today
engine versionthe package version, and the commit it was built fromWhich code produced these figureswritten today
tax-data versiona hash over the year's rate filesWhich rates were appliedwritten today
template versiona hash over the product's workbook templatesWhich workbook this reproduceswritten today
reconciled committhe commit whose reconciliation run passedThe proof this release rests onwritten by the reconciliation workflows' commit job, empty until the first one runs

Reconciliation evidence

Every figure this format computes is checked against the same figure in the spreadsheet. For each product, CI generates the package from a set of books, recalculates the workbook in LibreOffice, computes the same figures from the diya-gl data alone, and compares the two to the penny. Each scorecard carries the whole run: its status, the checks, the input transactions, screenshots of the recalculated sheets, the accounting statements and the tax review.

ProductFeatured scenario
Basic Sole Traderbst-scenario-basic
Taxi Drivertaxi-scenario-basic
Self Employedse-scenario-advanced
Limited Companyltd-scenario-full

All reconciliation reports

Getting the tools

The books pages read and write the format in your browser. Nothing you load leaves the machine.

The same engine runs on the command line and as an MCP server, published as the npm package @diy-accounting-uk/diya-gl. It is not on npm yet; this page will carry the install line when it is.

The spreadsheets themselves stay free to download on a donation basis. Download a package, or chip in if the tools earn it.