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

# How to Fetch Export Item Data for Processing

export const WhatComesNext = ({children, href}) => <div className="mt-4">
    <a href={href} className="
        inline-flex items-center justify-center
        rounded-full
        bg-black text-white dark:bg-[#1f262b]
        px-5 py-2.5 text-sm font-medium
        no-underline border-0
        hover:bg-[#ffe6ea] dark:hover:bg-[#2b1f23]
        hover:text-black
        transition-colors
      ">
      {children} →
    </a>
  </div>;

export const FetchExportItemDataDiagram = () => {
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "20px"}}}%%
flowchart LR
    S1["1. Fetch Full Export Item Data"] --> S2["2. Handle Pagination<br><br>"] --> S3["3. Validate Each Export Item"]
    S1 -.->|interrupted| S4["4. Handle Job Recovery"]
    S2 -.->|interrupted| S4
    S3 -.->|interrupted| S4

click S1 "#1-fetch-full-export-item-data"
click S2 "#2-handle-pagination"
click S3 "#3-validate-each-export-item"
click S4 "#4-handle-job-recovery"

style S1 white-space:normal
style S2 white-space:normal
style S3 white-space:normal
style S4 white-space:normal
`;
  return <Mermaid chart={diagram} />;
};

export const WorkflowDiagramTopNav = ({highlight}) => {
  const highlightStyle = highlight ? `style ${highlight} stroke:#f63b92,stroke-width:5px` : "";
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "28px"}}}%%
flowchart LR

  WEBAPP["Queue Export Items in Pleo's Web App"]

subgraph Pleo["Pleo API's"]
    START1[" "]
    A["1.Detect & Start Export Jobs"] --> B["2.Perform Pre-Export Validation"]
    B --> C["3.Retrieve Export Job Items for Processing"]
    C --> D["4.Fetch Export Item Data for Processing"]
end

subgraph ERP["AS/ERP"]
    START2[" "]
    E["5.Process & Record Export Items"]
end

subgraph Pleo2["Pleo API's"]
    START3[" "]
    F["6.Update Export Items"] --> G["7.Update & Complete Export Job"]
end
WEBAPP --> A
D --> E
E --> F

click WEBAPP "/docs/current/how-tos/accounting-integrations/how-to-queue-export-items-in-ui"
click A "/docs/current/how-tos/accounting-integrations/how-to-detect-and-start-export-jobs-for-as-erp-processing"
click B "/docs/current/how-tos/accounting-integrations/how-to-perform-pre-export-validation-for-as-erp-processing"
click C "/docs/current/how-tos/accounting-integrations/how-to-retrieve-export-job-items-for-as-erp-processing"
click D "/docs/current/how-tos/accounting-integrations/how-to-fetch-export-item-data-for-as-erp-processing"
click E "/docs/current/how-tos/accounting-integrations/how-to-determine-the-bookkeeping-method-for-as-erp-processing"
click F "/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing"
click G "/docs/current/how-tos/accounting-integrations/how-to-update-and-complete-export-job-for-as-erp-processing"

style WEBAPP white-space:normal
style Pleo white-space:normal
style ERP white-space:normal
style Pleo2 white-space:normal
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 START1 fill:transparent,stroke:transparent,color:transparent
style START2 fill:transparent,stroke:transparent,color:transparent
style START3 fill:transparent,stroke:transparent,color:transparent
style Pleo fill:none,stroke:#000000
style ERP fill:none,stroke:#000000
style Pleo2 fill:none,stroke:#000000

${highlightStyle}
`;
  return <Mermaid chart={diagram} />;
};

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

<WorkflowDiagramTopNav highlight="D" />

<div style={{ border: "2px solid #f63b92", borderRadius: "8px", padding: "16px", backgroundColor: "transparent" }}>
  <FetchExportItemDataDiagram />
</div>

Fetching Export Item Data is the step where integrations retrieve the full accounting payload required for processing.

This step operates on the items identified in the [How to Retrieve Export Job Items for Processing](/docs/current/how-tos/accounting-integrations/how-to-retrieve-export-job-items-for-as-erp-processing) article.

<RememberCallout title="Remember">
  This endpoint returns **processing data**, not control state.
</RememberCallout>

## Prerequisites

Before you begin:

* You've completed [How to Retrieve Export Job Items for Processing](/docs/current/how-tos/accounting-integrations/how-to-retrieve-export-job-items-for-as-erp-processing)
* You have a `jobId`
* You have identified items to process (e.g. `pending`)

## Steps (Data Layer)

### 1. Fetch Full Export Item Data

**API Endpoint**: GET [/v3/export-items](/reference/export-api/export-items-v3/get-export-items)

**Example parameters:** jobId: `8eb648ab-464b-42a0-ba17-eda703657e33`

Once Export Items have been identified for the job, retrieve the full accounting payload for processing.

The `export-items` endpoint returns all Export Items for the job, including:

* transaction details
* accountingEntryLines
* supplier/vendor data
* bookkeeping metadata
* attachments

Each item must be processed individually using this payload.

**Example Pseudo:**

```pseudo theme={null}
items = fetchFullExportItems(jobId)

for item in items:
    process(item)
```

#### Example Request

<Tabs>
  <Tab title="OAuth 2.0">
    ```bash theme={null}
    curl -X GET "https://external.staging.pleo.io/v3/export-items?job_id=8eb648ab-464b-42a0-ba17-eda703657e33" \
      -H "Authorization: Bearer <access_token>"
    ```
  </Tab>

  <Tab title="API Key">
    ```bash theme={null}
      curl --request GET \
      -u "pls_1ab2cd3e4f5g6h7a89b012c34de56f78_gabc90:" \
      -H "Accept: application/json;charset=UTF-8" \
      "https://external.staging.pleo.io/v3/export-items?job_id=8eb648ab-464b-42a0-ba17-eda703657e33" \
      | jq
    ```
  </Tab>
</Tabs>

#### Example Response

```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 & Stationery",
            "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]
