Base Accounting API¶
Accounts List¶
To view all accounts, use the GET /api/accounting/accounts/ REST API. It also supports pagination.
Journal Entry List¶
To view all accounting entries, use the GET /api/accounting/entries/ REST API. It also supports pagination.
Filtering¶
The list endpoint supports exact-match and some operational filtering via query parameters:
| Parameter | Type | Description | Example |
|---|---|---|---|
| description | str |
Filter by exact description text. | ?description=Opening balance |
| description__contains | str |
Filter by case-sensitive substring match on description. | ?description__contains=balance |
| number | str |
Filter by entry number. | ?number=1001 |
| reference_number | int |
Filter by reference number. | ?reference_number=42 |
| date | str |
Filter by date (YYYY-MM-DD). | ?date=2026-01-15 |
| status | int |
Filter by entry status code (0=draft, 1=saved, 2=posted). |
?status=2 |
| entry_type | int |
Filter by entry type code (0=regular, 1=opening, 2=closing, 3=nominal closing). |
?entry_type=0 |
Multiple filters can be combined: ?status=1&date=2026-01-15.
Create Journal Entry¶
Creating accounting entries is one of the most common accounting operations. To create a new entry, use POST /api/accounting/entries/. The main parameters are listed below.
| Parameter | Type | Description | Example |
|---|---|---|---|
| date | str |
The date of entry. Optional, defaults to today. | "2025-01-15" |
| description | str |
Textual description of the entry. Defaults to empty string. | "Payment for buying a software asset." |
| lines | list[EntryLine] |
The list of entry lines of this journal. Each list item should be a dict with required fields for EntryLine. See below for field details. |
[] |
You may also want to specify the following optional parameters in more specific use cases:
| Parameter | Type | Description | Example |
|---|---|---|---|
| number | str or int |
The number of entry. If not provided, will be auto generated sequentially. | 1 |
| reference_number | int |
The external reference number of the entity. This number is not changed by accounting operations and you can always use it to reference your entity. If not provided, will be auto generated sequentially. | 1 |
| is_draft | bool |
Whether this entry should be saved only as a draft version. Draft entries are just an accounting work in progress and their transactions do not show in reports. Defaults to false that means the entry is not a draft. See Entry States for more details. |
false |
| is_posted | bool |
Whether this entry is final and should be posted. Defaults to false that means the entry is not final and can be edited later. See Entry States for more details. |
false |
Entry Lines¶
Each entry has multiple lines. Each line is a single credit or debit action. Final entries must have at least two entry lines, and the total value of their debit and credits must be equal (balanced). Parameters for each line are described in this table:
| Parameter | Type | Description | Example |
|---|---|---|---|
| account | int or str |
The coding for the account this line references. | 1101 |
| tafsil | int or str or dict |
The number of the Party/Product/… that this line refers to. Optional, and can only be set if the account accepts tafsil. See Tafsil Object Reference for alternative ways of referencing objects. | 10001 or "10001" or {"mobile": "09120000000"} |
| credit | int |
The credit amount for this line, if it is a credit line. For debit lines, this value should not be passed. Amount is always an integer multiple of the minimum currency scale, usually IRR. | 10000 (one thousand Toman) |
| debit | int |
The debit amount for this line, if it is a debit line. For credit lines, this value should not be passed. Amount is always an integer multiple of the minimum currency scale, usually IRR. | 10000 (one thousand Toman) |
| description | str |
Textual description of the line. Defaults to empty string. | "Buy software X." |
Note that exactly one of the credit and debit parameters must be set for each line. Zero values are allowed and treated as if the value is not passed.
You may also want to specify the following optional parameters for each entry line:
| Parameter | Type | Description | Example |
|---|---|---|---|
| create_tafsil_object | bool |
If the target Party/Product/… object does not exists yet, you can set this option to true and the target object is automatically created if it does not exist. This parameter provides an easier way for managing Party and other referenced objects without calling other API endpoints. It creates the Party/… object with the number or Tafsil Object Reference passed in the tafsil parameter of the line. |
false |
| line_number | int |
Index of the line in entry, starting from 1 for the first line. This value is optional and defaults to the order of the line in the lines list. | 1 |
Sample Requests¶
Buying a office:
{
"date": "2026-01-08",
"description": "پرداخت بابت خرید دفتر ۱",
"lines": [
{"account": "2104", "debit": "20000000000", "description": "زمین"},
{"account": "2103", "debit": "80000000000", "description": "ساختمان"},
{"account": "1101", "credit": "100000000000", "description": "موجودی نقد - بانک"}
]
}
Early salary payment to an employee:
{
"date": "2026-01-08",
"description": "پرداخت مساعده به کارمند ۱۰۱",
"lines": [
{"account": "1402", "tafsil": "101", "debit": "50000000", "description": "کارمند ۱۰۱"},
{"account": "1101", "credit": "50000000", "description": "موجودی نقد - بانک"}
]
}
Success Response¶
A 201 response with the serialized data of the created entry will be returned if the operation is successful.
You can store the returned number or reference_number of the created entry if you want to lookup or reference it later.
Error Responses¶
| Message | Description |
|---|---|
| Duplicate number. | The number for the entry is provided manually in the request, but is not unique and already exists in entries table. |
| Duplicate reference_number. | The reference_number for the entry is provided manually in the request, but is not unique and already exists in entries table. |
Bulk Create Journal Entries¶
To create multiple entries in a single request, use POST /api/accounting/entries/bulk/. The request body must be a JSON list where each item has the same fields as Create Journal Entry.
Success Response¶
A 201 response with a list of serialized entries in the same order as the request. Each item may include post_errors or validation_errors just like the single-entry endpoint.
Error Responses¶
If any entry fails validation, a 400 response is returned immediately and none of the entries are saved. The error message is only provided for the first entry with error.
Delete Journal Entry¶
To delete an accounting entry, use the DELETE /api/accounting/entries/PK/ REST API. On successful deletion, an HTTP 204 response is returned and the entry and all of its related lines and transfers are deleted. If the entry is finalized and cannot be deleted, an HTTP 400 response is returned.
Multiple Journal Support¶
Larger organizations with a large number of entries or with multiple accounting teams may want to group their entries in multiple journals. For creating multiple journals, first ensure that your installation supports this feature, and then use the admin interface or the journals API to manage journals.
When multiple journals are enabled and configured, you can pass the journal parameter to Create Journal Entry endpoint to select the journal to add the entry:
| Parameter | Type | Description | Example |
|---|---|---|---|
| journal | int or str |
Either the codename or ID of the journal object. Defaults to the journal with is_default: True, which is usually the General Journal (GEN). |
"GEN", 1 |