> For the complete documentation index, see [llms.txt](https://docs.eu-pactum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eu-pactum.com/procurement-api/quote-data-enrichment.md).

# Quote data enrichment

When attachments are uploaded to a negotiation event, Pactum can analyze them to extract and improve supplier data before starting a negotiation.

If enabled in the workspace configuration, quote data enrichment runs automatically when `start` is called on a negotiation event. The extracted values are only used within Pactum for negotiation purposes and are not written back to the source system.

### Enrichment process

1. Attachments are uploaded to the negotiation event using `POST /procurement/v1/workspaces/{workspaceId}/negotiation-events/{negotiationEventId}/attachments`. An attachment is eligible for enrichment if either:
   * it is scoped to a supplier via the `supplierId` query parameter, or
   * it is uploaded with `visibleToSupplier=true` on an event that has exactly one supplier.
2. When the negotiation event is started, Pactum processes all eligible attachments.
3. For each supplier, Pactum analyzes the relevant attachments and extracts data.
4. Extracted values are compared against the existing supplier data. If a correction is warranted and passes validation, the supplier record is updated before the negotiation is started.

If Pactum cannot extract data for a supplier, the negotiation proceeds with the original data.

### Extracted fields

Each extraction type can be turned on or off individually, and all are off by default.

#### Supplier contact

The following supplier contact information is extracted from the uploaded documents:

* Email address
* Contact person name
* Phone number

Pactum attempts to extract only supplier contacts. Buyer contacts, approvers, and unrelated third parties are excluded.

**Contact correction rules**

The supplier email is only corrected if both conditions are met:

* The extracted email is different from the current email on the supplier.
* The extracted email domain matches the current email domain.

For example:

* The supplier email is `invoices@supplier.com` and Pactum extracts `john.smith@supplier.com`. In this case, the negotiation is sent to `john.smith@supplier.com` because both emails are on the `supplier.com` domain.
* The supplier email is `invoices@supplier.com` and Pactum extracts `john@yahoo.com`. The negotiation is sent to `invoices@supplier.com` because the email domains do not match.

The contact person name is only updated when the email is also corrected. If the email does not meet the domain-match condition, neither the email nor the contact name is changed.

The phone number is corrected independently of the email. If a different phone number is found, it is applied regardless of the email domain check.

#### Quote reference

Pactum extracts the supplier's quote or quotation reference number from the document.

The quote reference is extracted exactly as it appears in the document, without changes. It replaces the existing quote ID on the supplier when the extracted value differs from the current one.

#### Payment terms

The following payment term information is extracted from the document:

* Payment term type: Net, End of Month, or End of Week
* Day counts associated with the payment term type
* Early payment discount percentage and timing, if offered

**Payment term correction rules**

Extracted payment terms are matched against the payment term options configured for the workspace. A correction is applied only when:

1. The extracted terms match a single configured payment term option (type, day counts, and early payment discount must all match). If the document contains multiple early payment discount tiers, no correction is made.
2. The workspace configuration controls whether existing payment terms can be overwritten and whether empty payment terms can be filled.

If the extracted terms do not match a single configured option, no correction is made.

### Visibility

When a correction is applied, it is recorded in the [Agent log](https://docs.eu-pactum.com/essentials/agent-log.md).

### Recommendations for attachments

The following recommendations apply when uploading attachments for enrichment:

* Each document is expected to relate to a single supplier.
* Header-level upload is intended for source systems that attach quote documents to the requisition header rather than a specific supplier row.
