Light APIv1.0.0

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-Key string

Request body

application/json;charset=UTF-8

  • companyEntityId string · uuid

    Required. The entity whose books the entry posts to.

  • ledgerName string

    ⚠️ This enum is not exhaustive; new values may be added in the future.

    One of PRIMARY ELIMINATION

  • documentNumber string

    Optional free-text reference of your own. Light assigns documentSequenceId separately at posting.

  • description string

    Optional description for the entry.

  • currency string

    No default, and required to post.

  • postingDate string · date

    The ledger date. Defaults to today; the accounting period covering it must be open to post.

  • valuationDate string · date

    The date whose exchange rate converts the lines. Defaults to the posting date.

  • localCurrencyFxRateOverride number

    Custom foreign exchange rate for the ledger's local currency. If not provided, Light uses official ECB rates

  • groupCurrencyFxRateOverride number

    Custom foreign exchange rate for the ledger's group currency. If not provided, Light uses official ECB rates

  • documentDate string · date

    The date on the underlying document, informational.

  • areLinesWithTax boolean

    Decides which amount each line carries: false (default) takes netTransactionAmount and rejects a gross amount, true takes grossTransactionAmount and rejects a net one.

  • lines array of object

    To post: at least two lines that net to zero in the entry's currency, with at least one D and one C, each with a ledgerAccountId.

    • netTransactionAmount object

      Send this when areLinesWithTax is false (the default): the amount excluding tax, unsigned, with dcSign.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • grossTransactionAmount object

      Send this instead when areLinesWithTax is true: the amount including tax. Sending both is rejected.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • taxAmount object

      Optional explicit tax amount. Left out, Light derives it from the line's tax code.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • description string

      Optional line description.

    • targetCompanyEntityId string · uuid

      For an intercompany line, the entity on the other side ("To entity" in the product). Leave out on ordinary lines.

    • ledgerTaxId string · uuid

      Tax code id; leave out for no tax.

    • ledgerAccountId string · uuid

      The ledger account to post to. Required to post.

    • costCenterId string · uuid

      Optional cost center.

    • amortizationTemplateId string · uuid

      Spread the line over a release schedule: the template id, sent together with the start and end dates.

    • amortizationStartDate string · date

      First date of the release schedule; required with the template.

    • amortizationEndDate string · date

      Last date of the release schedule; required with the template.

    • customProperties array of object

      Custom property values for the line. See Custom properties on writes.

      • groupId string · uuid

        ID of the custom property group.

      • valueIds array of string · uuid

        IDs 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 empty inlineValues) to clear the group. SINGLE_SELECT and MULTI_SELECT groups accept nothing else. See Custom properties on writes.

      • inlineValues array of string

        Inline 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, BOOLEAN and DATE groups, as strings (yyyy-MM-dd for dates). Rejected on select groups with CUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.

  • businessPartnerName string

    Optional vendor or customer name to show on the entry.

  • businessPartnerId string · uuid

    Optional vendor or customer id.

  • shouldPost boolean

    false (the default) creates a draft that the API can never post afterwards, only archive. Set true to post now; with a journal-entry approval workflow in place the result is APPROVAL_PENDING instead of POSTED.

  • customProperties array of object

    Custom property values for the entry header. See Custom properties on writes.

    • groupId string · uuid

      ID of the custom property group.

    • valueIds array of string · uuid

      IDs 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 empty inlineValues) to clear the group. SINGLE_SELECT and MULTI_SELECT groups accept nothing else. See Custom properties on writes.

    • inlineValues array of string

      Inline 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, BOOLEAN and DATE groups, as strings (yyyy-MM-dd for dates). Rejected on select groups with CUSTOM_PROPERTY_VALUE_TYPE_MISMATCH. See Custom properties on writes.

