Update counterparty
https://api.invunion.com/api/v1/counterparties/:code counterparties:write
Idempotency-Key
Markdown Update fields on a counterparty.
Partial update. Send only the fields you want to change. At least one updatable field is required. Country values are normalised to ISO 3166-1 alpha-2. payment_terms_days must be an integer between 0 and 365.
Path parameters
| Name | Type | Required |
|---|---|---|
codeCounterparty code ( Example: CPT-042 | string Max 50 | Required |
Body parameters
| Name | Type | Required |
|---|---|---|
name_originalLegal or source name. At least one body field is required. Example: Leones Cars | string Max 255 | Optional |
name_displayDisplay name shown in the product. Defaults to empty when omitted. Example: Leones Cars | string Max 255 | Optional |
account_codeYour account code. Unique per tenant. If omitted, Invunion assigns CPT-NNN. Example: CPT-042 | string Max 50 | Optional |
categoryLegal form of the counterparty. Default professional. | string Max 50 | Optional |
Allowed values individualprofessionalgovernmental | ||
payment_terms_daysPayment terms in days, 0 to 365. If omitted, tenant default applies. Example: 30 | integer | Optional |
is_supplierSupplier role. Default false. Allowed values truefalse | boolean | Optional |
is_clientClient role. Default true on create. Allowed values truefalse | boolean | Optional |
is_partnerPartner role. Default false. Allowed values truefalse | boolean | Optional |
is_payerPayer role. Default false. Allowed values truefalse | boolean | Optional |
is_internalInternal entity. Default false. Allowed values truefalse | boolean | Optional |
is_employeeEmployee. Default false. Allowed values truefalse | boolean | Optional |
external_referenceExternal reference. Your ERP or billing customer id. Used for identity lookup. Example: ERP-1842 | string Max 255 | Optional |
vat_numberVAT number. Used for identity lookup on import. Example: FR12345678901 | string Max 50 | Optional |
registration_numberNational ID (SIREN, company number, and similar). Example: 123456789 | string Max 100 | Optional |
electronic_addressE-invoicing address (Peppol and similar). Example: 0208:123456789 | string Max 255 | Optional |
addressStreet address. Example: 12 Grove Street | string No maximum | Optional |
cityCity. Example: Lyon | string Max 255 | Optional |
postal_codePostal code. Example: 69001 | string Max 20 | Optional |
countryCountry name or ISO 3166-1 alpha-2 code. Stored as alpha-2. Invalid values return 400 on create. Example: FR | string No maximum | Optional |
emailContact email. Example: [email protected] | string No maximum | Optional |
phonePhone number. Example: +33472000000 | string Max 50 | Optional |
analytic_1Analytic axis 1. Example: SALES-EU | string Max 100 | Optional |
analytic_2Analytic axis 2. Example: CHANNEL-DIRECT | string Max 100 | Optional |
metadataJSON object. At most 32 keys, nested depth 3, 8 KB serialized, and 64-character key names. Keys __proto__, constructor, and prototype are rejected. Example: {"erp_id":"C-1842"} | object | 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. |
No fields to update | 400 | The body did not contain any updatable field. |
Invalid country | 400 | country could not be normalised to an ISO 3166-1 alpha-2 code. |
payment_terms_days must be an integer between 0 and 365 | 400 | payment_terms_days is missing, not an integer, or out of range. |
Counterparty not found | 404 | No counterparty with this code exists in the authenticated tenant. |
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. |