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

# Sync Tax Codes

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

This page describes the Tax Sync reconciliation process: synchronising relevant active tax codes from the Accounting System with Tax Codes in Pleo.

This step runs on every Tax Sync cycle.

## Implementation

* [Tax Sync Workflow Guide](/docs/current/guides/accounting-integrations/imports/tax-sync-workflow-guide): workflow context and sequencing
* [How to Fetch and Match Tax Codes](/docs/current/how-tos/accounting-integrations/imports/tax-codes/how-to-fetch-and-match-tax-codes): API usage and step-by-step instructions

For a conceptual overview of how AS tax codes map to Pleo Tax Codes, see [Platform Capabilities: Tax Sync](/docs/current/platform/accounting-integrations/imports/tax-codes/tax-sync-overview).

## Matching Rules

* Matching is performed using the **`code`** field on both ends.
* Matching is **case insensitive**.
* Name, rate, and type are not used for matching; only `code` is used.

## Sync Process

```mermaid theme={null}
%%{init: {"themeVariables": {"fontSize": "28px"}}}%%
flowchart TD
    A[1. Fetch relevant active Tax Codes from AS] --> B[2. Fetch active and archived Tax Codes from Pleo]
    B --> C[3. Match each AS Tax Code to Pleo Tax Code by code]
    C -->|Found, Pleo<br> active, details<br> match| D[Preserve Tax Code as-is]
    C -->|Found, Pleo<br> active, details<br> differ| E[Update name, rate, and type]
    C -->|Found, Pleo<br> archived| F[Unarchive Tax Code and update if needed]
    C -->|Not found| G[Create new Tax Code]
    C -->|Duplicate codes<br> in Pleo| H[Retain matching rate; archive duplicate]
    D --> I[Continue to next tax code]
    E --> I
    F --> I
    G --> I
    H --> I
    C -->|Pleo active, <br>no matching<br> AS Tax Code| J[4. Archive unmatched Tax Codes]

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

### 1. Fetch Relevant Active Tax Codes from the AS

Retrieve all active tax codes from the Accounting System, then apply the following filters:

* **Exclude** tax codes not relevant to expense management (for example: Sales VAT)
* **Exclude** blocked, inactive, or archived tax codes

Only the filtered set is used for reconciliation. The Accounting System is the source of truth.

### 2. Fetch Tax Codes from Pleo

Retrieve both **active and archived** Tax Codes from Pleo for the connected company.

Including archived Tax Codes allows unarchiving rather than creating duplicates if a tax code becomes active in the AS again.

### 3. Match Tax Codes by code

For every filtered active AS tax code, attempt to find a matching Tax Code in Pleo using the `code` field on both ends.

Matching is **case insensitive**.

#### code found, Tax Code is active in Pleo, details match

The AS tax code is active and the matching Pleo Tax Code is also active with the same name, rate, and type. No action required.

#### code found, Tax Code is active in Pleo, details differ

The AS tax code is active and the matching Pleo Tax Code is also active, but the name, rate, or type differs. **Update** the Tax Code's name, rate, and type to match the AS.

#### code found, Tax Code is archived in Pleo

The AS tax code is active but the matching Pleo Tax Code is archived. **Unarchive** the Tax Code and update its name, rate, and type if they differ from the AS.

#### code not found

The AS tax code is active but no matching Pleo Tax Code exists. **Create a new Tax Code** with the tax code's code, name, rate, and type.

#### Duplicate codes found in Pleo

Two or more Tax Codes in Pleo share the same code.

* Retain the Tax Code whose rate matches the rate from the matching AS tax code. Archive the duplicate.
* If all duplicates match the rate, retain one and archive the rest.

### 4. Archive Unmatched Tax Codes

Pleo Tax Codes that are active but have no matching active AS tax code must be **archived**.

This covers tax codes that were previously present in the AS but have since been deactivated, blocked, or removed.

<RememberCallout title="Remember">
  Tax Codes are never permanently deleted. Archiving preserves historical data and allows unarchiving if the tax code becomes active in the AS again.
</RememberCallout>

## Tax Code Types

For type mapping rules, see [Tax Sync Data Mapping](/docs/current/integration-design/accounting-integrations/imports/tax-codes/integration-design-tax-sync-data-mapping).

***

## What Comes Next?

* [Tax Sync Data Mapping](/docs/current/integration-design/accounting-integrations/imports/tax-codes/integration-design-tax-sync-data-mapping)

***

## Related Reading

* [How to Fetch and Match Tax Codes](/docs/current/how-tos/accounting-integrations/imports/tax-codes/how-to-fetch-and-match-tax-codes)
* [How to Create, Update, and Archive Tax Codes](/docs/current/how-tos/accounting-integrations/imports/tax-codes/how-to-create-update-archive-tax-codes)
* [Tax Sync Workflow Guide](/docs/current/guides/accounting-integrations/imports/tax-sync-workflow-guide)
* [Platform Capabilities: Tax Sync](/docs/current/platform/accounting-integrations/imports/tax-codes/tax-sync-overview)

***
