> ## 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 IntegrationDesignExportsDataMappingDiagram = () => {
  const [isDark, setIsDark] = useState(false);
  useEffect(() => {
    const check = () => setIsDark(document.documentElement.classList.contains("dark"));
    check();
    const observer = new MutationObserver(check);
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class"]
    });
    return () => observer.disconnect();
  }, []);
  const nodeFill = isDark ? "#212222" : "#EEF4F4";
  const nodeStroke = isDark ? "#848989" : "#212222";
  const nodeTextStyle = isDark ? ",color:#EEF4F4" : ",color:#131414";
  const linkStyle = isDark ? "" : "linkStyle default stroke:#848989,stroke-width:1px;";
  const themeVariables = {
    fontSize: "10px",
    ...isDark ? {} : {
      edgeLabelBackground: "#FAFCFC"
    }
  };
  const diagram = `
%%{init: {"themeVariables": ${JSON.stringify(themeVariables)}}}%%
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,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style B white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style C white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style D white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style E white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style F white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style G white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style H white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
${linkStyle}
`;
  return <Mermaid chart={diagram} />;
};

export const WarningCallout = ({title, children}) => <div className="callout-box callout-warning">
    <div className="callout-row">
      <span className="callout-badge">
        <svg width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z" opacity="0.2" /><path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z" /></svg>
      </span>
      <div>
        {title && <div className="callout-title">
            {title}
          </div>}
        <div className="callout-body">
          {children}
        </div>
      </div>
    </div>
  </div>;

export const NoteCallout = ({title, children}) => <div className="callout-box callout-note">
    <div className="callout-row">
      <span className="callout-icon">
        <svg width="22" height="22" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208,104a79.86,79.86,0,0,1-30.59,62.92A24.29,24.29,0,0,0,168,186v6a8,8,0,0,1-8,8H96a8,8,0,0,1-8-8v-6a24.11,24.11,0,0,0-9.3-19A79.87,79.87,0,0,1,48,104.45C47.76,61.09,82.72,25,126.07,24A80,80,0,0,1,208,104Z" opacity="0.2" /><path d="M176,232a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,232Zm40-128a87.55,87.55,0,0,1-33.64,69.21A16.24,16.24,0,0,0,176,186v6a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16v-6a16,16,0,0,0-6.23-12.66A87.59,87.59,0,0,1,40,104.49C39.74,56.83,78.26,17.14,125.88,16A88,88,0,0,1,216,104Zm-16,0a72,72,0,0,0-73.74-72c-39,.92-70.47,33.39-70.26,72.39a71.65,71.65,0,0,0,27.64,56.3A32,32,0,0,1,96,186v6h64v-6a32.15,32.15,0,0,1,12.47-25.35A71.65,71.65,0,0,0,200,104Zm-16.11-9.34a57.6,57.6,0,0,0-46.56-46.55,8,8,0,0,0-2.66,15.78c16.57,2.79,30.63,16.85,33.44,33.45A8,8,0,0,0,176,104a9,9,0,0,0,1.35-.11A8,8,0,0,0,183.89,94.66Z" /></svg>
      </span>
      <div>
        {title && <div className="callout-title">
            {title}
          </div>}
        <div className="callout-body">
          {children}
        </div>
      </div>
    </div>
  </div>;

export const RememberCallout = ({title, children}) => <div className="callout-box callout-remember">
    <div className="callout-row">
      <span className="callout-icon">
        <svg width="22" height="22" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,98.34,172.39,155.8c11.46,22.93-1.72,45.86-10.11,57a8,8,0,0,1-12,.83L42.34,105.76A8,8,0,0,1,43,93.85c29.65-23.92,57.4-10,57.4-10l57.27-57.46a8,8,0,0,1,11.31,0L229.66,87A8,8,0,0,1,229.66,98.34Z" opacity="0.2" /><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z" /></svg>
      </span>
      <div>
        {title && <div className="callout-title">
            {title}
          </div>}
        <div className="callout-body">
          {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**

<IntegrationDesignExportsDataMappingDiagram />

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)

***
