curl --request POST \
--url http://localhost:3500/v1/agreements/{id}/match-invoices/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('http://localhost:3500/v1/agreements/{id}/match-invoices/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/agreements/{id}/match-invoices/preview"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"invoices": {
"current": 1,
"removed": 1,
"added": 1
},
"alerts": {
"deleted": 1,
"kept": 1,
"lost_decisions": 1
},
"counts_exact": true,
"smart_matching_changed": true,
"etag": "<string>"
}{
"error": {
"code": "validation_error",
"message": "Invalid request format, parameters, or body. Details contain up to 20 actionable field errors; the complete encoded request body must be at most 2 MiB (2,097,152 bytes).",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "Stored applicability cannot be represented by this API.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication infrastructure is unavailable or rate limited. Honor Retry-After when provided.",
"request_id": "req_example"
}
}Preview a matching refresh
Counts what refreshing matched invoices would unlink, link and delete under a proposed configuration, without saving or changing anything. Omitted fields use the stored agreement; supplied fields have PATCH semantics. An empty JSON object () previews a refresh of the stored configuration. Counts describe the relationships and alerts at read time; invoice syncs can change them before the refresh. Counts assume the agreement is active; refreshing a draft or archived agreement changes nothing until it is activated. Callers decide when to confirm, for example when removed or alerts.deleted is positive or smart_matching_changed is true.
curl --request POST \
--url http://localhost:3500/v1/agreements/{id}/match-invoices/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('http://localhost:3500/v1/agreements/{id}/match-invoices/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "http://localhost:3500/v1/agreements/{id}/match-invoices/preview"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"invoices": {
"current": 1,
"removed": 1,
"added": 1
},
"alerts": {
"deleted": 1,
"kept": 1,
"lost_decisions": 1
},
"counts_exact": true,
"smart_matching_changed": true,
"etag": "<string>"
}{
"error": {
"code": "validation_error",
"message": "Invalid request format, parameters, or body. Details contain up to 20 actionable field errors; the complete encoded request body must be at most 2 MiB (2,097,152 bytes).",
"request_id": "req_example"
}
}{
"error": {
"code": "invalid_token",
"message": "Missing or invalid bearer credential.",
"request_id": "req_example"
}
}{
"error": {
"code": "forbidden",
"message": "Access denied: forbidden, token_disabled, organization_required, insufficient_role, or mfa_required. Check the error code and effective permissions.",
"request_id": "req_example"
}
}{
"error": {
"code": "not_found",
"message": "The resource does not exist in the current organization.",
"request_id": "req_example"
}
}{
"error": {
"code": "conflict",
"message": "Stored applicability cannot be represented by this API.",
"request_id": "req_example"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "The IP or authenticated credential exceeded its request limit.",
"request_id": "req_example"
}
}{
"error": {
"code": "internal_error",
"message": "Unexpected server failure. Include the request ID when contacting support.",
"request_id": "req_example"
}
}{
"error": {
"code": "service_unavailable",
"message": "Authentication infrastructure is unavailable or rate limited. Honor Retry-After when provided.",
"request_id": "req_example"
}
}Authorizations
Personal API key. Send X-Organization-Id. The required cumulative level is listed in x-watchdog-permission.
Headers
Required for personal API keys. Target one organization you have access to. Migrated keys may omit it to use their original organization. For Clerk sessions, it must match the active organization.
Path Parameters
Body
^\d{4}-\d{2}-\d{2}$^\d{4}-\d{2}-\d{2}$Complete supplier selection. An empty array matches no invoices.
Complete recipient selection. An empty array removes the recipient restriction.
Show child attributes
Show child attributes
Stored smart-matching configuration. Replaces the complete object; omitted values default to false and null. Saving does not run matching.
Show child attributes
Show child attributes
Response
Refresh impact.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
False when smart matching applies under the proposed configuration: removed is then a minimum and added a maximum.
The proposed smart-matching toggle or criterion differs from the stored one. With smart matching enabled, a refresh then re-judges every existing match.
The agreement ETag (not a preview validator) the counts were computed against. Send it as If-Match when saving the configuration. Also returned in the ETag header.