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

# Export Lifecycle

The **Export Lifecycle** describes how Pleo moves expenses and related attachments from the platform into an Accounting System, respecting user bookkeeping configuration, accounting periods, and posting preferences.

Understanding this lifecycle helps developers conceptualise **what Pleo expects, how data is structured, and the order of operations** before implementation.

**This lifecycle ensures exported expenses are accurate, reconcilable, and compliant with company bookkeeping standards.**

## High-Level Process

```mermaid theme={null}

flowchart TD
    A[Export Job Created in Pleo] --> B[Integration detects pending Export Job]
    B --> C[Mark Export Job as Started]
    C --> D[Pre-Export Validation: AS available?]
    D -->|No| E[Fail Export Job with failureReason]
    D -->|Yes| F[Fetch Export Items from Job]

    subgraph ItemLoop [For each Export Item]
      F --> G[Validate Item: required config & data?]
        G -->|No| H[Mark Item as Failed with failureReason]
        G -->|Yes| I[Accounts & Data Mapping]
        I --> J[Attachment Handling]
        J --> K[Assign Accounting Period]
        K --> L[Apply Posting Behaviour #40;Draft / Finalised#41;]
        L --> M[Update Export Item Status #40;Success/Failure#41;]
    end

    M --> N{More Export Items?}
    N -->|Yes| G
    N -->|No| O[Update Export Job Status: Completed / Completed with Errors / Failed]

    %% Styling for wrapping
    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
    style H white-space:normal
    style I white-space:normal
    style J white-space:normal
    style K white-space:normal
    style L white-space:normal
    style M white-space:normal
    style N white-space:normal
    style O white-space:normal

    %% Make subgraph transparent with black border
    style ItemLoop fill:none,stroke:#000000
  
   
```

## High-Level Steps

### 1. Export Job Creation

* Expenses that are ready for export are grouped into an Export Job.
* Export Jobs are queued in Pleo for processing by an integration.
* Only approved and accounting-ready expenses are included.

See: [How to Queue Export Items in Pleo's Web App](/docs/current/how-tos/accounting-integrations/how-to-queue-export-items-in-ui)

### 2. Export Job Detection

* Integrations detect pending Export Jobs using **webhooks** (preferred) or **scheduled polling**.
* Jobs are processed sequentially (oldest first) to maintain consistency.
* An Export Job is marked as **started** when processing begins.

See: [How to Detect and Start Export Jobs for Processing](/docs/current/how-tos/accounting-integrations/how-to-detect-and-start-export-jobs-for-as-erp-processing)

### 3. Pre-Export Validation

* The integration ensures the Accounting System is available and ready to accept entries.
* If unavailable, the Export Job is **failed** with actionable error information.

See: [How to Perform Pre-Export Validation](/docs/current/how-tos/accounting-integrations/how-to-perform-pre-export-validation-for-as-erp-processing)

### 4. Export Item Processing

* Individual **Export Items** (expenses) are fetched from the Export Job.
* Each item is validated for required configuration and data.
* Valid items proceed through the **per-item processing block**.
* **Individual item failures do not fail the entire job; each item is tracked separately to allow partial job success.**

See:

* [How to Retrieve Export Job Items for Processing](/docs/current/how-tos/accounting-integrations/how-to-retrieve-export-job-items-for-as-erp-processing)
* [How to Fetch Export Item Data for Processing](/docs/current/how-tos/accounting-integrations/how-to-fetch-export-item-data-for-as-erp-processing)

## Per-Item Processing

Each Export Item goes through the following steps:

### 5. Bookkeeping Method

* Expenses are recorded using one of two methods:
  * **Journal Entries**: simple double-entry transactions
  * **Accounts Payable**: invoice and payment tracking for vendors
* Certain transaction types (wallet loads, balance amendments) are always journal entries.

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

### 6. Accounts & Data Mapping

* Exported expenses are mapped to the correct **GL Accounts**:
  * Wallet, Out-of-Pocket, Contra, Expense Category, Accounts Payable
* Data mapping ensures all **mandatory**, **invoice-specific**, and **optional** datapoints are correctly recorded:
  * Amounts, dates, tax codes, dimensions, unique identifiers, VAT/tax information

See:

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

### 7. Attachment Handling

* Receipts and supporting documents are linked to the corresponding journal entry, invoice, or credit note.
* Multiple attachments are supported if the Accounting System allows.

See: [How to Transfer Attachments](/docs/current/how-tos/accounting-integrations/how-to-transfer-attachments-for-as-erp-processing)

### 8. Accounting Period Assignment

* Expenses are assigned to the correct accounting period, even if the period is closed or uses a custom calendar.

See: [How to Assign Accounting Periods](/docs/current/how-tos/accounting-integrations/how-to-assign-accounting-periods-for-as-erp-processing)

### 9. Posting Behaviour

* Entries may be recorded as **drafts** for review or **finalised** automatically, depending on configuration.

See: [How to Apply Posting Behaviour](/docs/current/how-tos/accounting-integrations/how-to-apply-posting-behaviour-for-as-erp-processing)

## Status Updates

### 10. Update Export Item Status

* Each Export Item is updated with its success or failure status.

See: [How to Update Export Items](/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing)

### 11. Update Export Job Status

* Once all items are processed, the Export Job is updated with an overall status reflecting the combined results:
  * **Completed:** all Export Items succeeded
  * **Completed with Errors:** some items failed
  * **Failed:** all items failed

See: [How to Update & Complete the Export Job](/docs/current/how-tos/accounting-integrations/how-to-update-and-complete-export-job-for-as-erp-processing)

***

## What Comes Next?

The following pages provide a deeper explanation of each step and the platform capabilities that support it:

* [Bookkeeping Methods Overview](/docs/current/platform/exports/bookkeeping-methods-overview)
* [Journal Entry Bookkeeping](/docs/current/platform/exports/bookkeeping-methods-journal-entry)
* [Accounts Payable Bookkeeping](/docs/current/platform/exports/bookkeeping-methods-accounts-payable)
* [Accounts Mapping](/docs/current/platform/exports/accounts-mapping)
* [Data Mapping](/docs/current/platform/exports/data-mapping)
* [Attachments](/docs/current/platform/exports/attachments)
* [Accounting Periods](/docs/current/platform/exports/accounting-periods)
* [Posting Behaviour](/docs/current/platform/exports/posting-behaviour)

***

## Related Reading

* [Connection and Authorisation Overview](/docs/current/integration-design/auth/integration-design-auth-overview)
* [OAuth 2.0 Access to Staging Workflow Guide](/docs/current/guides/environment-access/staging-oauth-workflow)
* [Export Integration Workflow Guide](/docs/current/guides/export-integration-workflow-guide)
* [AS/ERP Processing Workflow Guide](/docs/current/guides/accounting-system-processing-workflow-guide)
