Developer guide
Read a year-end package in your own tools.
Each generated T2 working-paper PDF has a matching JSON file. Use it to find the source records behind an amount or see who reviewed a particular revision.
Inspect a fictional company’s books
Save the sample JSON and Node.js script in one folder. Open a terminal there and run this command with Node.js 22 or later. It reads the file on your computer and prints a summary.
node inspect.mjs mahnah-year-end.json
The sample shows Éclat Corporate QA Inc., revision 3, with accountant review and owner approval. The filing status is not_filed. You can also view the matching PDF or download its financial worksheet (CSV).
Find the evidence in the JSON
records- Bookkeeping entries, signed CAD amounts, reviewed tax decisions and linked source references where supplied.
metadata.sourceHash- The fingerprint of the source state used for this copy. A changed set of source records can produce a new fingerprint.
reviewandhistory- Owner and accountant decisions saved with the package. Review status describes the moment of export. Open the current preparation in Mahnah to check later changes.
schemaVersionandformType- Use both before interpreting fields. This example reads version 1 of
t2-preparation-review.
Download an approved worksheet from a script
Owners can create a key under Taxes → T2 year-end package → Download this worksheet through the API after generating the approved copy. Save the key to your secret store and supply it as the environment variable FOLIO_WORKSHEET_KEY.
Run this example with Node.js 22 or later. It creates a new file in your current directory and preserves any worksheet already stored under the same name.
import { writeFile } from 'node:fs/promises';
const key = process.env.FOLIO_WORKSHEET_KEY;
if (!key) throw new Error('Set FOLIO_WORKSHEET_KEY');
const url = 'https://folio-books.up.railway.app'
+ '/api/exports/v1/worksheet.csv';
const result = await fetch(url, {
headers: { Authorization: `Bearer ${key}` },
redirect: 'error'
});
if (!result.ok) throw new Error('HTTP ' + result.status);
await writeFile('worksheet.csv', await result.text(),
{ flag: 'wx', mode: 0o600 });
The key reads one revision’s CSV for 24 hours. It cannot open receipts, list other packages or change the books. Revoke it from the same panel when your script finishes. A 401 response means the key is absent, expired or revoked. A 409 or 422 means the package needs current approval. For a 429 response, wait one minute.
Use your own export
In your signed-in workspace, open Taxes, choose a T2 year-end package and generate a review copy. Download its source JSON and pass the saved filename to the same command. Once the accountant reviews and the owner approves the current, complete package, its financial worksheet is available too.
Real exports contain business identifiers, transaction details and reviewer names. Keep them with the other private records for that business. Your accountant completes the T2 in certified filing software.
Create a workspace