Create journal entries in bulk
https://api.light.inc/v1/journal-entries/batch-create
Accepts up to 1,000 journal entries with up to 100,000 lines in total. Each record uses the same fields as a single journal entry. Entries are created independently, in no particular order. A record with shouldPost set is created and posted in one step: if it can't be posted it is not created, and its item fails with the reason. When the company has a published journal entry approval workflow, the entry is submitted for approval instead. Its item completes once it is submitted, and the entry can stay APPROVAL_PENDING until it is approved. Setting shouldPost on any record requires the permission to post journal entries. Poll the batch operation until it leaves IN_PROGRESS, then read its items for each journal entry ID or error. Send the same record with its original idempotency key within 24 hours to replay a create. A replay does not change the entry: a draft sent again with shouldPost set stays a draft. A company can have up to 20,000 pending records. On HTTP 429, retry after the number of seconds in the Retry-After header.
Permissions checked: journal-entries:create (COMPANY_ADMIN, CONTROLLER) and journal-entries:post (COMPANY_ADMIN, CONTROLLER). What a call needs depends on the caller, the record and the request.
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
Request body
application/json;charset=UTF-8 · required
-
recordsarray of objectrequiredThe journal entries to create
-
idempotencyKeystringrequiredA key you choose for this record, unique within the call. On retry, send the same record and key. Light returns the original record ID if it processes the retry while the successful create is still cached (24 hours after creation).
-
recordobjectrequired-
companyEntityIdstring · uuidNote
Required. 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 -
documentNumberstringNote
Optional free-text reference of your own. Light assigns
documentSequenceIdseparately at posting. -
descriptionstringNote
Optional description for the entry.
-
currencystringNote
No default, and required to post.
-
postingDatestring · dateNote
The ledger date. Defaults to today; the accounting period covering it must be open to post.
-
valuationDatestring · dateNote
The 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 · dateNote
The date on the underlying document, informational.
-
areLinesWithTaxbooleanNote
Decides which amount each line carries:
false(default) takesnetTransactionAmountand rejects a gross amount,truetakesgrossTransactionAmountand rejects a net one. -
linesarray of objectNote
To post: at least two lines that net to zero in the entry's currency, with at least one
Dand oneC, each with aledgerAccountId.-
netTransactionAmountobjectNote
Send this when
areLinesWithTaxisfalse(the default): the amount excluding tax, unsigned, withdcSign.-
amountinteger · int64Note
Unsigned 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
-
-
grossTransactionAmountobjectNote
Send this instead when
areLinesWithTaxistrue: the amount including tax. Sending both is rejected.-
amountinteger · int64Note
Unsigned 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
-
-
taxAmountobjectNote
Optional explicit tax amount. Left out, Light derives it from the line's tax code.
-
amountinteger · int64Note
Unsigned 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
-
-
descriptionstringNote
Optional line description.
-
targetCompanyEntityIdstring · uuidNote
For an intercompany line, the entity on the other side ("To entity" in the product). Leave out on ordinary lines.
-
ledgerTaxIdstring · uuidNote
Tax code id; leave out for no tax.
-
ledgerAccountIdstring · uuidNote
The ledger account to post to. Required to post.
-
costCenterIdstring · uuidNote
Optional cost center.
-
amortizationTemplateIdstring · uuidNote
Spread the line over a release schedule: the template id, sent together with the start and end dates.
-
amortizationStartDatestring · dateNote
First date of the release schedule; required with the template.
-
amortizationEndDatestring · dateNote
Last date of the release schedule; required with the template.
-
customPropertiesarray of objectNote
Custom 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.
Note
Catalog 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.
Note
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. -
attachmentIdsarray of string · uuidIDs of attachments to assign to an ATTACHMENT property on an existing vendor. Send valueIds as an empty list. Only one active attachment belonging to the vendor can be assigned per group. Clear the current file before assigning another. Create the vendor first, request POST /v1/attachments/upload-url with its resourceId, upload the file to the returned URL, then POST /v1/attachments with documentKey set to the returned key. Use the created attachment's id here in PUT or PATCH /v1/vendors/{vendorId}. A PATCH that sends only customProperties and changes only their files works in every vendor status. customProperties replaces the whole set, so send the vendor's other properties as they are, by valueIds. A PUT, or a PATCH that changes anything else, returns 400 while the vendor is IN_REVIEW, ONBOARDING or INACTIVE. An empty list clears the assignment without archiving the file.
-
-
-
businessPartnerNamestringNote
Optional vendor or customer name to show on the entry.
-
businessPartnerIdstring · uuidNote
Optional vendor or customer id.
-
shouldPostbooleanNote
false(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 objectNote
Custom 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.
Note
Catalog 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.
Note
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. -
attachmentIdsarray of string · uuidIDs of attachments to assign to an ATTACHMENT property on an existing vendor. Send valueIds as an empty list. Only one active attachment belonging to the vendor can be assigned per group. Clear the current file before assigning another. Create the vendor first, request POST /v1/attachments/upload-url with its resourceId, upload the file to the returned URL, then POST /v1/attachments with documentKey set to the returned key. Use the created attachment's id here in PUT or PATCH /v1/vendors/{vendorId}. A PATCH that sends only customProperties and changes only their files works in every vendor status. customProperties replaces the whole set, so send the vendor's other properties as they are, by valueIds. A PUT, or a PATCH that changes anything else, returns 400 while the vendor is IN_REVIEW, ONBOARDING or INACTIVE. An empty list clears the assignment without archiving the file.
-
-
-
Response
The journal entries were accepted for creation.
-
idstring · uuidUnique identifier of the batch operation
-
companyIdstring · uuidID of the company the batch operation belongs to
-
namestringWhat the batch operation does
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
BATCH_CREATE_CREDIT_NOTESBATCH_CREATE_CUSTOMERSBATCH_CREATE_CUSTOMER_CREDITSBATCH_CREATE_INVOICE_PAYABLESBATCH_CREATE_INVOICE_RECEIVABLESBATCH_CREATE_JOURNAL_ENTRIESBATCH_UPDATE_CARD_TRANSACTIONS -
statusstringIN_PROGRESSuntil no record is pending. ThenCOMPLETED, orFAILEDwhen at least one record failedCOMPLETED- Every record was processedFAILED- No record is pending and at least one failedIN_PROGRESS- At least one record is pending
⚠️ This enum is not exhaustive; new values may be added in the future.
One of
COMPLETEDFAILEDIN_PROGRESS -
initiatedBystring · uuidID of the user or API key that started the batch operation
-
createdAtstring · date-timeWhen the batch operation was created
-
pendingItemCountinteger · int64Number of records waiting to be processed
-
completedItemCountinteger · int64Number of records that were processed
-
failedItemCountinteger · int64Number of records that failed