> ## Documentation Index
> Fetch the complete documentation index at: https://developers.pleo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Journal Entry Handling

export const WarningCallout = ({title, children, icon = "⚠️"}) => <div style={{
  backgroundColor: 'var(--recommended-bg)',
  borderLeft: '4px solid hsl(34, 91%, 60%)',
  borderRadius: '10px',
  padding: '18px 22px',
  marginBottom: '20px',
  boxShadow: '1px 1px 3px hsl(34, 91%, 60%)'
}}>
    <div style={{
  display: 'flex',
  alignItems: 'flex-start',
  gap: '14px'
}}>
      <span style={{
  fontSize: '22px',
  lineHeight: '1',
  flexShrink: 0
}}>
        {icon}
      </span>
      <div>
        {title && <div style={{
  fontSize: '16px',
  fontWeight: 600,
  color: 'var(--recommended-title)',
  marginBottom: '6px'
}}>
            {title}
          </div>}
        <div style={{
  fontSize: '14px',
  lineHeight: 1.65
}}>
          {children}
        </div>
      </div>
    </div>
  </div>;

export const RememberCallout = ({title, children, icon = "🪢"}) => <div style={{
  backgroundColor: 'var(--recommended-bg)',
  borderLeft: '4px solid #f63b92',
  borderRadius: '10px',
  padding: '18px 22px',
  marginBottom: '20px',
  boxShadow: '1px 1px 3px rgba(0,0,0,0.06)'
}}>
    <div style={{
  display: 'flex',
  alignItems: 'flex-start',
  gap: '14px'
}}>
      <span style={{
  fontSize: '22px',
  lineHeight: '1',
  flexShrink: 0
}}>
        {icon}
      </span>
      <div>
        {title && <div style={{
  fontSize: '16px',
  fontWeight: 600,
  color: 'var(--recommended-title)',
  marginBottom: '6px'
}}>
            {title}
          </div>}
        <div style={{
  fontSize: '14px',
  lineHeight: 1.65
}}>
          {children}
        </div>
      </div>
    </div>
  </div>;

For Export Items where the resolved bookkeeping method is `journal`, the integration must record the expense as **journal entries** in the Accounting System.

This page defines how journal entries must be constructed during export processing, including how debit and credit lines are derived from the Export Item payload.

Journal entry creation operates after bookkeeping method resolution (see [Determine Bookkeeping Method](/docs/current/integration-design/exports/integration-design-exports-bookkeeping-method-resolution)) and applies Accounts Mapping, Data Mapping, and Posting Behaviour rules described elsewhere in this documentation set.

## Implementation

See the corresponding how-to article for API usage and step-by-step instructions:

* [How to Determine the Bookkeeping Method](/docs/current/how-tos/accounting-integrations/how-to-determine-the-bookkeeping-method-for-as-erp-processing)

## Journal Entry Construction Modes

An integration may need to construct journal entries in one of three modes depending on configuration and accounting system constraints:

1. **Single journal entry per Export Item (default)**
2. **Split line journal entry**
3. **Single journal entry per Export Job (optional aggregation)**

The integration determines which mode applies at runtime.

<Accordion title="Example Export Item Payload (Journal Entry)">
  ```json theme={null}
    {
        "companyId": "12abc3d4-e567-890e-1234-abc56e78fabc",
        "accountingEntryId": "59540ed2-0d68-4e36-9e31-58223975d9e9",
        "type": "card_purchase",
        "subType": null,
        "date": "2025-12-10T15:46:34Z",
        "amount": {
          "inSupplierCurrency": {
            "currency": "GBP",
            "value": 6366
          },
          "inWalletCurrency": {
            "currency": "GBP",
            "value": 6366
          }
        },
        "note": "Printer ink",
        "files": [
          {
            "url": "<string>",
            "type": "image/jpeg",
            "size": 13010
          }
        ],
        "supplier": {
          "code": "1340472473",
          "name": "Target",
          "categoryCode": "1000",
          "country": "GB",
          "account": null,
          "taxIdentifier": null
        },
        "user": {
          "id": "6b71f6bd-e83d-4d49-88ee-2b8cda2d57cf",
          "name": "Luke Richardson",
          "code": null
        },
        "team": {
          "id": "747aaf60-56c6-4b46-ad92-f8a0cb59cf8b",
          "code": "5678",
          "name": "Engineering"
        },
        "accountingEntryLines": [
          {
            "accountingEntryLineId": "0c76ea71-aaaa-4ece-bb68-e1166ccaea04",
            "lineAmount": {
              "inSupplierCurrency": {
                "currency": "GBP",
                "value": 6366
              },
              "inWalletCurrency": {
                "currency": "GBP",
                "value": 6366
              }
            },
            "netAmount": {
              "inSupplierCurrency": {
                "currency": "GBP",
                "value": 6366
              },
              "inWalletCurrency": {
                "currency": "GBP",
                "value": 6366
              }
            },
            "account": {
              "id": "7966c3ba-e4de-4574-8604-6cfa48d62cc8",
              "code": "6990000",
              "name": "Printing & Stationary",
              "identifier": "6990000"
            },
            "tax": {
              "id": "997d8526-5872-484d-ba07-c7a07e08e555",
              "code": "0001",
              "type": "inclusive",
              "amount": {
                "inSupplierCurrency": {
                  "currency": "GBP",
                  "value": 0
                },
                "inWalletCurrency": {
                  "currency": "GBP",
                  "value": 0
                }
              },
              "rate": 0.00
            },
            "tags": []
          }
        ],
        "additionalInformation": {
          "reconciliationId": "2500001",
          "reconciledEntries": null,
          "attendees": [],
          "invoiceInformation": null
        },
        "bookkeeping": {
          "method": "journal"
        },
        "vendor": {
          "id": "22e1f2c9-1360-4291-ab41-6b23dcea8888",
          "name": "TestVendor",
          "code": "acc1234",
          "externalId": "ext12345",
          "registrationNumber": "reg001234",
          "taxRegistrationNumber": "taxreg1234",
          "country": "UK",
          "defaultCurrency": "GBP"
        },
        "contraAccount": {
          "id": "993d664c-9b7c-4efc-a677-510e69200857",
          "code": "0876000",
          "name": "0876000_ChartAccounts",
          "identifier": "0876000"
        },
        "_links": {
          "web": {
            "exportItem": "https://app.staging.pleo.io/export/export-item/0c76ea71-aaaa-4ece-bb68-e1166ccaea04"
          }
        },
        "servicePeriod": null
      },
     # [other Export Items omitted for brevity]
     # [Pagination omitted for brevity]
  ```
