Before attempting to add entries with createAccountingEntry, it is recommended to explore the capabilities of createAccountingEntryUsingCodes, or, according to your preference, createAccountingEntryUsingIds.
Note that to ensure business rule consistency, when the API receives a createAccountingEntryUsingCodes mutation, it internally ends up calling createAccountingEntry.
Creation of Accounting Entries by using business Codes instead of internal Sage Active ids.
This approach can be simpler because developers are likely more familiar with business codes as they directly relate to the business domain.
This reduces the need for additional database lookups to translate codes to IDs, which can result in faster performance due to caching.
Advantages
Direct use of journal codes, third-party codes, and account codes, eliminating the need for Sage Active IDs.
Automatic validation of the existence of journal codes, third-party codes, and account codes.
Automatic detection of the third-party type (Client, Supplier, Employee) based on the sub-account class.
Optimized performance through the utilization of an internal cache for fetching journal, third-party, and account IDs, thereby reducing the number of queries required.
Simplified model definition with streamlined lines that eliminate the need to manage accountingEntryThirdParty and accountingEntryInvoice sub-resources.
Automatic assignment of the description and document number from the header to the lines if not defined in the line.
Automatic creation of tax registers if the consistency of the transaction amounts allows it.
Automatic summation of debit or credit from multiple lines of the same third party in the entry, merging them into a single entry line.
Preservation of all business controls managed by Sage Active to ensure the integrity of the added entries.
NEWNew Feature Recently Added Automatic creation of tax registers
The creation of tax registers for purchase and sales invoices is now automatic.
Registers are created if the prerequisites are met; otherwise, priority is given to the creation of the accounting entry without creating the registers, rather than allowing the Sage Active business controller to reject the entry for non-compliance with the registers.
The conditions are:
Tax codes for revenue or expense accounts must be defined.
The VAT accounts defined in the tax codes of these accounts must be those present in the entry.
The VAT amount and the associated taxable base for the VAT account and the expense or revenue account must be consistent with the VAT rate of the tax code.
Other management rules not respected or not yet accounted for by Sage Active.
Primary or secondary subscription key of your app How to find?
createAccountingEntryUsingCodes
Fields
Type
Description
date *The value of the field or object is mandatory
Datetime DateThe GraphQL field type is DateTime, but only the date value is considered, the time value is ignored if provided.
Date of the accounting entry
journalTypeCode *The value of the field or object is mandatory
String
An existing journal code
documentDate
Datetime DateThe GraphQL field type is DateTime, but only the date value is considered, the time value is ignored if provided.
Date of the accounting document See InfoAdditional information is available in the Info block below
documentNumber
String
Document number or reference of the entry See InfoAdditional information is available in the Info block below
description
String
Description See InfoAdditional information is available in the Info block below
accountingEntryLines[] *The value of the field or object is mandatory
Array
List of all entry lines See InfoAdditional information is available in the Info block below
Info
documentDate: An optional date field indicating the date of the document associated with the accounting entry.
If not provided, the document date will be automatically set to match the accounting entry date.
documentNumber: The reference number of the document.
For purchases or sales, it can be filled with the invoice number.
description: A value used as a template for lines from the interface, which assigns a default value to the lines.
This value is optional
This value is optional
This value is mandatory even if descriptions are given for each line.
accountingEntryLines: A list of lines in the accounting entry.
The accounting entry must be balanced, meaning the total of the lines with a debit must be equal to the total of the lines with a credit.
Attempting to add an unbalanced entry will result in an error.
subAccountCode *The value of the field or object is mandatory
String
code of a general account See InfoAdditional information is available in the Info block below
thirdCode
String
code of a third See InfoAdditional information is available in the Info block below
description
String
Description
debitAmount *The value of the field or object is mandatory
Decimal
Amount debit See InfoAdditional information is available in the Info block below
creditAmount *The value of the field or object is mandatory
Decimal
Amount credit See InfoAdditional information is available in the Info block below
Info
subAccountCode: An existing general account, which is required on each of the entry lines.
thirdCode: An existing third-party code, which is necessary on one of the lines if the entry pertains to a third party, such as a purchase invoice, sales invoice, or any other accounting entry that involves a third party.
Based on the class of the subAccountCode, the type of third party (Customer, Supplier, Employee) will be automatically detected.
description: The description of the line. If not specified, it will be assigned the value from the description field of the entry header.
creditAmount, debitAmount: The accounting entry must be balanced, meaning the total of the lines with a debit must equal the total of the lines with a credit.
Attempting to add an unbalanced entry will result in an error.
For the PURCHASE_INVOICE or SALES_INVOICE journals, if several lines contain the same third party, these lines are merged into one, with the sum of the debit or credit of the lines.
This allows compliance with Sage Active while, for instance, permitting the addition of entries from an import file containing invoices where the due dates are split over several lines.