Update counterparty

PATCH https://api.invunion.com/api/v1/counterparties/:code counterparties:write 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

NameTypeRequired
code

Counterparty code (`account_code`).

Example: CPT-042

string

Max 50

Required

Body parameters

NameTypeRequired
name_original

Legal or source name. At least one body field is required.

Example: Leones Cars

string

Max 255

Optional
name_display

Display name shown in the product. Defaults to empty when omitted.

Example: Leones Cars

string

Max 255

Optional
account_code

Your account code. Unique per tenant. If omitted, Invunion assigns CPT-NNN.

Example: CPT-042

string

Max 50

Optional
category

Legal form of the counterparty. Default professional.

string

Max 50

Optional
Allowed valuesindividualprofessionalgovernmental
payment_terms_days

Payment terms in days, 0 to 365. If omitted, tenant default applies.

Example: 30

integer
Optional
is_supplier

Supplier role. Default false.

Allowed valuestruefalse
boolean
Optional
is_client

Client role. Default true on create.

Allowed valuestruefalse
boolean
Optional
is_partner

Partner role. Default false.

Allowed valuestruefalse
boolean
Optional
is_payer

Payer role. Default false.

Allowed valuestruefalse
boolean
Optional
is_internal

Internal entity. Default false.

Allowed valuestruefalse
boolean
Optional
is_employee

Employee. Default false.

Allowed valuestruefalse
boolean
Optional
external_reference

External reference. Your ERP or billing customer id. Used for identity lookup.

Example: ERP-1842

string

Max 255

Optional
vat_number

VAT number. Used for identity lookup on import.

Example: FR12345678901

string

Max 50

Optional
registration_number

National ID (SIREN, company number, and similar).

Example: 123456789

string

Max 100

Optional
electronic_address

E-invoicing address (Peppol and similar).

Example: 0208:123456789

string

Max 255

Optional
address

Street address.

Example: 12 Grove Street

string

No maximum

Optional
city

City.

Example: Lyon

string

Max 255

Optional
postal_code

Postal code.

Example: 69001

string

Max 20

Optional
country

Country name or ISO 3166-1 alpha-2 code. Stored as alpha-2. Invalid values return 400 on create.

Example: FR

string

No maximum

Optional
email

Contact email.

Example: carl@leonescars.fr

string

No maximum

Optional
phone

Phone number.

Example: +33472000000

string

Max 50

Optional
analytic_1

Analytic axis 1.

Example: SALES-EU

string

Max 100

Optional
analytic_2

Analytic axis 2.

Example: CHANNEL-DIRECT

string

Max 100

Optional
metadata

JSON 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 Wait and retry. The Retry-After header is the number of seconds to wait.
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.