Back to Blog
getting-startedapitutorials

Getting Started with the Prosaic API

What a headless ledger is, how the embedded model works, and your first entity, journal and trial balance with the Node SDK.

Prosaic TeamMarch 19, 20264 min read

What Prosaic is

Prosaic is the headless ledger for New Zealand and Australia: double-entry accounting as an API, with GST built in, that your customers' accountants can work in directly.

Your product sends journals. Prosaic keeps the books: the chart of accounts, GST-coded lines, the trial balance, profit and loss and balance sheet. The same books open in the Prosaic app, where an accountant can review them, correct them and, in New Zealand, file the GST return.

Australia is in early access: the ledger, AU GST tax codes, an AU chart of accounts, AUD and a 1 July financial year work today, and AU bank feeds and BAS are coming.

The embedded model

You sign up once and get a platform workspace. Each of your customers becomes an entity inside it, in the way a payments platform holds one connected account per merchant.

  • An entity is one set of books for one business, with its own chart of accounts and tax rates.
  • Your backend writes to every entity with one API key, so your customers do not need Prosaic logins.
  • If a customer has an accountant, you invite them in the app as an advisor with access to that customer's entity and no other.
  • An entity takes its country, currency and financial year from its workspace. If you serve customers in both countries, run one workspace for each.

Before you start

  • A workspace. Sign up at app.prosaic.works/signup. New sign-ups get a New Zealand workspace; for an Australian one, write to developer@prosaic.works.
  • An API key. A workspace owner or admin creates it in the app: Settings → Users, open the Actions menu (⋯) on the user the key should act as, choose Manage API keys, then Create API Key. Create it for an owner or admin, who can see every entity in the workspace. The key starts with prsk_ and is shown only once.
  • Node.js 22 or later, and the SDK. prosaic-node is published under the next tag. Install it as described in Node SDK.

Keep the key in your server environment:

bash
export PROSAIC_API_KEY="prsk_..."

Create an entity for a customer

A new entity's accounts are copied from a chart of accounts template. Every workspace starts with a standard chart for its country, so pick that one and create the entity from it.

ts
import Prosaic from 'prosaic-node';

const apiKey = process.env.PROSAIC_API_KEY;
if (!apiKey) throw new Error('Set PROSAIC_API_KEY first.');

const prosaic = new Prosaic(apiKey);

const templates = await prosaic.charts.list().autoPagingToArray({ limit: 50 });
const standard = templates.find((t) => t.name.startsWith('Standard'));
if (!standard) throw new Error('No standard template in this workspace.');

const { data: entity } = await prosaic.entities.create({
  name: 'Kowhai Cafe Ltd',
  type: 'company',
  accountTemplateId: standard.id,
  industryCode: 'H451110',
});
console.log(entity.id, entity.currency);

name, type, accountTemplateId and industryCode are required. type is one of individual, company, trust, partnership, rental or other. Use industryCodes.search() to find the business's code. Store entity.id against your customer record. The entity is not GST registered unless you say so.

Post a balanced journal

A journal is a dated set of debit and credit lines. Each line names an account by its code and carries a tax rate ID from the entity's taxRates. In the standard charts, 4030 is Office Expense and 8220 is Accounts Payable; charts can be edited, so check your own with prosaic.entityAccounts.list(entity.id).

ts
const noGst = entity.taxRates.find((rate) => rate.code === 'NZ_GST_0_NONE');
if (!noGst) throw new Error('No "No GST" rate on this entity.');

const journal = await prosaic.journals.create(entity.id, {
  date: '2026-10-01',
  narration: 'Office supplies, supplier invoice 1042',
  taxMode: 'NO_TAX',
  lines: [
    { entityAccountCode: '4030', taxRateId: noGst.id, debit: '115.00' },
    { entityAccountCode: '8220', taxRateId: noGst.id, credit: '115.00' },
  ],
});
console.log(journal.id, journal.status); // status is "posted"

Without the SDK, it is the same body sent to the REST API:

bash
curl -X POST https://app.prosaic.works/api/public/v1/entities/YOUR_ENTITY_ID/journals \
  -H "Authorization: Bearer $PROSAIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "date": "2026-10-01",
    "narration": "Office supplies, supplier invoice 1042",
    "taxMode": "NO_TAX",
    "lines": [
      { "entityAccountCode": "4030", "taxRateId": "YOUR_NO_GST_RATE_ID", "debit": "115.00" },
      { "entityAccountCode": "8220", "taxRateId": "YOUR_NO_GST_RATE_ID", "credit": "115.00" }
    ]
  }'

A few things to know:

  • Debits must equal credits. Check the balance before you send: an unbalanced journal is refused and nothing is saved, though today the API reports it as 500 Failed to create journal rather than a 400.
  • Amounts are decimal strings, with each line's amount on one side only.
  • Journals post straight away unless you send autoPost: false, which saves a draft for someone to review in the app.
  • The journal comes back as itself, not in a data envelope. Keep its logicalJournalId: voiding the journal or attaching files to it later takes that ID.
  • In Australia the "No GST" rate is AU_GST_0_NONE.

Read a report

ts
const trialBalance = await prosaic.reports.trialBalance(entity.id, {
  asOfDate: '2026-10-31',
});
console.log(trialBalance.totals); // totalDebits, totalCredits, isBalanced, variance

Reports read straight from posted journals, so the one above shows up as soon as it is created. They return plain objects, not a data envelope, and amounts come back as decimal strings; use a decimal library such as Decimal.js for any arithmetic on them. reports.profitLoss and reports.balanceSheet are alongside it.

Build with AI

Every page of the docs is also published as Markdown, and the whole site is indexed at llms.txt. For a coding agent, add the developer MCP server, which searches the docs and the API and needs no sign-in:

bash
claude mcp add --transport http prosaic-dev https://developer.prosaic.works/mcp

What next

  • Quickstart — the same steps in more detail, each shown with the SDK and with curl.
  • Embedded ledger — one entity per customer, one workspace per country, avoiding double-posting, and giving a customer's accountant access.
  • Build with AI — llms.txt, both MCP servers and the SDK's skill for coding agents.
  • API reference — REST endpoints with request and response examples.

Questions? Write to developer@prosaic.works.