> For the complete documentation index, see [llms.txt](https://docs.younium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.younium.com/erp-and-accounting-integrations/pe-accounting.md).

# PE Accounting

## Overview

PE Accounting (Kleer) integration posts customer invoices to PE Accounting when invoices are posted, optionally certifies them, and can delete PE invoices when Younium invoices are cancelled. Master data sync uses username/password credentials and import jobs for accounts and products.

***

## Authentication

You connect PE Accounting with the username and password of the PE Accounting user Younium should act as. They are entered once in the integration settings and used on every request from then on.

Because the connection is a user sign-in, it follows that user's account: changing the password in PE Accounting stops posting until the new one is entered in Younium. A dedicated integration user rather than a person's own login avoids that.

***

## Activation and deactivation

Entering credentials that PE Accounting accepts activates the integration.

Saving the settings creates the invoice custom fields the integration maps to and turns on the two exchanges: posting an invoice in Younium creates one in PE Accounting, and cancelling a posted invoice removes it there.

Deactivating stops both. Documents already in PE Accounting are untouched.

***

## Custom fields

| Entity                              | Custom field name              | Notes                            |
| ----------------------------------- | ------------------------------ | -------------------------------- |
| Account                             | `Pe-Accounting Client Id`      | Required for posting             |
| Account                             | `Pe-Accounting Customer No`    | Sync                             |
| Product, Charge, OrderProductCharge | `Pe-Accounting Product Id`     | Per line                         |
| Invoice                             | `Pe-Accounting Invoice Number` | After post                       |
| Invoice                             | `Pe-Accounting Invoice Id`     | Ensured at post time             |
| —                                   | `Pe-Accounting User`           | List on invoice for certify user |

***

## Eligibility and filtering

* Account must have **Pe-Accounting Client Id** custom field.
* Each line must have product id on order product charge custom field.
* `ExcludeZeroQuantityRecurringLines`: skips recurring lines with quantity 0.
* When `CertifyInvoices`: invoice date cannot be future or more than 14 days in the past.
* `ApplyZeroAmountFilters` on lines.

***

## Field mapping — posted invoice (Younium → PE Accounting)

### Header (dictionary keys in API body)

| Younium field                 | PE field                                          |
| ----------------------------- | ------------------------------------------------- |
| `TotalAmount.CurrencyCode`    | `currency`                                        |
| Account custom client id      | `client-ref.id`                                   |
| `YourOrderNumber`             | `po-nr`                                           |
| `Account.InvoiceEmailAddress` | `invoice-email`                                   |
| `InvoiceDate` / `DueDate`     | `invoice-date`, `due-date` (`yyyy-MM-dd`)         |
| Delivery date                 | `delivery-date` (same as invoice date in handler) |
| Address fields                | `invoice-address`, `delivery-address` objects     |
| Certify user list Key         | Used in certify step when enabled                 |
| Rows object                   | `rows` (line array)                               |

### Line row

| Younium field                                                   | PE field                                                                                    |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| Product custom field id                                         | `product.id`                                                                                |
| `quantity` (1, line qty, or zero-amount case)                   | `quantity`                                                                                  |
| `Subtotal.Amount` × 100 as int                                  | `price`                                                                                     |
| VAT % from tax items                                            | `vat`                                                                                       |
| Built description (charge, qty, UoM, SP, notes)                 | `description`                                                                               |
| `unit`                                                          | Unit of measure display when applicable                                                     |
| Service period (recurring/usage + `MapEffectiveDatesOnInvoice`) | `period.start-date`, `period.end-date` (may shift to next open accounting period if closed) |
| `UseCustomfieldQtyPrice`                                        | PE custom fields `AntalYounium`, `PrisYounium`                                              |

### Write-back (Younium)

| PE field                          | Younium field                                                                |
| --------------------------------- | ---------------------------------------------------------------------------- |
| Invoice id / number from response | Custom fields **Pe-Accounting Invoice Id**, **Pe-Accounting Invoice Number** |

Certify and PDF attachment steps run when `CertifyInvoices` is true (see handler after initial POST).

***

## Post invoice workflow

**Runs when:** an invoice is posted in Younium.

Throttled where configured in handler.

***

## Invoice cancelled workflow

**Runs when:** an invoice is cancelled in Younium.

Deletes or voids PE invoice when integration enabled (confirm behaviour in delete handler).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.younium.com/erp-and-accounting-integrations/pe-accounting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
