Note

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.

HTTP Operation Type Object DTO Why-DTOs?
Mutation createAccountingEntryUsingCodes AccountingEntryCreateUsingCodesGLDtoInput

Description

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.

img

Advantages


To see examples of mutations that include the adding of accounting entries :
download the Postman collection: Quick start / 5. Test your first query in Postman

Would you like to see an example of how to add an entry?

This example pertains to a sales invoice.
To convert it into a purchase invoice, simply use a purchase journal and a supplier code.

graphQL Mutation
mutation ($values:AccountingEntryCreateUsingCodesGLDtoInput!) {    
  createAccountingEntryUsingCodes (input: $values) {
    id
  }
}
graphQL Variables
{
  "values": {
    "description": "Facture FA0022",
    "date": "2023-01-01",
    "documentDate": "2022-12-16",
    "documentNumber": "FA0022",
    "journalTypeCode": "VTE",
    "accountingEntryLines": [
      {
        "thirdCode": "BAGUES",
        "description": "Facture FA0022 régularisation",
        "creditAmount": 0,
        "debitAmount": 158.25
        "subAccountCode": "411000000"
      },
      {
        "creditAmount": 150,
        "debitAmount": 0,
        "subAccountCode": "701005000"
      },
      {
        "creditAmount": 8.25,
        "debitAmount": 0,
        "subAccountCode": "445710500"
      }
    ]
  }
}

Tax registers

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:

Key Value
Authorization Bearer Current access Token How to find?
X-TenantId Current tenant id How to find?
X-OrganizationId Current organization Id How to find?
x-api-key Primary or secondary subscription key of your app How to find?

createAccountingEntryUsingCodes

Fields Type Description
date Datetime Date of the accounting entry
journalTypeCode String An existing journal code
documentDate Datetime Date of the accounting document
documentNumber String Document number or reference of the entry
description String Description
accountingEntryLines[] Array List of all entry lines
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.


createAccountingEntryUsingCodes/accountingEntryLines

Fields Type Description
subAccountCode String code of a general account
thirdCode String code of a third
description String Description
debitAmount Decimal Amount debit
creditAmount Decimal Amount credit
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.