# Customers

## All Customers

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/customers`

Retrieve all customers

#### Path Parameters

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
| page | integer | Results are paginated. |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 Returns an array of members. Only the first 20 are returned. Passing the page param will paginate the results.
" %}

```javascript
[
    {
        "id": 1976,
        "first_name": "api",
        "last_name": "test",
        "email": "anothertest@sdsdsd.com",
        "created_at": "2019-10-17T11:20:05.223-04:00",
        "updated_at": "2019-10-17T11:20:05.223-04:00",
        "avatar_data": null,
        "stripe_customer_id": null,
        "vat_number": null,
        "address": null,
        "zipcode": null,
        "city": null,
        "state": null,
        "country": null
    },
    {
        "id": 1974,
        "first_name": "api",
        "last_name": "test",
        "email": "apitest@sdsdsd.com",
        "created_at": "2019-10-16T17:34:43.302-04:00",
        "updated_at": "2019-10-16T17:34:43.302-04:00",
        "avatar_data": null,
        "stripe_customer_id": null,
        "vat_number": null,
        "address": null,
        "zipcode": null,
        "city": null,
        "state": null,
        "country": null
    }
]
```

{% endtab %}
{% endtabs %}

## Show Customer

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/customers/:id`

Retrieve a single member

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 " %}

```javascript
    {
        "id": 33,
        "internal_coupon_id": "englishtea",
        "coupon_type": "coupon",
        "currency": "USD",
        "duration": "once",
        "duration_in_months": null,
        "max_redemptions": null,
        "amount_off": 6000,
        "percent_off": null,
        "redeem_by": null,
        "eligible_types": [
            "orders"
        ],
        "created_at": "2020-05-14T13:47:54.567-04:00",
        "updated_at": "2020-09-08T12:28:49.246-04:00",
        "supported_countries": [],
        "metadata": "{}",
        "coupons_orders_count": 0
    },
```

{% endtab %}

{% tab title="404 " %}

```ruby
null
```

{% endtab %}
{% endtabs %}

## Create Customer

<mark style="color:green;">`POST`</mark> `https://yoursite.mavenseed.com/api/v1/customers`

Create a customer.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth Token  |

#### Request Body

| Name                 | Type   | Description                            |
| -------------------- | ------ | -------------------------------------- |
| first\_name          | string | Customer first name                    |
| last\_name           | string | Customer last name                     |
| email                | string | Email of customer                      |
| avatar\_data         | string | Hash of avatar image data (n/a in API) |
| stripe\_customer\_id | string | Stripe Customer ID                     |
| vat\_number          | string | VAT Business number                    |
| address              | string | Customer address                       |
| zipcode              | string | Customer zipcode                       |
| city                 | string | Customer city                          |
| state                | string | Customer state (2 letter iso code)     |
| country              | string | Customer country (2 letter iso code)   |

{% tabs %}
{% tab title="201 " %}

```ruby
{
    "id": 1976,
    "first_name": "api",
    "last_name": "test",
    "email": "anothertest@sdsdsd.com",
    "created_at": "2019-10-17T11:20:05.223-04:00",
    "updated_at": "2019-10-17T11:20:05.223-04:00",
    "avatar_data": null,
    "stripe_customer_id": null,
    "vat_number": null,
    "address": null,
    "zipcode": null,
    "city": null,
    "state": null,
    "country": null
}
```

{% endtab %}
{% endtabs %}

## Update Customer

<mark style="color:purple;">`PATCH`</mark> `https://yoursite.mavenseed.com/api/v1/customers/:id`

Update a single customer. All of the above properties in create customer are valid.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 " %}

```ruby
{
    "id": 1976,
    "first_name": "api",
    "last_name": "test",
    "email": "anothertest@sdsdsd.com",
    "created_at": "2019-10-17T11:20:05.223-04:00",
    "updated_at": "2019-10-17T11:20:05.223-04:00",
    "avatar_data": null,
    "stripe_customer_id": null,
    "vat_number": null,
    "address": null,
    "zipcode": null,
    "city": null,
    "state": null,
    "country": null
}
```

{% endtab %}
{% endtabs %}

## Delete a Customer

<mark style="color:red;">`DELETE`</mark> `https://yoursite.mavenseed.com/api/v1/customers/:id`

Delete a customer.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token. |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}
