Create counterparty

POST https://api.invunion.com/api/v1/counterparties counterparties:write Markdown

Create a counterparty.

Creates a customer, supplier, or other third party. name_original is required. If account_code is omitted, Invunion assigns the next CPT-NNN code. By default an empty Default catalog payment method is created. Send payment_method with iban or identifier to also create a catalog instrument linked to this counterparty. Catalog conflicts (aggregator IBAN, exclusive elsewhere) do not roll back the counterparty.

Body parameters

NameTypeRequired
name_original

Legal or source name. This is the only required field. Also accepted as name in bulk import.

Example: Leones Cars

string

Max 255

Required
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

Recommended
category

Legal form of the counterparty. Default professional.

string

Max 50

Recommended
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
createDefaultPaymentMethod

If false, skip the empty Default catalog payment method. Default true. Independent of payment_method.

Allowed valuestruefalse
boolean
Optional
payment_method

Optional catalog instrument on this new counterparty. Same fields as POST /payment-methods except counterparty_id (implied). Requires iban or identifier. Aggregator IBANs and exclusive instruments owned elsewhere are skipped; the counterparty is still created.

object
Recommended
name

Instrument display name. Defaults to name_original.

Example: Leones Cars EUR

string

Max 255

Optional
iban

IBAN. Required unless identifier is set. Unique per tenant catalog. BIC alone is not enough.

Example: FR7630006000011234567890189

string

Max 50

Recommended
identifier

Non-IBAN instrument key (PayPal email, wallet id, terminal number). Required unless iban is set. Unique per tenant catalog.

Example: carl@leonescars.fr

string

Max 120

Optional
code

Your payment-method code. Unique per tenant. If omitted, Invunion assigns PM-NNN.

Example: PM-001

string

Max 50

Recommended
type

Instrument type. Default bank_account.

string

No maximum

Recommended
Allowed valuesbank_accountcredit_cardpaypalwerotwintcrypto_walletother
bic

BIC. Bank name and country are filled from the BIC directory when omitted.

Example: BNPAFRPP

string

Max 11

Optional
currency

ISO 4217 currency code. Default EUR.

Example: EUR

string

Max 3

Optional
association_mode

exclusive (one owner) or shared (several counterparties). Default exclusive. Applies only when creating a new catalog instrument; an existing shared IBAN stays shared.

Allowed valuesexclusiveshared
string

No maximum

Recommended
account_type

Optional account type label.

Example: checking

string

No maximum

Optional
bank_name

Bank name. Filled from BIC when omitted.

Example: BNP Paribas

string

No maximum

Optional
bank_country

ISO 3166-1 alpha-2 of the bank, not the counterparty country.

Example: FR

string

No maximum

Optional
status

Instrument status. Default active.

string

No maximum

Optional
Allowed valuesactiveinactiveerror
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_pm":"BANK-042"}

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.
name_original is required 400 The body does not include name_original.
Invalid association_mode 400 association_mode is not exclusive or shared.
Invalid country 400 country could not be normalised to an ISO 3166-1 alpha-2 code.
Tenant ID required 400 The authenticated credential is not bound to a tenant.
Counterparty with this name already exists 409 A unique constraint on the tenant rejected the insert.
Internal server error 500 Unexpected server error. The JSON body includes correlationId. Retry with backoff.