Added

New endpoints: create and update a customer, and list electronic billing addresses

We're introducing two new endpoints to create and update a customer of any type, company or individual. We're also adding a third endpoint to list the electronic billing addresses of a company customer.

New endpoints:

Create a customer

Route: POST api/external/v2/customers
Scope: customers:all

The customer_type field (company or individual) sets the type of the customer.

Customer typeRequired fields
companycustomer_type, name, billing_address
individualcustomer_type, first_name, last_name, billing_address
{
  "customer_type": "company",
  "name": "Acme Corp",
  "billing_address": {
    "address": "8 rue de la paix",
    "postal_code": "75002",
    "city": "Paris",
    "country_alpha2": "FR"
  }
}
{
  "customer_type": "individual",
  "first_name": "Jean",
  "last_name": "Dupont",
  "billing_address": {
    "address": "3 rue Victor Hugo",
    "postal_code": "69002",
    "city": "Lyon",
    "country_alpha2": "FR"
  }
}

The endpoint returns 201 with the created customer, including customer_type.

Update a customer

Route: PUT api/external/v2/customers/{id}
Scope: customers:all

Only the fields you send are updated. The other fields stay the same.

\You can change customer_type in the same call.

  • From company to individual, vat_number and reg_no are cleared. You must send first_name and last_name.
  • From individual to company, first_name and last_name are cleared. You must send name.
{
  "customer_type": "individual",
  "first_name": "Jean",
  "last_name": "Dupont"
}
{
  "customer_type": "company",
  "name": "Acme Corp",
  "vat_number": "FR12345678901",
  "reg_no": "123456789"
}

Electronic billing address

You can set the electronic billing address of a company customer with the electronic_billing_address field.

  • You can only set an address returned by the list endpoint, described below (GET api/external/v2/customers/:customer_id/electronic_billing_addresses).
    Any other value returns 422.
  • The saved address is cleared when reg_no or customer_type changes.
{
  "electronic_billing_address": "123456789_12345678912345"
}

In the future, these new endpoints will replace the current type-specific endpoints: api/external/v2/company_customers and api/external/v2/individual_customers .

List the electronic billing addresses of a customer

Route: GET api/external/v2/customers/{customer_id}/electronic_billing_addresses
Scopes: customers:all or customers:readonly

{
  "items": [
    { "electronic_billing_address": "123456789_12345678912345" }
  ],
  "has_more": false,
  "next_cursor": null
}

The endpoint returns all the addresses in one response. has_more is always false and next_cursor is always null.
The list is empty for an individual customer.