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

# Data Mapping

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 NoteCallout = ({title, children, icon = "💡"}) => <div style={{
  backgroundColor: 'var(--recommended-bg)',
  borderLeft: '4px solid #3beaf6',
  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>;

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>;

Data Mapping defines how Export Item data must be translated into Accounting System (AS) journal or invoice fields.

Mappings are applied **after**:

* Export Items are fetched
* Pre-validation has passed
* Accounts Mapping has been resolved

## Implementation

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

* [How to Apply Data Mapping](/docs/current/how-tos/accounting-integrations/how-to-apply-data-mapping-for-as-erp-processing)

## Mapping Order (Implementation Flow)

Integrations should apply mappings in the following order:

1. **Mandatory datapoints** (always required)
2. **Invoice datapoints** (invoice-related items only)
3. **Optional datapoints** (system-dependent)
4. **Apply VAT handling rules**

```mermaid theme={null}
%%{init: {"themeVariables": {"fontSize": "10px"}}}%%
flowchart TD
    A[Fetch Export Items] --> B[Map Mandatory Datapoints]
    B --> C{Invoice type?}
    C -->|Yes| D[Map Invoice Datapoints]
    C -->|No| E[Skip]
    D --> F[Apply Optional Datapoints]
    E --> F
    F --> G[Apply VAT Handling Rules]
    G --> H[Post to Accounting System]

    style A white-space:normal
    style B white-space:normal
    style C white-space:normal
    style D white-space:normal
    style E white-space:normal
    style F white-space:normal
    style G white-space:normal

```

Mapped datapoints are then used to construct journal entries or invoices in the Accounting System according to the selected bookkeeping method.

## Mandatory Datapoints

<WarningCallout title="Mandatory Datapoints">
  These datapoints must be recorded for **all exported expenses**, regardless of bookkeeping method.
</WarningCallout>

<NoteCallout title="Vendor vs Supplier">
  * `vendor` is the canonical field used for Accounts Payable bookkeeping and vendor matching.
  * `supplier` is a legacy field (e.g. `supplier.code`) retained for backwards compatibility.
  * `supplier.name` may still be used as a descriptive merchant name but should not be relied on for accounting logic.
</NoteCallout>

Mandatory datapoints represent the minimum information required for reconciliation and accounting accuracy.

### Required Data

* Expense GL Account (Category)
* Expense amount (wallet currency, derived from line amounts)
* Accounting Dimensions (Tags)
* Tax Code
* Expense Date
* Reconciliation ID
* Reconciled Entries (reimbursements)
* Consolidated Description
* Vendor (Accounts Payable only)
* Attendees Information

## Mandatory Datapoint Mapping (Pleo → AS)

<RememberCallout title="Identifier and Attendee Fields">
  These fields are often mapped to shared reference or memo fields in the Accounting System.

  To avoid losing existing accounting data, consider whether to:

  * append rather than overwrite existing values
  * map to dedicated/custom fields where available
</RememberCallout>

### Entry-Level Mapping

| Accounting Concept | Pleo API Field                                           | Notes                                                                          |
| ------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Expense Date       | data\[].date                                             | Transaction date                                                               |
| Reconciliation ID  | data\[].additionalInformation.reconciliationId           | Map to external reference or description field (≥50 chars)                     |
| Reconciled Entries | data\[].additionalInformation.reconciledEntries          | Used for reimbursement linking; map to reference/description field (≥50 chars) |
| Attendees          | data\[].additionalInformation.attendees                  | Map to description/comment field (≥100 chars)                                  |
| Description / Note | data\[].supplier.name + data\[].user.name + data\[].note | Concatenated description (use initials if length constrained)                  |

### Accounts Payable Only (Entry-Level)

| Accounting Concept | Pleo API Field      | Notes                           |
| ------------------ | ------------------- | ------------------------------- |
| Vendor Name        | data\[].vendor.name | Required for `accounts_payable` |
| Vendor Code        | data\[].vendor.code | Used for vendor matching in AS  |

### Line-Level Mapping

| Accounting Concept                | Pleo API Field                                                       | Notes                                                  |
| --------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------ |
| Expense GL Account                | data\[].accountingEntryLines\[].account.code                         | Expense/category account                               |
| Expense Amount (Wallet, per line) | data\[].accountingEntryLines\[].lineAmount.inWalletCurrency.value    | Sum lines if AS requires total                         |
| Currency Code                     | data\[].accountingEntryLines\[].lineAmount.inWalletCurrency.currency |                                                        |
| Dimension                         | data\[].accountingEntryLines\[].tags.groupCode                       | e.g. Project, Cost Center                              |
| Dimension Value                   | data\[].accountingEntryLines\[].tags.code                            |                                                        |
| Tax Code                          | data\[].accountingEntryLines\[].tax.code                             |                                                        |
| Tax Rate                          | data\[].accountingEntryLines\[].tax.rate                             | Only if required (usually derived from Tax Code in AS) |

## Invoice Datapoint Mapping

<RememberCallout title="Remember">
  Apply only when `data[].type = invoice` or `invoice_payment`.
</RememberCallout>

Invoice datapoints extend mandatory mappings with supplier invoice information.

### Rules

* `invoice` → use Supplier currency
* `invoice_payment` → use Wallet currency
* Provide exchange rate if required by the Accounting System

| Accounting Concept | Pleo API Field                                                         | Notes                         |
| ------------------ | ---------------------------------------------------------------------- | ----------------------------- |
| Invoice Due Date   | data\[].additionalInformation.invoiceInformation.dueDate               | Dedicated due date field      |
| Invoice Date       | data\[].additionalInformation.invoiceInformation.invoiceDate           |                               |
| Invoice Number     | data\[].additionalInformation.invoiceInformation.invoiceNumber         |                               |
| Payment Date       | data\[].additionalInformation.invoiceInformation.paymentDate           | For payment entries           |
| Supplier Amount    | data\[].accountingEntryLines\[].lineAmount.inSupplierCurrency.value    | Line-level                    |
| Supplier Currency  | data\[].accountingEntryLines\[].lineAmount.inSupplierCurrency.currency | Use AS foreign currency field |

## Optional Datapoints

Optional datapoints improve reporting but must never replace mandatory data.

<WarningCallout title="Optional Datapoints">
  Optional mappings must not overwrite mandatory fields.
</WarningCallout>

### Examples

* Internal document number
* Net and tax amounts
* Team dimensions
* Export job date

## Optional Datapoint Mapping

| Accounting Concept       | Pleo API Field                                                       | Notes                                                       |
| ------------------------ | -------------------------------------------------------------------- | ----------------------------------------------------------- |
| Net Amount               | data\[].accountingEntryLines\[].netAmount.inWalletCurrency.value     | Only if AS requires net values for tax calculation          |
| Net Currency             | data\[].accountingEntryLines\[].netAmount.inWalletCurrency.currency  |                                                             |
| Tax Amount               | data\[].accountingEntryLines\[].tax.amount.inWalletCurrency.value    | Only if AS cannot calculate VAT                             |
| Tax Currency             | data\[].accountingEntryLines\[].tax.amount.inWalletCurrency.currency |                                                             |
| Team (Dimension)         | data\[].team.code                                                    | Map to configured dimension value                           |
| Internal Document Number | (AS generated)                                                       | Do not overwrite; allow AS to assign                        |
| Export Date              | (integration-defined)                                                | Use instead of expense date when posting aggregated entries |

## VAT Handling

VAT handling depends on Accounting System capabilities.

### Default Behaviour

The Accounting System calculates VAT using:

* line amounts
* tax codes

### When to Send VAT Amounts

Only send VAT values if the Accounting System:

* cannot calculate tax automatically, or

* requires explicit VAT posting

* If AS calculates VAT → **do NOT** send VAT amount

* If AS cannot calculate VAT → **send VAT from Pleo**

## Upstream Dependencies

* Export Job has been started (status = in\_progress)
* Fetch Export Item Data (data layer)
* Bookkeeping method resolved
* Accounts Mapping – determines which GL accounts are debited and credited

## Downstream Dependencies

* 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?

* [Attachment Handling](/docs/current/integration-design/exports/integration-design-exports-attachment-handling)

***

## Related Reading

* [How to Apply Data Mapping](/docs/current/how-tos/accounting-integrations/how-to-apply-data-mapping-for-as-erp-processing)
* [Export Integration Workflow Guide](/docs/current/guides/export-integration-workflow-guide)
* [AS/ERP Processing Workflow Guide](/docs/current/guides/accounting-system-processing-workflow-guide)

***
