Accounting¶
These resources cover the company's general ledger: journals, the chart of accounts, ledger entries and their lines, the trial balance, and fiscal years.
Journals ($client->journals)¶
Accounting journals used to classify ledger entries.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($cursor = null, $limit = null, $filter = null, $sort = null) |
GET /journals |
journals:readonly |
List journals. |
create($code, $label) |
POST /journals |
journals:all |
Create a journal. |
get($journalId) |
GET /journals/{journalId} |
journals:readonly |
Retrieve a journal by its identifier. |
LedgerAccounts ($client->ledgerAccounts)¶
The chart of accounts.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($cursor = null, $limit = null, $filter = null, $sort = null) |
GET /ledger_accounts |
ledger_accounts:readonly |
List ledger accounts. |
create($number, $label, $vatRate = null, $countryAlpha2 = null) |
POST /ledger_accounts |
ledger_accounts:all |
Create a ledger account. If the number starts with 401 or 411, the API may also create a matching auxiliary account. |
get($ledgerAccountId) |
GET /ledger_accounts/{ledgerAccountId} |
ledger_accounts:readonly |
Retrieve a ledger account by its identifier. |
update($ledgerAccountId, $label = null, $letterable = null) |
PUT /ledger_accounts/{ledgerAccountId} |
ledger_accounts:all |
Update a ledger account. |
LedgerAttachments ($client->ledgerAttachments)¶
Deprecated resource. /ledger_attachments is marked deprecated by the API; upload the file through $client->fileAttachments instead and pass its id as file_attachment_id when creating or updating a ledger entry.
| Method | HTTP | Scope | Description |
|---|---|---|---|
create($file, $filename = null) |
POST /ledger_attachments |
ledger |
Upload a file as a ledger attachment (deprecated). |
LedgerEntries ($client->ledgerEntries)¶
Ledger entries: the accounting entries made of balanced debit and credit lines.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($cursor = null, $limit = null, $filter = null, $sort = null) |
GET /ledger_entries |
ledger_entries:readonly |
List ledger entries. |
create($date, $label, $journalId, $ledgerEntryLines, $dueDate = null, $fileAttachmentId = null, $currency = null, $pieceNumber = null, $ledgerAttachmentId = null) |
POST /ledger_entries |
ledger_entries:all |
Create a ledger entry. Every line needs both a debit and a credit key ("0.00" on the unused side), and the lines must balance. |
get($ledgerEntryId) |
GET /ledger_entries/{ledgerEntryId} |
ledger_entries:readonly |
Retrieve a ledger entry by its identifier. |
update($ledgerEntryId, $date = null, $label = null, $journalId = null, $ledgerEntryLines = null, $fileAttachmentId = null, $currency = null, $pieceNumber = null, $ledgerAttachmentId = null) |
PUT /ledger_entries/{ledgerEntryId} |
ledger_entries:all |
Update a ledger entry, including creating, updating or deleting individual entry lines. |
listLedgerEntryLines($ledgerEntryId, $cursor = null, $limit = null, $filter = null, $sort = null) |
GET /ledger_entries/{ledgerEntryId}/ledger_entry_lines |
ledger_entries:readonly |
List the entry lines of a ledger entry. |
Note: fileAttachmentId replaces the deprecated ledgerAttachmentId parameter on both create() and update().
LedgerEntryLines ($client->ledgerEntryLines)¶
Individual debit or credit lines, with lettering and analytical categorization.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($cursor = null, $limit = null, $filter = null, $sort = null) |
GET /ledger_entry_lines |
ledger_entries:readonly |
List ledger entry lines. |
get($ledgerEntryLineId) |
GET /ledger_entry_lines/{ledgerEntryLineId} |
ledger_entries:readonly |
Retrieve a ledger entry line by its identifier. |
letter($ledgerEntryLineIds, $unbalancedLetteringStrategy) |
POST /ledger_entry_lines/lettering |
ledger_entries:all |
Letter ledger entry lines together; returns the ids of every line in the resulting lettering. |
unletter($ledgerEntryLineIds, $unbalancedLetteringStrategy) |
DELETE /ledger_entry_lines/lettering |
ledger_entries:all |
Unletter ledger entry lines. |
listLetteredLines($ledgerEntryLineId, $cursor = null, $limit = null, $sort = null) |
GET /ledger_entry_lines/{ledgerEntryLineId}/lettered_ledger_entry_lines |
ledger_entries:readonly |
List the ledger entry lines lettered together with a given entry line. |
listCategories($ledgerEntryLineId, $cursor = null, $limit = null, $sort = null) |
GET /ledger_entry_lines/{ledgerEntryLineId}/categories |
ledger_entries:readonly |
List the analytical categories linked to a ledger entry line. |
categorize($ledgerEntryLineId, $categories) |
PUT /ledger_entry_lines/{ledgerEntryLineId}/categories |
ledger_entries:all |
Link analytical categories to a ledger entry line, each with a weight between 0 and 1. |
Note: unbalancedLetteringStrategy accepts "none" (reject an unbalanced result with an error) or "partial" (allow it). unletter() sends a JSON body on a DELETE request, which is unusual but required by the API.
TrialBalance ($client->trialBalance)¶
The trial balance for a given period.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($periodStart, $periodEnd, $isAuxiliary = null, $cursor = null, $limit = null) |
GET /trial_balance |
trial_balance:readonly |
Get the trial balance for a period. |
Note: list() returns a CursorPage<TrialBalanceItem>, so it paginates like the other list methods. TrialBalanceItem is the one DTO in the SDK without an id property, since the API does not return an identifier for these rows; use number or formattedNumber instead.
FiscalYears ($client->fiscalYears)¶
The company's fiscal years.
| Method | HTTP | Scope | Description |
|---|---|---|---|
list($cursor = null, $limit = null, $sort = null) |
GET /fiscal_years |
fiscal_years:readonly |
List the company's fiscal years. |
Example¶
<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use Pennylane\Sdk\Pennylane;
$client = new Pennylane();
$journal = $client->journals->create('OD', 'Miscellaneous operations');
$entry = $client->ledgerEntries->create(
date: '2026-07-01',
label: 'Office supplies',
journalId: $journal->id,
ledgerEntryLines: [
['ledger_account_id' => 606100, 'debit' => '120.00', 'credit' => '0.00'],
['ledger_account_id' => 512000, 'debit' => '0.00', 'credit' => '120.00'],
],
);
foreach ($client->trialBalance->list('2026-01-01', '2026-06-30') as $item) {
echo "{$item->number} {$item->label}: debit {$item->debits}, credit {$item->credits}\n";
}