Response

  • id string · uuid

    The journal entry id, also its accounting document id.

  • companyId string · uuid

    Your company id.

  • documentNumber string

    Your own free-text reference for the entry. Not the number Light assigns; that is documentSequenceId.

  • companyEntityId string · uuid

    The entity whose books the entry posts to.

  • ledgerName string

    ⚠️ This enum is not exhaustive; new values may be added in the future.

    One of PRIMARY ELIMINATION

  • createdBy string · uuid

    The principal that created the entry: a user or an API key.

  • updatedBy string · uuid

    The principal that last changed it.

  • documentSequenceId string

    null until the entry is posted.

  • status string

    ⚠️ This enum is not exhaustive; new values may be added in the future.

    One of DRAFT APPROVAL_PENDING APPROVED POSTED PARTIALLY_CLEARED CLEARED ARCHIVED

  • description string

    The entry's description.

  • currency string

    The currency of the line amounts.

  • postingDate string · date

    The ledger date; the accounting period covering it must be open to post.

  • documentDate string · date

    The date on the underlying document, informational.

  • valuationDate string · date

    The date whose exchange rate converted the lines to local and group currency; resolved at posting when not set.

  • localCurrencyFxRate number

    Custom foreign exchange rate for the ledger's local currency. If not provided, Light uses official ECB rates

    Echoes the override you sent; null when Light applied its own rate, not the rate that was applied.

  • groupCurrencyFxRate number

    Custom foreign exchange rate for the ledger's group currency. If not provided, Light uses official ECB rates

    Echoes the override you sent; null when Light applied its own rate, not the rate that was applied.

  • areLinesWithTax boolean

    Whether line amounts were entered gross of tax (true) or net (false, the default).

  • failureContext object

    Failure 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.

    • name string

      The error name

    • type string

      The error type

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of BAD_REQUEST UNAUTHORIZED FORBIDDEN NOT_FOUND CONFLICT UNPROCESSABLE_CONTENT

    • errors array of object

      List of errors providing details about what went wrong

      • type string

        A string code identifying the error type

      • message string

        A human-readable message providing more details about the error

      • path array of string

        Optional 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

      • context object

        Optional context providing additional information about the error. This can include any relevant data that might help in understanding or resolving the error

  • lines array of object

    The lines as entered. The ledger lines Light derived (tax, rounding) are not here; read them from ledger transaction lines.

    • id string · uuid

      The line id.

    • journalEntryId string · uuid

      The entry the line belongs to.

    • netTransactionAmount object

      The line amount excluding tax, unsigned with dcSign, in the entry's currency.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • grossTransactionAmount object

      The line amount including tax.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • taxTransactionAmount object

      The tax portion; null without a tax code.

      • amount integer · int64

        Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

      • dcSign string

        ⚠️ This enum is not exhaustive; new values may be added in the future.

        One of D C

    • description string

      The line description.

    • targetCompanyEntityId string · uuid

      For an intercompany line, the entity on the other side ("To entity" in the product). null on ordinary lines.

    • ledgerTaxId string · uuid

      Tax code id. Other documents call the same id taxCodeId.

    • ledgerAccountId string · uuid

      The ledger account the line posts to.

    • costCenterId string · uuid

      Cost center on the line; null when none.

    • customProperties array of object

      Custom property values on the line.

      • groupId string · uuid

        ID of the custom property group

      • groupInternalName string

        Internal name of the custom property group

      • values array of object

        List of values. Note that this will be a single value unless the group input type supports multiple values

        • id string · uuid

          Unique identifier for the object

        • groupId string · uuid

          ID of the custom property group

        • groupInternalName string

          Internal name of the custom property group

        • companyId string · uuid

          ID of the company

        • internalName string

          Internal name of the custom property value

        • label string

          Label of the custom property value

        • context string

          Context/description of the custom property value

        • createdAt string · date-time

          Timestamp when the custom property value was created

        • updatedAt string · date-time

          Timestamp when the custom property value was last updated

    • createdAt string · date-time

      When the line was created.

    • updatedAt string · date-time

      When it was last changed.

    • amortizationTemplateId string · uuid

      Release template id when the line is spread over a schedule instead of hitting the account at once; null otherwise.

    • amortizationStartDate string · date

      First date of that schedule.

    • amortizationEndDate string · date

      Last date of that schedule.

  • customProperties array of object

    Custom property values on the entry header.

    • groupId string · uuid

      ID of the custom property group

    • groupInternalName string

      Internal name of the custom property group

    • values array of object

      List of values. Note that this will be a single value unless the group input type supports multiple values

      • id string · uuid

        Unique identifier for the object

      • groupId string · uuid

        ID of the custom property group

      • groupInternalName string

        Internal name of the custom property group

      • companyId string · uuid

        ID of the company

      • internalName string

        Internal name of the custom property value

      • label string

        Label of the custom property value

      • context string

        Context/description of the custom property value

      • createdAt string · date-time

        Timestamp when the custom property value was created

      • updatedAt string · date-time

        Timestamp when the custom property value was last updated

  • businessPartnerName string

    Optional vendor or customer shown on the entry.

  • businessPartnerId string · uuid

    Id of that vendor or customer.

  • createdAt string · date-time

    When the entry was created.

  • updatedAt string · date-time

    When it was last changed.

  • totalNetTransactionAmount object

    Sum of the lines' net amounts as one directed figure. Read the magnitude as the entry's size; its dcSign carries no accounting meaning on a balanced entry.

    • amount integer · int64

      Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

    • dcSign string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of D C

  • totalTaxTransactionAmount object

    Sum of the lines' tax amounts, read like the net total.

    • amount integer · int64

      Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

    • dcSign string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of D C

  • totalGrossTransactionAmount object

    Sum of the lines' gross amounts, read like the net total.

    • amount integer · int64

      Unsigned integer in minor units. The direction is in dcSign; a negative value is rejected.

    • dcSign string

      ⚠️ This enum is not exhaustive; new values may be added in the future.

      One of D C

  • multiJournalEntryId string · uuid

    Set 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. null for entries created through the API.