API / Reference / Journal Entries
Create journal entry
POST
https://api.light.inc/v1/journal-entries
Creates a new journal entry
This is the only way to post a journal entry through the API. There is no endpoint to post an existing draft, to add or change lines, or to read an entry back; a draft can only be archived. Create it with shouldPost: true when it must reach the ledger. If the company has a journal-entry approval workflow, shouldPost: true leaves it in APPROVAL_PENDING for approval in Light instead of POSTED. To read it back later: the header via GET /v1/accounting-documents/accounting-documents?filter=id:eq:{journalEntryId}, the posted lines via GET /v1/ledger-transaction-lines?filter=accDocId:eq:{journalEntryId}; draft lines are not readable anywhere.
Rules enforced only when posting: the lines' grossTransactionAmount in the transaction currency must net to zero (ACCOUNTING_DOCUMENT_LINES_DEBITS_AND_CREDITS_NOT_ZERO_SUM), with at least two lines and both a D and a C (ACCOUNTING_DOCUMENT_TOO_FEW_LINES, ACCOUNTING_DOCUMENT_LINES_NO_CREDIT_AND_DEBIT); every line needs ledgerAccountId and the header currency and companyEntityId; the accounting period of postingDate must be open (ACCOUNTING_PERIOD_CLOSED). areLinesWithTax decides which amount each line carries: false (the default) takes netTransactionAmount and rejects a gross amount (ACCOUNTING_DOCUMENT_LINE_GROSS_AMOUNT_SET), true the reverse. Amounts are unsigned with dcSign; a negative amount is ACCOUNTING_DOCUMENT_LINE_NEGATIVE_AMOUNT. Defaults: postingDate today, ledgerName PRIMARY; currency has no default. Send an X-Idempotency-Key: without one every retry creates another entry; with one, a different body is 409 IDEMPOTENCY_VIOLATION. How Light records money explains why the lines must balance, Document lifecycle what the statuses mean, and Periods and locks why a period can reject the posting.
Authorization
Send one of these on every request. See Authentication for how to get credentials.
- API key
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
- Bearer token
Headers
-
X-Idempotency-Keystring
Request body
application/json;charset=UTF-8
-
companyEntityIdstring · uuidRequired. The entity whose books the entry posts to.
-
ledgerNamestring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
PRIMARYELIMINATION -
documentNumberstringOptional free-text reference of your own. Light assigns
documentSequenceIdseparately at posting. -
descriptionstringOptional description for the entry.
-
currencystringNo default, and required to post.
-
postingDatestring · dateThe ledger date. Defaults to today; the accounting period covering it must be open to post.
-
valuationDatestring · dateThe date whose exchange rate converts the lines. Defaults to the posting date.
-
localCurrencyFxRateOverridenumberCustom foreign exchange rate for the ledger's local currency. If not provided, Light uses official ECB rates
-
groupCurrencyFxRateOverridenumberCustom foreign exchange rate for the ledger's group currency. If not provided, Light uses official ECB rates
-
documentDatestring · dateThe date on the underlying document, informational.
-
areLinesWithTaxbooleanDecides which amount each line carries:
false(default) takesnetTransactionAmountand rejects a gross amount,truetakesgrossTransactionAmountand rejects a net one. -
linesarray of objectTo post: at least two lines that net to zero in the entry's currency, with at least one
Dand oneC, each with aledgerAccountId.-
netTransactionAmountobjectSend this when
areLinesWithTaxisfalse(the default): the amount excluding tax, unsigned, withdcSign.-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
grossTransactionAmountobjectSend this instead when
areLinesWithTaxistrue: the amount including tax. Sending both is rejected.-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
taxAmountobjectOptional explicit tax amount. Left out, Light derives it from the line's tax code.
-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
descriptionstringOptional line description.
-
targetCompanyEntityIdstring · uuidFor an intercompany line, the entity on the other side ("To entity" in the product). Leave out on ordinary lines.
-
ledgerTaxIdstring · uuidTax code id; leave out for no tax.
-
ledgerAccountIdstring · uuidThe ledger account to post to. Required to post.
-
costCenterIdstring · uuidOptional cost center.
-
amortizationTemplateIdstring · uuidSpread the line over a release schedule: the template id, sent together with the start and end dates.
-
amortizationStartDatestring · dateFirst date of the release schedule; required with the template.
-
amortizationEndDatestring · dateLast date of the release schedule; required with the template.
-
customPropertiesarray of objectCustom property values for the line. See Custom properties on writes.
-
groupIdstring · uuidID of the custom property group.
-
valueIdsarray of string · uuidIDs of the selected custom property values. It behaves as a PUT operation, so if empty the existing ones will be effectively deleted.
Catalogue value ids for this group. Required; send
[](with an emptyinlineValues) to clear the group.SINGLE_SELECTandMULTI_SELECTgroups accept nothing else. See Custom properties on writes. -
inlineValuesarray of stringInline custom property values (used for TEXT/NUMERIC/DATE/etc. groups). It behaves as a PUT operation, so if empty or null the existing ones will be effectively deleted.
Literal values for
TEXT,NUMERIC,BOOLEANandDATEgroups, as strings (yyyy-MM-ddfor dates). Rejected on select groups withCUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.
-
-
-
businessPartnerNamestringOptional vendor or customer name to show on the entry.
-
businessPartnerIdstring · uuidOptional vendor or customer id.
-
shouldPostbooleanfalse(the default) creates a draft that the API can never post afterwards, only archive. Settrueto post now; with a journal-entry approval workflow in place the result isAPPROVAL_PENDINGinstead ofPOSTED. -
customPropertiesarray of objectCustom property values for the entry header. See Custom properties on writes.
-
groupIdstring · uuidID of the custom property group.
-
valueIdsarray of string · uuidIDs of the selected custom property values. It behaves as a PUT operation, so if empty the existing ones will be effectively deleted.
Catalogue value ids for this group. Required; send
[](with an emptyinlineValues) to clear the group.SINGLE_SELECTandMULTI_SELECTgroups accept nothing else. See Custom properties on writes. -
inlineValuesarray of stringInline custom property values (used for TEXT/NUMERIC/DATE/etc. groups). It behaves as a PUT operation, so if empty or null the existing ones will be effectively deleted.
Literal values for
TEXT,NUMERIC,BOOLEANandDATEgroups, as strings (yyyy-MM-ddfor dates). Rejected on select groups withCUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.
-
Response
-
idstring · uuidThe journal entry id, also its accounting document id.
-
companyIdstring · uuidYour company id.
-
documentNumberstringYour own free-text reference for the entry. Not the number Light assigns; that is
documentSequenceId. -
companyEntityIdstring · uuidThe entity whose books the entry posts to.
-
ledgerNamestring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
PRIMARYELIMINATION -
createdBystring · uuidThe principal that created the entry: a user or an API key.
-
updatedBystring · uuidThe principal that last changed it.
-
documentSequenceIdstringnulluntil the entry is posted. -
statusstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DRAFTAPPROVAL_PENDINGAPPROVEDPOSTEDPARTIALLY_CLEAREDCLEAREDARCHIVED -
descriptionstringThe entry's description.
-
currencystringThe currency of the line amounts.
-
postingDatestring · dateThe ledger date; the accounting period covering it must be open to post.
-
documentDatestring · dateThe date on the underlying document, informational.
-
valuationDatestring · dateThe date whose exchange rate converted the lines to local and group currency; resolved at posting when not set.
-
localCurrencyFxRatenumberCustom foreign exchange rate for the ledger's local currency. If not provided, Light uses official ECB rates
Echoes the override you sent;
nullwhen Light applied its own rate, not the rate that was applied. -
groupCurrencyFxRatenumberCustom foreign exchange rate for the ledger's group currency. If not provided, Light uses official ECB rates
Echoes the override you sent;
nullwhen Light applied its own rate, not the rate that was applied. -
areLinesWithTaxbooleanWhether line amounts were entered gross of tax (
true) or net (false, the default). -
failureContextobjectFailure context when vendor onboarding fails.
The error of the last failed posting attempt, typically from the approval workflow; cleared on the next successful post. The description about vendor onboarding is a copy-paste from another model.
-
namestringThe error name
-
typestringThe error type
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
BAD_REQUESTUNAUTHORIZEDFORBIDDENNOT_FOUNDCONFLICTUNPROCESSABLE_CONTENT -
errorsarray of objectList of errors providing details about what went wrong
-
typestringA string code identifying the error type
-
messagestringA human-readable message providing more details about the error
-
patharray of stringOptional path of the error when the error is for a specific field. Used mostly on BAD_REQUEST errors, that path will match the field name on the request object
-
contextobjectOptional context providing additional information about the error. This can include any relevant data that might help in understanding or resolving the error
-
-
-
linesarray of objectThe lines as entered. The ledger lines Light derived (tax, rounding) are not here; read them from ledger transaction lines.
-
idstring · uuidThe line id.
-
journalEntryIdstring · uuidThe entry the line belongs to.
-
netTransactionAmountobjectThe line amount excluding tax, unsigned with
dcSign, in the entry's currency.-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
grossTransactionAmountobjectThe line amount including tax.
-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
taxTransactionAmountobjectThe tax portion;
nullwithout a tax code.-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
descriptionstringThe line description.
-
targetCompanyEntityIdstring · uuidFor an intercompany line, the entity on the other side ("To entity" in the product).
nullon ordinary lines. -
ledgerTaxIdstring · uuidTax code id. Other documents call the same id
taxCodeId. -
ledgerAccountIdstring · uuidThe ledger account the line posts to.
-
costCenterIdstring · uuidCost center on the line;
nullwhen none. -
customPropertiesarray of objectCustom property values on the line.
-
groupIdstring · uuidID of the custom property group
-
groupInternalNamestringInternal name of the custom property group
-
valuesarray of objectList of values. Note that this will be a single value unless the group input type supports multiple values
-
idstring · uuidUnique identifier for the object
-
groupIdstring · uuidID of the custom property group
-
groupInternalNamestringInternal name of the custom property group
-
companyIdstring · uuidID of the company
-
internalNamestringInternal name of the custom property value
-
labelstringLabel of the custom property value
-
contextstringContext/description of the custom property value
-
createdAtstring · date-timeTimestamp when the custom property value was created
-
updatedAtstring · date-timeTimestamp when the custom property value was last updated
-
-
-
createdAtstring · date-timeWhen the line was created.
-
updatedAtstring · date-timeWhen it was last changed.
-
amortizationTemplateIdstring · uuidRelease template id when the line is spread over a schedule instead of hitting the account at once;
nullotherwise. -
amortizationStartDatestring · dateFirst date of that schedule.
-
amortizationEndDatestring · dateLast date of that schedule.
-
-
customPropertiesarray of objectCustom property values on the entry header.
-
groupIdstring · uuidID of the custom property group
-
groupInternalNamestringInternal name of the custom property group
-
valuesarray of objectList of values. Note that this will be a single value unless the group input type supports multiple values
-
idstring · uuidUnique identifier for the object
-
groupIdstring · uuidID of the custom property group
-
groupInternalNamestringInternal name of the custom property group
-
companyIdstring · uuidID of the company
-
internalNamestringInternal name of the custom property value
-
labelstringLabel of the custom property value
-
contextstringContext/description of the custom property value
-
createdAtstring · date-timeTimestamp when the custom property value was created
-
updatedAtstring · date-timeTimestamp when the custom property value was last updated
-
-
-
businessPartnerNamestringOptional vendor or customer shown on the entry.
-
businessPartnerIdstring · uuidId of that vendor or customer.
-
createdAtstring · date-timeWhen the entry was created.
-
updatedAtstring · date-timeWhen it was last changed.
-
totalNetTransactionAmountobjectSum of the lines' net amounts as one directed figure. Read the magnitude as the entry's size; its
dcSigncarries no accounting meaning on a balanced entry.-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
totalTaxTransactionAmountobjectSum of the lines' tax amounts, read like the net total.
-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
totalGrossTransactionAmountobjectSum of the lines' gross amounts, read like the net total.
-
amountinteger · int64Unsigned integer in minor units. The direction is in
dcSign; a negative value is rejected. -
dcSignstring⚠️ This enum is not exhaustive; new values may be added in the future.
One of
DC
-
-
multiJournalEntryIdstring · uuidSet when this entry is one entity's part of a multi-entity journal entry made in the product; entries sharing the id were entered together.
nullfor entries created through the API.