# Create Customer Endpoint

#### Structure

##### Customer

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id for the customer</td><td>No</td></tr><tr><td>`name`</td><td>string</td><td>The name of the customer</td><td>Yes</td></tr><tr><td>`email`</td><td>string</td><td>The email of the customer</td><td>Yes</td></tr><tr><td>`password`</td><td>string</td><td>The plain-text password of the customer</td><td>Conditional `*`</td></tr><tr><td>`password_hash`</td><td>string</td><td>The hashed password of the customer</td><td>Conditional `*`</td></tr><tr><td>`group`</td><td>string</td><td>The group name of the customer</td><td>No</td></tr><tr><td>`tax_group`</td><td>string</td><td>The tax group name of the customer</td><td>No</td></tr><tr><td>`addresses`</td><td>array</td><td>The addresses of the customer, see [Address](https://support.aerocommerce.com/books/api/page/create-customer-endpoint#bkmrk-address)</td><td>No</td></tr><tr><td>`additional_attributes`</td><td>array</td><td>The additional attributes of the customer, see [Additional Attribute](https://support.aerocommerce.com/books/api/page/create-customer-endpoint#bkmrk-additional-attribute)</td><td>No</td></tr></tbody></table>

`*` One of password or password\_hash must be provided. Using password\_hash is recommended. Ensure the hashing algorithm matches the store’s configuration (usually bcrypt).

##### Address

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`name`</td><td>string</td><td>The name of the address</td><td>No</td></tr><tr><td>`first_name`</td><td>string</td><td>The first name for the address</td><td>Yes</td></tr><tr><td>`last_name`</td><td>string</td><td>The last name for the address</td><td>Yes</td></tr><tr><td>`company`</td><td>string</td><td>The company for the address</td><td>No</td></tr><tr><td>`mobile`</td><td>string</td><td>The mobile number for the address</td><td>No</td></tr><tr><td>`phone`</td><td>string</td><td>The phone number for the address</td><td>No</td></tr><tr><td>`line_1`</td><td>string</td><td>The first line for the address</td><td>Yes</td></tr><tr><td>`line_2`</td><td>string</td><td>The second line for the address</td><td>No</td></tr><tr><td>`city`</td><td>string</td><td>The city for the address</td><td>Yes</td></tr><tr><td>`county`</td><td>string</td><td>The county for the address</td><td>No</td></tr><tr><td>`zone`</td><td>string</td><td>The zone code for the address, required for some countries (e.g., US, AU, etc)</td><td>Conditional</td></tr><tr><td>`postcode`</td><td>string</td><td>The postcode for the address, required for some countries (e.g., GB, US, etc)</td><td>Conditional</td></tr><tr><td>`country`</td><td>string</td><td>The country code for the address</td><td>Yes</td></tr><tr><td>`reference`</td><td>string</td><td>The **unique** reference for the address</td><td>No</td></tr><tr><td>`eori_number`</td><td>string</td><td>The EORI number for the address</td><td>No</td></tr><tr><td>`is_default`</td><td>boolean</td><td>Whether the address is default</td><td>No</td></tr></tbody></table>

##### Additional Attribute

<table border="1" id="bkmrk-name-type-descriptio-2" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col><col style="width: 25.0298%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td><td>**Required**  
</td></tr><tr><td>`key`</td><td>string</td><td>The key of the additional attribute</td><td>Yes</td></tr><tr><td>`value`</td><td>string</td><td>The value of the additional attribute</td><td>Yes</td></tr></tbody></table>

#### Example Request

```
POST /api/customers
```

```json
{
    "name": "Test",
    "email": "test@gmail.com",
    "password_hash": "$2y$10$0QFHb4QU0wAsaskZPQv0Re72Xa2KXrWt5YR32O5aBxIwc0c41bbwm",
    "group": "Group Name",
    "addresses": [
        {
            "name": "API Address",
            "first_name": "test",
            "last_name": "test",
            "company": "test",
            "mobile": null,
            "phone": null,
            "line_1": "test",
            "line_2": null,
            "city": "test",
            "county" : "Test",
            "zone": null,
            "postcode": "te57 10l",
            "country": "GB",
            "reference": null,
            "eori_number": null,
            "is_default": true
        }
    ],
    "additional_attributes": [
        {
            "key": "api",
            "value": "true"
        }
    ]
}
```

#### Example Response

```json
{
    "customer": {
        "id": 1
    }
}
```