```

### 2. Handle Pagination

Export Items may be returned across multiple pages.

<RememberCallout title="Remember">
  Always retrieve all pages before beginning processing to avoid partial exports.
</RememberCallout>

#### Example Response

```json theme={null}
"pagination": {
  "hasNextPage": true,
  "endCursor": "<string>"
}
```

**Example Pseudo:**

```pseudo theme={null}
items = []

do:
    response = fetchItems(cursor)
    items.append(response.data)
    cursor = response.pagination.endCursor
while response.pagination.hasNextPage
```

### 3. Validate Each Export Item

Before attempting to record an item in your Accounting System, validate that it has everything required to be processed. This check runs **per item**. A failure on one item does not block others.

Two checks are required:

**Check 1: Required configurations are present**

Verify that all integration configurations needed to export this specific item exist (e.g. the journal is configured,
required accounts are mapped).

**Check 2: Expense GL Account (Category) is present**

Verify that the item has an Expense GL Account assigned via `accountingEntryLines[].account`.

If either check fails, **do not attempt to record the item in the AS**. Instead, mark it as failed immediately and
move to the next item.

```pseudo theme={null}
for item in items:
    if not hasRequiredConfigurations(item):
        failItem(item,                     
            failureReasonType = "missing_configuration",                                                              
            failureReason = "[Account/Journal X] missing: provide [X] in the configurations"
        )                                                                                                             
        continue                                                                                                      
                
    if not hasExpenseGLAccount(item):                                                                                 
        failItem(item,               
            failureReasonType = "missing_configuration",
            failureReason = "Account [X] missing: provide account [X] in the configurations"
        )                                                                                   
        continue                                                                                                      
                
    process(item)                                                                                                     
```

<NoteCallout title="Note">
  Failed items must still be reported back to Pleo. See [How to Update Export\
  Items](/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing) for how to set
  `status: failed` with the appropriate `failureReasonType` and `failureReason`.
</NoteCallout>

### 4. Handle Job Recovery

If your integration restarts or loses state, it must be able to resume processing safely.

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#3-handle-job-recovery-in_progress-jobs)

## Result

After completing these steps:

* All Export Items with full payloads for the job have been retrieved
* Pagination has been fully resolved
* The integration is ready to process items sequentially
* The workflow remains resumable and consistent
* Each item has been validated for required configurations and GL Account before
  AS processing begins

***

## What Comes Next?

Up to this point, you’ve completed steps 1–4 of the [Export Integration Workflow Guide](/docs/current/guides/export-integration-workflow-guide).

Step 5 moves processing **from** Pleo’s export workflow **to** your Accounting System or ERP, where Export Items are processed and recorded, as outlined in the [AS/ERP Processing Workflow Guide](/docs/current/guides/accounting-system-processing-workflow-guide).

Once processing is complete, return to steps 6 and 7 of the [Export Integration Workflow Guide](/docs/current/guides/export-integration-workflow-guide) to update the status of each Export Item and finalise the Export Job.

<WhatComesNext href="/docs/current/how-tos/accounting-integrations/how-to-determine-the-bookkeeping-method-for-as-erp-processing">
  AS/ERP Processing Workflow Guide: Step 1: How to determine bookkeeping method
</WhatComesNext>

***

<div className="text-xs uppercase" style={{ fontVariant: 'small-caps' }}>
  this how-to is part of:
</div>

<div className="mt-4 flex flex-wrap gap-2">
  <a
    href="/docs/current/guides/export-integration-workflow-guide"
    className="inline-flex items-center rounded-full border border-gray-300 dark:border-gray-600
px-3 py-1 text-xs font-medium
bg-white dark:bg-[#1f262b] text-black dark:text-white
hover:bg-gray-100 dark:hover:bg-[#2b2f33]
transition-colors"
  >
    Export Integration Workflow Guide
  </a>
</div>

***

## Related Reading

* [Export Lifecycle](/docs/current/platform/exports/lifecycle)
* [Connection and Authorisation Overview](/docs/current/integration-design/auth/integration-design-auth-overview)

***

## FAQs

<Accordion title="Why am I getting a MISSING_CONTRA_ACCOUNTS error?">
  You're getting a `MISSING_CONTRA_ACCOUNTS` error, because the Export API v3 requires a contra account to be configured for each entity's default currency. If any entity's default currency does not have a contra account mapped, calls to `/v3/export-items` will fail with this error.

  See [How to Resolve MISSING\_CONTRA\_ACCOUNTS](/docs/current/how-tos/accounting-integrations/how-to-resolve-missing-contra-accounts) for steps to fix this.
</Accordion>

<Accordion title="Why is the `bookkeeping` field returning `null` in my export items response?">
  You're getting a `null` value for the `bookkeeping` field, because it's only populated when the **Vendor Tagging** feature is enabled and a bookkeeping method has been assigned to the expense before it was queued. Without Vendor Tagging enabled, `bookkeeping` will always be `null`. This is expected behaviour, not an error.

  When `bookkeeping` is `null`, use the `supplier` field on the export item for bookkeeping purposes instead.

  See [How to Enable Vendor-Based Bookkeeping](/docs/current/how-tos/accounting-integrations/how-to-enable-vendor-based-bookkeeping) for steps to enable it.
</Accordion>

***
