> ## Documentation Index
> Fetch the complete documentation index at: https://docs.watchdog.no/llms.txt
> Use this file to discover all available pages before exploring further.

# Matching

> Link invoices to the agreements that cover them.

Before Watchdog can check an invoice, it needs to know which agreements cover it. That link is a
**match**. Watchdog matches invoices on the agreement's suppliers, recipients, dates, applicability
and, if you turn it on, smart matching.

New invoices are matched automatically when they arrive. You only need this page when something
changes afterwards.

## Refresh matches

Saving an agreement doesn't re-match its invoices. After you change who or what an agreement covers,
refresh its matches:

```bash theme={null}
curl -X POST "$API_URL/v1/agreements/$AGREEMENT_ID/invoices/refresh" \
  -H "Authorization: Bearer $API_KEY" -H "X-Organization-Id: $ORGANIZATION_ID"
```

To refresh a single invoice instead, use `POST /v1/invoices/{id}/agreements/refresh`. Both return a
`workflow_run_id` you can [follow until it finishes](/api-reference/workflow-runs).

Matching doesn't start checks. To check newly matched invoices, see
[compliance checks](/api-reference/compliance-checks).

## See what's matched

* `GET /v1/invoices?agreement_ids={id}` lists the invoices matched to an agreement.
* `GET /v1/invoices/{id}/agreements` lists the agreements matched to an invoice.

## When a match is removed

If a refresh removes a match, that invoice's alerts for the agreement are set aside, not deleted.
They keep their decisions and claims, and they come back if the invoice matches again.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.