# Customers

# Customer Index Endpoint

## Structure

See [View Customer Endpoint](https://support.aerocommerce.com/books/api/page/view-customer-endpoint) for the structure of the customer payload inside the `data` array.

## Filters

<table border="1" id="bkmrk-name-description-exa" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Description**  
</td><td>**Example**  
</td></tr><tr><td>`emails`</td><td>Only return customers with specific emails</td><td>`?emails=test@gmail.com,example@gmail.com`</td></tr><tr><td>`names`</td><td>Only return customers with specific names</td><td>`?names=Test,Another Test`</td></tr><tr><td>`groups`</td><td>Only return customers with specific groups</td><td>`?groups=VIP,Retail`</td></tr></tbody></table>

## Example Request

```
GET /api/customers?per_page=2
```

## Example Response

```json
{
    "current_page": 1,
    "data": [
        //...
    ],
    "first_page_url": "http://aero.test/api/customers?page=1",
    "from": 1,
    "last_page": 1,
    "last_page_url": "http://aero.test/api/customers?page=1",
    "next_page_url": null,
    "path": "http://aero.test/api/customers",
    "per_page": 2,
    "prev_page_url": null,
    "to": 1,
    "total": 1
}
```

<p class="callout info">See [View Customer Endpoint](https://support.aerocommerce.com/books/api/page/view-customer-endpoint) for the structure of the customer payload inside the `data` array.</p>

# View Customer Endpoint

## Structure

### Customer

<table border="1" id="bkmrk-name-type-descriptio" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the customer</td></tr><tr><td>`name`</td><td>string</td><td>The name of the customer</td></tr><tr><td>`email`</td><td>string</td><td>The email of the customer</td></tr><tr><td>`created_at`</td><td>timestamp</td><td>The date that the customer was created at</td></tr><tr><td>`group`</td><td>object</td><td>The group the customer belongs to, see [Group](https://support.aerocommerce.com/books/api/page/view-customer-endpoint#bkmrk-group)</td></tr><tr><td>`addresses`</td><td>array</td><td>An array of [Address](https://support.aerocommerce.com/books/api/page/view-customer-endpoint#bkmrk-address) objects</td></tr><tr><td>`tax_group`</td><td>object</td><td>The [Tax Group](https://support.aerocommerce.com/books/api/page/view-customer-endpoint#bkmrk-tax-group) of the customer</td></tr><tr><td>`additional_attributes`</td><td>object</td><td>An array of [Additional Attribute](https://support.aerocommerce.com/books/api/page/view-customer-endpoint#bkmrk-additional-attribute) objects</td></tr></tbody></table>

### Group

<table border="1" id="bkmrk-name-type-descriptio-1" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the customer group</td></tr><tr><td>`name`</td><td>string</td><td>The name of the customer group</td></tr><tr><td>`tax_group`</td><td>object</td><td>The tax group of the customer group, see [Tax Group](https://support.aerocommerce.com/books/api/page/view-customer-endpoint#bkmrk-tax-group)</td></tr></tbody></table>

### Address

<table border="1" id="bkmrk-name-type-descriptio-2" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`name`</td><td>string</td><td>The name of the address</td></tr><tr><td>`first_name`</td><td>string</td><td>The first name for the address</td></tr><tr><td>`last_name`</td><td>string</td><td>The last name for the address</td></tr><tr><td>`company`</td><td>string</td><td>The company for the address</td></tr><tr><td>`mobile`</td><td>string</td><td>The mobile number for the address</td></tr><tr><td>`phone`</td><td>string</td><td>The phone number for the address</td></tr><tr><td>`line_1`</td><td>string</td><td>The first line for the address</td></tr><tr><td>`line_2`</td><td>string</td><td>The second line for the address</td></tr><tr><td>`city`</td><td>string</td><td>The city for the address</td></tr><tr><td>`county`</td><td>string</td><td>The county for the address</td></tr><tr><td>`zone`</td><td>string</td><td>The zone code for the address</td></tr><tr><td>`postcode`</td><td>string</td><td>The postcode for the address</td></tr><tr><td>`country`</td><td>string</td><td>The country code for the address</td></tr><tr><td>`reference`</td><td>string</td><td>The **unique** reference for the address</td></tr><tr><td>`eori_number`</td><td>string</td><td>The EORI number for the address</td></tr><tr><td>`is_default`</td><td>boolean</td><td>Whether the address is default</td></tr></tbody></table>

### Tax Group

<table border="1" id="bkmrk-name-type-descriptio-3" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col><col style="width: 33.3731%;"></col></colgroup><tbody><tr><td>**Name**  
</td><td>**Type**  
</td><td>**Description**  
</td></tr><tr><td>`id`</td><td>int</td><td>The id of the customer tax group</td></tr><tr><td>`name`</td><td>string</td><td>The name of the customer tax group</td></tr></tbody></table>

### Additional Attributes

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

## Example Request

```
GET /api/customers/{id|email}
```

## Example Response

```json
{
    "id": 1,
    "name": "test test",
    "email": "test@gmail.com",
    "created_at": "2025-06-27T13:00:47.000000Z",
    "group": {
        "id": 1,
        "name": "test",
        "tax_group": {
            "id": 1,
            "name": "Retail Customer"
        }
    },
    "addresses": [
        {
            "id": 1,
            "name": null,
            "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": 0
        },
        {
            "id": 2,
            "name": null,
            "first_name": "test",
            "last_name": "test",
            "company": "test",
            "mobile": null,
            "phone": null,
            "line_1": "test",
            "line_2": null,
            "city": "test",
            "county": null,
            "zone": null,
            "postcode": "te57 10l",
            "country": "GB",
            "reference": null,
            "eori_number": null,
            "is_default": 1
        }
    ],
    "tax_group": null,
    "additional_attributes": []
}
```

# 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
    }
}
```

# Update 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>No</td></tr><tr><td>`email`</td><td>string</td><td>The email of the customer</td><td>No</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>`additional_attributes`</td><td>array</td><td>The additional attributes of the customer, see [Additional Attribute](https://support.aerocommerce.com/books/api/page/update-customer-endpoint/update-customer-endpoint#bkmrk-additional-attribute)</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

```
PUT /api/customers/{id|email}
```

```json
{
    "name": "Test",
    "email": "test@gmail.com",
    "group": "Group Name",
    "additional_attributes": [
        {
            "key": "last-api-update",
            "value": "2023-09-01 09:29:41"
        }
    ]
}
```

## Example Response

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