Update relation
https://api.invunion.com/api/v1/counterparties/:code/relations/:relationId counterparties:write
Idempotency-Key
Markdown Change the share, the review setting, the dates or the notes of a relation.
Updates only the fields sent. The relation can be addressed from either of its two counterparties. To change who relates to whom, delete the relation and add another. Unknown fields are rejected.
Path parameters
| Name | Type | Required |
|---|---|---|
code Counterparty code ( Example: CPT-042 | string Max 50 | Required |
relationId Id of the relation, as returned when it was created or listed. Example: 3f2a9c1e-7b4d-4e8a-9c21-5d6e7f8a9b0c | string No maximum | Required |
Body parameters
| Name | Type | Required |
|---|---|---|
sharePercent Third-party payers only. Share of each invoice the payer covers, as a percentage of the total including VAT, above 0 and at most 100. null or omitted means the full amount. Example: 70 | number | Optional |
trust customer: a payment from the related counterparty counts like one from the customer. review: its matches always wait in the Match inbox. Default customer. Allowed values customerreview | string No maximum | Optional |
validFrom First invoice date the relation applies to, as YYYY-MM-DD. null or omitted means no start. Example: 2026-01-01 | string No maximum | Optional |
validTo Last invoice date the relation applies to, as YYYY-MM-DD. null or omitted means no end. Example: 2026-12-31 | string No maximum | Optional |
notes Free text for your team. Example: Insurer covers 70% under contract 2026-A. | string Max 1000 | Optional |
Errors
This operation can return the following errors in addition to generic HTTP failures.
| Error | HTTP code | Description |
|---|---|---|
Missing Bearer token | 401 | The Authorization header is missing or is not a Bearer token. |
Invalid or revoked API key | 401 | The API key is unknown, malformed, expired, or has been revoked. |
API key is missing scope counterparties:write | 403 | The key does not include counterparties:write. A write scope does not imply the matching read scope. |
Too many requests, please try again later | 429 | More than 100 requests in one minute from this API key or IP address. Wait for the Retry-After header (seconds) and retry. |
sharePercent: Too big: expected number to be <=100 | 400 | A field of the body is missing, unknown or out of range. The message names the field. |
A share only applies to a third-party payer | 400 | sharePercent was sent for a company group relation. |
validTo must be on or after validFrom | 400 | The dates of the relation are in the wrong order. |
Counterparty not found | 404 | No counterparty with this code exists in the authenticated tenant. |
Relation not found | 404 | No relation with this id involves the counterparty in the path. |
The payers' shares would exceed 100% (110.00%) | 409 | Together, the payers of one counterparty cannot cover more than 100% of its invoices for the same dates. |
Internal server error | 500 | Unexpected server error. The JSON body includes correlationId. Retry with backoff. |
Idempotency-Key must be 8-255 characters: letters, digits, ".", "_", ":" or "-". | 400 | The Idempotency-Key header is present but malformed. |
A request with this Idempotency-Key is still being processed. | 409 | The first request with this key has not finished. Retry after it completes. code is idempotency_in_progress. |
This Idempotency-Key was already used with a different request body. | 422 | Send a new key for a different request. code is idempotency_key_reuse. |