Note

Creation of Accounting Entries using the same logic as createAccountingEntryUsingCode but utilizing internal Sage Active IDs instead of business codes.

Note that to ensure business rule consistency, when the API receives a createAccountingEntryUsingIds mutation, it internally ends up calling createAccountingEntry.

HTTP Operation Type Object DTO Why-DTOs?
Mutation createAccountingEntryUsingIds AccountingEntryCreateUsingIdsGLDtoInput

Description

This mutation is based on the same logic as createAccountingEntryUsingCode, but here the business codes of journals, parties, and general accounts are replaced with their internal Sage Active Ids.

Depending on your application’s structure, it may be simpler to directly use the business values, or conversely, as demonstrated here, the internal IDs.

Using IDs provides more flexibility and accuracy in complex scenarios where unique identification is crucial, even if it requires additional steps to fetch the IDs beforehand.
The choice between using business codes and IDs depends on your specific needs and the complexity of the accounting entry being created.

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:AccountingEntryCreateUsingIdsGLDtoInput!) {    
  createAccountingEntryUsingIds (input: $values) {
    id
  }
}
graphQL Variables
{
  "values": {
    "description": "Facture FA0022",
    "date": "2023-01-01",
    "documentDate": "2022-12-16",
    "documentNumber": "FA0022",
    "journalTypeId": "4edc3c3f-6e0e-4e96-a949-63e955606aac",
    "accountingEntryLines": [
      {
        "thirdId": "901d2323-67ee-4426-aac6-e3745b8e6fd9",
        "description": "Facture FA0022 régularisation",
        "creditAmount": 0,
        "debitAmount": 158.25
        "subAccountId": "6e3533f3-621b-4c0b-bd71-435ec982c85b"
      },
      {
        "creditAmount": 150,
        "debitAmount": 0,
        "subAccountId": "6e3533f3-6221-4c0b-bd71-435ec982c85b"
      },
      {
        "creditAmount": 8.25,
        "debitAmount": 0,
        "subAccountId": "6e3533f3-621e-4c0b-bd71-435ec982c85b""
      }
    ]
  }
}

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?

createAccountingEntryUsingIds

Fields Type Description
date Datetime Date of the accounting entry
journalTypeId String Id of an existing journal
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.


createAccountingEntryUsingIds/accountingEntryLines

Fields Type Description
subAccountId String Id of a general account
thirdId String Id of a third (customer,supplier or employee)
description String Description
debitAmount Decimal Amount debit
creditAmount Decimal Amount credit
Info
  • subAccountId: Id of an existing general account, which is required on each of the entry lines.
  • thirdId: Id of an existing third-party, 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.
  • 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.