# Create a customer address

URL: https://docs.sparklayer.io/ignite/api/create-a-new-customer-address
Operation: `POST /v1/{siteEnv}/{siteId}/customers/{customer_external_id}/addresses` (operationId `createCustomerAddress`)
OpenAPI spec: https://docs.sparklayer.io/openapi/ignite.yaml

Create a new "address" for a customer on the specific platform.

`POST /v1/{siteEnv}/{siteId}/customers/{customer_external_id}/addresses`

> This is an Ignite endpoint: your integration service implements it and SparkLayer calls it.

### Request SparkLayer sends

```http
POST /v1/live/bobs-store/customers/CUS1234/addresses HTTP/1.1
Host: ignite.example.com
Content-Type: application/json

{
  "title": "Mr",
  "first_name": "Bob",
  "last_name": "Jones",
  "company": "Tom Jones Climbing Ltd",
  "address_line1": "Example Industrial Estate",
  "address_line2": "North Country",
  "city": "Cityland",
  "region_name": "California",
  "region_code": "CA",
  "postal_code": "12345",
  "country_code": "US",
  "phone": "+44 (0) 123456789",
  "is_default_shipping": true,
  "is_default_billing": true,
  "is_temporary": true
}
```

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `siteEnv` | string | Yes | The SparkLayer environment the request is for, such as `live`. Store it, with the site ID, when SparkLayer connects your platform. Example: `live` |
| `siteId` | string | Yes | The SparkLayer site ID the request is for, such as `bobs-store`. Store it, with the environment, when SparkLayer connects your platform. Length: min 1. Example: `bobs-store` |
| `customer_external_id` | string | Yes | The customer's ID on your platform. Length: min 1. Example: `CUS1234` |

### Request body (`application/json`) (required)

Address.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string \| null | | Length: max 30. |
| `first_name` | string \| null | | Length: max 50. |
| `last_name` | string \| null | | Length: max 50. |
| `company` | string \| null | | Length: max 128. |
| `address_line1` | string | | Length: max 255. |
| `address_line2` | string \| null | | Length: max 255. |
| `city` | string | | Length: max 128. |
| `region_name` | string \| null | | Length: max 128. |
| `region_code` | string \| null | | Length: max 10. |
| `postal_code` | string \| null | | Length: max 20. |
| `country_code` | string | | Two letter country code as defined by ISO 3166-2. Length: max 2. |
| `phone` | string | | Length: max 20. |
| `is_default_shipping` | boolean | | |
| `is_default_billing` | boolean | | |
| `is_temporary` | boolean | | Whether the address is temporary for the duration of a cart. This value is only relevant to platforms that create the order address automatically on order creation (or conversion from draft to normal order as in the case of our Shopify integration). In such cases we will want the integration to ensure this address does not get created in SparkLayer when the platform notifes the integration of a new customer address. |

```json
{
  "title": "Mr",
  "first_name": "Bob",
  "last_name": "Jones",
  "company": "Tom Jones Climbing Ltd",
  "address_line1": "Example Industrial Estate",
  "address_line2": "North Country",
  "city": "Cityland",
  "region_name": "California",
  "region_code": "CA",
  "postal_code": "12345",
  "country_code": "US",
  "phone": "+44 (0) 123456789",
  "is_default_shipping": true,
  "is_default_billing": true,
  "is_temporary": true
}
```

### Responses your service returns

#### 201: Successful Address

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string \| null | | Length: max 30. |
| `first_name` | string \| null | | Length: max 50. |
| `last_name` | string \| null | | Length: max 50. |
| `company` | string \| null | | Length: max 128. |
| `address_line1` | string | | Length: max 255. |
| `address_line2` | string \| null | | Length: max 255. |
| `city` | string | | Length: max 128. |
| `region_name` | string \| null | | Length: max 128. |
| `region_code` | string \| null | | Length: max 10. |
| `postal_code` | string \| null | | Length: max 20. |
| `country_code` | string | | Two letter country code as defined by ISO 3166-2. Length: max 2. |
| `phone` | string | | Length: max 20. |
| `is_default_shipping` | boolean | | |
| `is_default_billing` | boolean | | |
| `customer_address_external_id` | string | | eCommerce platform ID for the Customer Address. Length: max 50. |

```json
{
  "title": "Mr",
  "first_name": "Bob",
  "last_name": "Jones",
  "company": "Tom Jones Climbing Ltd",
  "address_line1": "Example Industrial Estate",
  "address_line2": "North Country",
  "city": "Cityland",
  "region_name": "California",
  "region_code": "CA",
  "postal_code": "12345",
  "country_code": "US",
  "phone": "+44 (0) 123456789",
  "is_default_shipping": true,
  "is_default_billing": true,
  "customer_address_external_id": "<customer_address_external_id>"
}
```

#### 401: Auth Failure

#### 500: System Exception
