**Version: 202201**

# Update Customer

**PUT** `/openapi/2022-01/customers/:id`

Update the details of an existing customer using its unique identifier.

## Request

**Path Parameters**

- `id` string (required)

  Customer's ID

**application/json**

**Body | Example**

**Body**

- `customer` object

  - `first_name` string
  - `last_name` string
  - `accepts_marketing` boolean

    Whether to subscribe marketing email campaign

    **Default value:** `true`
  - `accepts_sms_marketing` boolean

    Whether to subscribe marketing sms campaign

    **Default value:** `true`
  - `tags` string

    Tags, e.g. `New Customer,Repeat Customer`

```json
{
  "customer": {
    "first_name": "string",
    "last_name": "string",
    "accepts_marketing": true,
    "accepts_sms_marketing": true,
    "tags": "string"
  }
}
```

## Responses

**200 | 400 | 404**

200

**application/json**

**Schema | Example | Result**

**Schema**

- `customer` object

  - `id` string

    **Example:** `2dd957e3-2051-4cdf-8584-9c0046b4d1ae`
  - `first_name` string

    **Example:** `ryan`
  - `last_name` string

    **Example:** `zhang`
  - `name` string

    **Example:** `ryan zhang`
  - `email` string

    **Example:** `test@shoplazza.com`
  - `phone` string

    **Example:** `+8615014471143`
  - `phone_area_code`
  - `contact_type` string

    **Example:** `email`
  - `accepts_marketing` boolean

    **Default value:** `true`

    **Example:** `true`
  - `source`
  - `free_tax` boolean

    **Default value:** `true`

    **Example:** `false`
  - `registered` boolean

    **Default value:** `true`

    **Example:** `false`
  - `orders_count` integer

    **Default value:** `0`

    **Example:** `0`
  - `last_order_at`
  - `total_spent` string

    **Example:** `0.00`
  - `tags` string

    **Example:** `New Customer`
  - `created_at` string

    **Example:** `2024-04-17T11:10:33Z`
  - `updated_at` string

    **Example:** `2024-04-17T11:10:33Z`
  - `subscribed_flag` integer

    **Default value:** `0`

    **Example:** `5`
  - `sms_subscribed_flag` integer

    **Default value:** `0`

    **Example:** `5`
  - `accepts_sms_marketing` boolean

    **Default value:** `true`

    **Example:** `true`
  - `default_address` object

    - `id` string

      **Example:** `9ffa8dc0-25b8-4424-832e-bab46fcfeb20`
    - `customer_id` string

      **Example:** `2dd957e3-2051-4cdf-8584-9c0046b4d1ae`
    - `first_name` string

      **Example:** `test`
    - `last_name` string

      **Example:** `test`
    - `company` string

      **Example:**
    - `city` string

      **Example:** `深圳`
    - `province` string

      **Example:**
    - `country` string

      **Example:** `Aland lslands`
    - `zip` string

      **Example:** `515300`
    - `province_code` string

      **Example:**
    - `country_code` string

      **Example:** `AX`
    - `gender` string

      **Example:**
    - `phone` string

      **Example:** `+86 150 1447 1143`
    - `phone_area_code`
    - `area` string

      **Example:**
    - `email` string

      **Example:** `test@shoplazza.com`
    - `name` string

      **Example:** `test test`
    - `address1` string

      **Example:** `6 三聖街`
    - `address2` string

      **Example:** `1111`
    - `country_name` string

      **Example:** `Aland lslands`
    - `default` boolean

      **Default value:** `true`

      **Example:** `true`
  - `addresses` object[]

    *   Array [

    - `id` string

      **Example:** `9ffa8dc0-25b8-4424-832e-bab46fcfeb20`
    - `customer_id` string

      **Example:** `2dd957e3-2051-4cdf-8584-9c0046b4d1ae`
    - `first_name` string

      **Example:** `test`
    - `last_name` string

      **Example:** `test`
    - `company` string

      **Example:**
    - `city` string

      **Example:** `深圳`
    - `province` string

      **Example:**
    - `country` string

      **Example:** `Aland lslands`
    - `zip` string

      **Example:** `515300`
    - `province_code` string

      **Example:**
    - `country_code` string

      **Example:** `AX`
    - `gender` string

      **Example:**
    - `phone` string

      **Example:** `+86 150 1447 1143`
    - `phone_area_code`
    - `area` string

      **Example:**
    - `email` string

      **Example:** `test@shoplazza.com`
    - `name` string

      **Example:** `test test`
    - `address1` string

      **Example:** `6 三聖街`
    - `address2` string

      **Example:** `1111`
    - `country_name` string

      **Example:** `Aland lslands`
    - `default` boolean

      **Default value:** `true`

      **Example:** `true`
    *   ]

