# Update customer addresses

> `PATCH https://api.kustom.co/ordermanagement/v1/orders/{order_id}/customer-details`

Update shipping address. Read more on [Updating customer addresses](https://docs.kustom.co/contents/order-management/manage-orders-with-the-api/view-and-change-orders#update-shipping-address)

## Parameters

- `order_id` (string, path, required) — Order id
- `Klarna-Idempotency-Key` (string, header) — This header will guarantee the idempotency of the operation. The key should be unique and is recommended to be a UUID version 4. Retries of requests are safe to be applied in case of errors such as network errors, socket errors and timeouts. Input values of the operation are disregarded when evaluating the idempotency of the operation, only the key matters.

## Request body

`application/json`

- `shipping_address` (object) — Shipping address for the capture.
  - `attention` (string) — 'Attn.' - optional parameter.
  - `city` (string) — City.
  - `country` (string) — Country. ISO 3166 alpha-2.
  - `email` (string) — E-mail address.
  - `family_name` (string) — Family name.
  - `given_name` (string) — Given name.
  - `organization_name` (string) — Organization name (if applicable). Only applicable for B2B customers.
  - `phone` (string) — Phone number.
  - `postal_code` (string) — Postcode. Validation according to [Universal Postal Union addressing system](https://www.upu.int/en/activities/addressing/postal-addressing-systems-in-member-countries.html).
  - `region` (string) — State/Region. Required for US.
  - `street_address` (string) — First line of street address. Validation according to [Universal Postal Union addressing system](https://www.upu.int/en/activities/addressing/postal-addressing-systems-in-member-countries.html)
  - `street_address2` (string) — Second line of street address.
  - `title` (string) — Title.

### Example request

```json
{
  "shipping_address": {
    "attention": "Anders Exempelsson",
    "city": "Vetlanda",
    "country": "se",
    "email": "john.testsson@kustom.co",
    "family_name": "Testsson",
    "given_name": "John",
    "organization_name": "Kustom",
    "phone": "1-555-555-5555",
    "postal_code": 12345,
    "region": "TN",
    "street_address": "Testgatan 10",
    "street_address2": 1,
    "title": "Herr"
  }
}
```

## Responses

### 204

Order consumer details were updated.

`application/json`

```json
"<string>"
```

### 403

Update customer details not allowed. Decision is based on order state and outcome of risk assessment. Billing address cannot be updated.

`application/json`

- `correlation_id` (string) — Correlation id. For searching logs.
- `error_code` (string) — Error code
- `error_messages[]` (array<string>) — Error messages

```json
{
  "correlation_id": "66782175-ae05-44fc-9eb3-eeceadbad271",
  "error_code": "NOT_ALLOWED",
  "error_messages": [
    "<string>"
  ]
}
```

### 404

Not Found

`*/*`

- `correlation_id` (string)
- `error_code` (string) Enum: `INTERNAL_ERROR`, `NOT_FOUND`, `TOO_MANY_REQUESTS`, `REFUND_NOT_ALLOWED`, `CAPTURE_NOT_ALLOWED`, `CANCEL_NOT_ALLOWED`, `UPDATE_NOT_ALLOWED`, `NO_SUCH_ORDER`, `BAD_REQUEST`, `PAYLOAD_TOO_LARGE`, `NO_SUCH_CAPTURE`, `RESOURCE_NOT_FOUND`, `INVALID_REQUEST_PARAMETERS`, `NOT_ALLOWED`, `UNSUPPORTED_MEDIA_TYPE`, `FORBIDDEN`.
- `error_messages[]` (array<string>)

```json
{
  "correlation_id": "<string>",
  "error_code": "INTERNAL_ERROR",
  "error_messages": [
    "<string>"
  ]
}
```

### 409

Conflict

`*/*`

```json
"<string>"
```

### Errors

| Code | Status | What it means | Retry |
| --- | --- | --- | --- |
| `UPDATE_NOT_ALLOWED` | 403 | The order's state or risk assessment does not allow changing its amount or address. Needs `AUTHORIZED`. | Never retry |