</Accordion>

## 1. Single Journal Entry per Export Item (Default)

### Detection

If `accountingEntryLines` contains a single entry, the Export Item must be recorded as a single journal entry.

### Rule

The integration must create one journal entry representing the full expense.

For each journal entry:

* The full expense amount must be represented
* Debit, credit, and tax data must be recorded according to the Accounting System’s structure
* Attachments (e.g., receipts) should be linked if supported

Some Accounting Systems allow debit, credit, and tax within a single line, while others internally split postings. The integration should follow the Accounting System’s required structure.

## 2. Split Line Handling

### Detection

If `accountingEntryLines` contains more than one entry, the Export Item must be treated as a split line entry.

### Rule

Each entry in `accountingEntryLines` represents a debit posting.

The API provides individual split amounts, each with its own account and tax code.

<RememberCallout title="Remember">
  The payload does **not** contain a credit line.
</RememberCallout>

The integration is responsible for:

1. Creating one debit posting per `accountingEntryLines` entry
2. Calculating the credit total as the sum of all `lineAmount.inWalletCurrency.value` values across the lines

The calculated total must match the top-level amount: `amount.inWalletCurrency.value`

### Example

Create the following in the Accounting System if two split lines exist:

* Line 1 (API): £120 → create 1 debit line
* Line 2 (API): £80 → create 1 debit line
* Line 3 (integration calculated or top-level amount): £200 → create 1 credit line

## 3. One Journal Entry per Export Job (Optional)

An integration may optionally support aggregating multiple Export Items into a single journal entry per Export Job.

Aggregation changes *when* journal entries are created, not how debit and credit lines are constructed.

### Detection

This behaviour is decided entirely by the integration implementation (your code) and is **not** a configuration setting in Pleo or dynamically signalled by the Export Job payload.

<WarningCallout title="Integration Configuration">
  Only implement this if the target Accounting System explicitly supports it and the integration is configured accordingly. This is typically used for high-volume Export Jobs.
</WarningCallout>

### Rule

When aggregation is enabled, the integration:

1. Fetches all Export Items for the job
2. Identifies items where `bookkeeping.method` is `journal` (or `none`)
3. Creates a single journal entry instead of one per Export Item
4. Sets the journal entry date to the Export Job date (`createdAt` on the Export Job)

Split line rules still apply across aggregated items:

* Each item's debit lines are represented individually
* A single credit line represents the total amount across all aggregated items

### Example

Create the following in the Accounting System if three Export Items exist:

* Line 1: £100 (no splits) → 1 debit line
* Lines 2 & 3: £200 (2 splits) → 2 debit lines (£120 and £80)
* Line 4: £50 (no splits) → 1 debit line
* Line 5: £350 → 1 credit line

The resulting journal entry contains four debit lines and one credit line for £350.

## Upstream Dependencies

* Export Job has been started (status = in\_progress)
* Fetch Export Item Data (data layer)
* Bookkeeping method resolved

## Downstream Dependencies

Journal entries rely on several platform concepts to be **complete and reconcilable**:

* **Accounts Mapping** – determines which GL accounts are debited and credited
* **Data Mapping** – ensures amounts, dates, dimensions, identifiers, and VAT/tax information are recorded correctly
* **Attachment Handling** – links receipts and supporting documentation
* **Accounting Periods** – assigns entries to the correct accounting period
* **Posting Behaviour** – determines whether entries are created as drafts or finalised
* **Export Item status update** – updates outcome of Export Item (`successful` or `failed`)
* **Export Job status update** – updates outcome of Export Job (`completed`, `completed_with_errors` or `failed`)

***

## What Comes Next?

* [Accounts Mapping](/docs/current/integration-design/exports/integration-design-exports-accounts-mapping)

***

## Related Reading

* [How to Determine the Bookkeeping Method](/docs/current/how-tos/accounting-integrations/how-to-determine-the-bookkeeping-method-for-as-erp-processing)
* [Accounts Payable Handling](/docs/current/integration-design/exports/integration-design-exports-bookkeeping-method-accounts-payable)
* [Export Integration Workflow Guide](/docs/current/guides/export-integration-workflow-guide)
* [AS/ERP Processing Workflow Guide](/docs/current/guides/accounting-system-processing-workflow-guide)

***
