# Update Customer Account

### Headers

`X-API-KEY` **must** be provided when making the request to update a Customer.&#x20;

### Request

`POST https://book.imin.co/api/v2/customer-accounts/:customerIdentifier/actions`

{% hint style="warning" %}
This request must be made Server-side. Otherwise, it would be possible to view the secret API key with a browser.
{% endhint %}

Body (example):

```javascript
{
  "@context": "https://openactive.io/",
  "@type": "CustomerUpdateAction",
  "object": { // Includes all properties that are attempted to be updated
    "@type": "Person",
    "email": "geoffcapes@example.com",
    "telephone": "020 811 8055",
    "givenName": "Geoff",
    "familyName": "Capes",
    "birthDate": "1970-01-01",
    "gender": "https://schema.org/Female",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "Raynes Park High School, 46A West Barnes Lane",
      "addressLocality": "New Malden",
      "addressRegion": "London",
      "postalCode": "NW5 3DU",
      "addressCountry": "GB"
    },
    "emergencyContact": {
      "@type": "Person",
      "name": "Ralph Capes",
      "telephone": "020 811 8055"
    }
  },
  "seller": [
    "https://id.bookingsystem.example.com/organizers/1"
  ]
}
```

All fields are optional for this request, but at least one is needed.

#### **seller**

List of Seller IDs. If this is included, then the updates (e.g. new `givenName`) won't only update the imin system, but imin will also send the updates to each of the Sellers specified.

This list should only include IDs of Sellers that this Customer has a connected [Linked Account](https://docs.imin.co/incorporating-book-and-pay/imin-booking-platform/customer-management/linked-accounts) with.&#x20;

### Response

A successful **HTTP 200** response contains:

* The Customer (with newly updated values)
* Any errors which may occurred in updating details in connected [Linked Accounts](https://docs.imin.co/incorporating-book-and-pay/imin-booking-platform/customer-management/linked-accounts) (`error`).

```javascript
{
  "@context": "https://openactive.io/",
  "@type": "CustomerUpdateAction",
  "actionStatus": "https://schema.org/CompletedActionStatus"
  "object": { // Contains only the properties that were successfully updated
    "@type": "Person",
    "email": "geoffcapes@example.com",
    "telephone": "020 811 8055",
    "givenName": "Geoff",
    "familyName": "Capes",
    "birthDate": "1970-01-01",
    "gender": "https://schema.org/Female",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "Raynes Park High School, 46A West Barnes Lane",
      "addressLocality": "New Malden",
      "addressRegion": "London",
      "postalCode": "NW5 3DU",
      "addressCountry": "GB"
    },
    "emergencyContact": {
      "@type": "Person",
      "name": "Ralph Capes",
      "telephone": "020 811 8055"
    }
  },
  "seller": [
    "https://id.bookingsystem.example.com/organizers/1"
  ],
  // 👇 This part only included when `seller` was included and
  // there were errors updating Linked Accounts.
  "error": [
    {
      "@type": "NotSupportedError",
      "instance": "https://schema.org/email",
      "description": "Updating email address outside of the booking system is not supported",
      "seller": { ... }
    },
    {
      "@type": "PropertyInvalidError",
      "instance": "https://schema.org/telephone",
      "description": "The phone number supplied was not valid",
      "seller": { ... }
    },
    {
      "@type": "AccessDeniedError",
      "instance": "https://schema.org/birthDate",
      "description": "Permission was not granted to update the date of birth",
      "seller": { ... }
    }
  ]
]
```