```json
{
  "customer": {
    "id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
    "first_name": "ryan",
    "last_name": "zhang",
    "name": "ryan zhang",
    "email": "test@shoplazza.com",
    "phone": "+8615014471143",
    "phone_area_code": {},
    "contact_type": "email",
    "accepts_marketing": true,
    "source": {},
    "free_tax": false,
    "registered": false,
    "orders_count": 0,
    "last_order_at": {},
    "total_spent": "0.00",
    "tags": "New Customer",
    "created_at": "2024-04-17T11:10:33Z",
    "updated_at": "2024-04-17T11:10:33Z",
    "subscribed_flag": 5,
    "sms_subscribed_flag": 5,
    "accepts_sms_marketing": true,
    "default_address": {
      "id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
      "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
      "first_name": "test",
      "last_name": "test",
      "company": "",
      "city": "深圳",
      "province": "",
      "country": "Aland lslands",
      "zip": "515300",
      "province_code": "",
      "country_code": "AX",
      "gender": "",
      "phone": "+86 150 1447 1143",
      "phone_area_code": {},
      "area": "",
      "email": "test@shoplazza.com",
      "name": "test test",
      "address1": "6 三聖街",
      "address2": "1111",
      "country_name": "Aland lslands",
      "default": true
    },
    "addresses": [
      {
        "id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
        "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
        "first_name": "test",
        "last_name": "test",
        "company": "",
        "city": "深圳",
        "province": "",
        "country": "Aland lslands",
        "zip": "515300",
        "province_code": "",
        "country_code": "AX",
        "gender": "",
        "phone": "+86 150 1447 1143",
        "phone_area_code": {},
        "area": "",
        "email": "test@shoplazza.com",
        "name": "test test",
        "address1": "6 三聖街",
        "address2": "1111",
        "country_name": "Aland lslands",
        "default": true
      }
    ]
  }
}
```

```json
{
  "customer": {
    "id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
    "first_name": "ryan",
    "last_name": "zhang",
    "name": "ryan zhang",
    "email": "test@shoplazza.com",
    "phone": "+8615014471143",
    "phone_area_code": null,
    "contact_type": "email",
    "accepts_marketing": true,
    "source": null,
    "free_tax": false,
    "registered": false,
    "orders_count": 0,
    "last_order_at": null,
    "total_spent": "0.00",
    "tags": "New Customer",
    "created_at": "2024-04-17T11:10:33Z",
    "updated_at": "2024-04-17T11:10:33Z",
    "subscribed_flag": 5,
    "sms_subscribed_flag": 5,
    "accepts_sms_marketing": true,
    "default_address": {
      "id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
      "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
      "first_name": "test",
      "last_name": "test",
      "company": "",
      "city": "深圳",
      "province": "",
      "country": "Aland lslands",
      "zip": "515300",
      "province_code": "",
      "country_code": "AX",
      "gender": "",
      "phone": "+86 150 1447 1143",
      "phone_area_code": null,
      "area": "",
      "email": "test@shoplazza.com",
      "name": "test test",
      "address1": "6 三聖街",
      "address2": "1111",
      "country_name": "Aland lslands",
      "default": true
    },
    "addresses": [
      {
        "id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
        "customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
        "first_name": "test",
        "last_name": "test",
        "company": "",
        "city": "深圳",
        "province": "",
        "country": "Aland lslands",
        "zip": "515300",
        "province_code": "",
        "country_code": "AX",
        "gender": "",
        "phone": "+86 150 1447 1143",
        "phone_area_code": null,
        "area": "",
        "email": "test@shoplazza.com",
        "name": "test test",
        "address1": "6 三聖街",
        "address2": "1111",
        "country_name": "Aland lslands",
        "default": true
      }
    ]
  }
}
```

400

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    ""
  ]
}
```

```json
{
  "errors": [
    ""
  ]
}
```

404

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "Record not found"
  ]
}
```

```json
{
  "errors": [
    "Record not found"
  ]
}
```
