> ## 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 Update & Complete the Export Job

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 UpdateAndCompleteExportJobDiagram = () => {
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "14px"}}}%%
flowchart LR
    S1["1. Determine Final Outcome"] --> S2["2. Build Event Payload<br><br>"] --> S3["3. Send Event<br><br>"] --> S4["4. Handle Response<br><br>"]

click S1 "#1-determine-final-outcome"
click S2 "#2-build-event-payload"
click S3 "#3-send-event"
click S4 "#4-handle-response"

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="G" />

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

After all Export Items have been processed and updated, you must complete the Export Job by sending a final status to Pleo.

This finalises the export workflow.

## Prerequisites

Before you begin:

* All Export Items have been processed in your AS/ERP
* [All Export Item statuses have been reported to Pleo](/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing)
* You have the overall result of the export (success, partial success, or failure)

## Steps

### 1. Determine Final Outcome

Evaluate the results of all Export Items:

| Condition            | Event                   |
| -------------------- | ----------------------- |
| All items successful | `completed`             |
| Some items failed    | `completed_with_errors` |
| All items failed     | `failed`                |

### 2. Build Event Payload

**All items successful**

```json theme={null}
{
  "exportJobId": "JOB_ID",
  "event": "completed"
}
```

**Partial success**

```json theme={null}
{
  "exportJobId": "JOB_ID",
  "event": "completed_with_errors"
}
```

**Fatal failure**

```json theme={null}
{
  "exportJobId": "JOB_ID",
  "event": "failed",
  "failureReason": "ERP unavailable",
  "failureReasonType": "service_unreachable"
}
```

<RememberCallout title="Remember">
  Only include `failureReason` and `failureReasonType` when `"event": "failed"`. For `failureReasonType` guidance and supported values, see [Integration Design: Update & Complete Export Job](/docs/current/integration-design/exports/integration-design-exports-update-and-complete-export-job).
</RememberCallout>

### 3. Send Event

```bash theme={null}
curl -X POST https://api.pleo.io/v3/export-job-events \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "exportJobId": "JOB_ID",
    "event": "completed"
  }'
```

### 4. Handle Response

```pseudo theme={null}
if response.success:
    stopRetrying()
else:
    retryOrLogError()
```

* Retry on transient failures
* Ensure the event is sent only once per final state

<RememberCallout title="Remember">
  The Export Job should only be completed after all Export Item updates have been successfully acknowledged.
</RememberCallout>

#### Pleo Web App

Completing the Export Job triggers the **user-visible update in Pleo**.

* Export status is shown in the **Export queue**
* Users can review failed items and error details

<div style={{ textAlign: "center" }}>
  <img src="https://mintcdn.com/pleo-61d4d38b/Sk6KKlJRa6sMRffn/images/current/accounting-integrations/as-ui-export-job-completion-with-errors.png?fit=max&auto=format&n=Sk6KKlJRa6sMRffn&q=85&s=4ff4839d34a121e2606f7874b6dd017d" alt="Export Job Completed with Errors" width="100%" style={{ display: "block", margin: "0 auto" }} data-path="images/current/accounting-integrations/as-ui-export-job-completion-with-errors.png" />
</div>

In the message banner at the top of your screen, click the **Review errors** link to see the reasons why Export Items failed.

<div style={{ textAlign: "center" }}>
  <img src="https://mintcdn.com/pleo-61d4d38b/Sk6KKlJRa6sMRffn/images/current/accounting-integrations/as-ui-export-job-completion-with-errors-details.png?fit=max&auto=format&n=Sk6KKlJRa6sMRffn&q=85&s=2cff04048e96cb5cb8318f759b92e2b1" alt="Export Job Completed with Errors - View Error" width="100%" style={{ display: "block", margin: "0 auto" }} data-path="images/current/accounting-integrations/as-ui-export-job-completion-with-errors-details.png" />
</div>

## Result

After completing this step:

* Pleo marks the Export Job as completed based on the submitted event (`completed`, `completed_with_errors`, or `failed`)
* Export Job status is visible in the **Export queue**
* Export Item results (success and failure) are surfaced to users
* Failed items include error details for review and correction
* No further Export Item updates can be made for this job

<RememberCallout title="Remember">
  Once an Export Job is completed, it is **final and cannot be modified**.
</RememberCallout>

***

## What Comes Next?

<WhatComesNext href="/docs/current/guides/export-integration-workflow-guide#what-comes-next">
  Return to the Export Integration Workflow Guide
</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)

***
