# setInvoiceToleranceConfig

## Overview

Upserts a supplier's invoice tolerance configuration for a company. The InvoiceToleranceConfig is unique per (company, supplier); this resolver creates the row on first save and patches it on subsequent saves, so callers have a single "set" mutation regardless of whether a config already exists. Each of the four tolerance fields (absolute/percentage × quantity/unit-price) is optional — an empty value is stored as null, meaning strict matching for that field. Percentage values are fractions (0.05 = 5%). The tolerances relax the quantity and unit-price variance checks that run during AP document registration (3-way match); a variance within tolerance no longer raises a SYSTEM payment hold. Tolerance values must be non-negative. Returns the InvoiceToleranceConfig ID.

## Modules Commands Used

- [account-payable] CreateInvoiceToleranceConfig
- [account-payable] UpdateInvoiceToleranceConfig

## Exception Handling

| Error Code | Description |
| --- | --- |
| ACCOUNT_PAYABLE_COMPANY_NOT_FOUND | The referenced company does not exist |
| ACCOUNT_PAYABLE_AP_BUSINESS_PARTNER_NOT_FOUND | The referenced supplier business partner does not exist |
| ACCOUNT_PAYABLE_INVALID_TOLERANCE_VALUE | A tolerance value is negative |
| ACCOUNT_PAYABLE_INVOICE_TOLERANCE_CONFIG_ALREADY_EXISTS | A config already exists for the company and supplier (create path) |
| ACCOUNT_PAYABLE_INVOICE_TOLERANCE_CONFIG_NOT_FOUND | The config to update does not exist (update path) |
