# Customer

![](https://2604198532-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ljb6kldSmEV1tpebdRd%2F-LruCvTGKE0sxF9K9xmg%2F-LruD-Qxfb6CHfkqDnrA%2FResource%20Map%20-%20Customer.png?alt=media\&token=99f1c53a-a0d5-41b1-860b-c276867901b7)

### Customer Properties

| Field          | Description                                           |
| -------------- | ----------------------------------------------------- |
| `created_at`   | When a `Customer` was created on the Malomo Platform. |
| `email`        | Customer's email address.                             |
| `first_name`   | Customer's first name.                                |
| `id`           | Unique identifier for a `Customer`.                   |
| `last_name`    | Customer's last name.                                 |
| `phone_number` | Customer's phone number.                              |
| `updated_at`   | When a `Customer` was last updated.                   |

## Create a Customer

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

#### Request Body

| Name          | Type   | Description              |
| ------------- | ------ | ------------------------ |
| email         | string | Customer's email address |
| first\_name   | string | Customer's first name    |
| last\_name    | string | Customer's last name     |
| phone\_number | string | Customer's phone number  |

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

```javascript
{
  "created_at": "2019-01-30T13:30:00Z",
  "email": "johnny@rosevideo.com",
  "first_name": "Johnny",
  "id": "a0a877c6-4164-4e8a-8179-48f8d4752b4e",
  "last_name": "Rose",
  "phone_number": "555-555-5555",
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve a Customer

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

#### Path Parameters

| Name | Type   | Description                               |
| ---- | ------ | ----------------------------------------- |
| id   | string | Unique identifier of the desired customer |

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

```javascript
{
  "created_at": "2019-01-30T13:30:00Z",
  "email": "johnny@rosevideo.com",
  "first_name": "Johnny",
  "id": "a0a877c6-4164-4e8a-8179-48f8d4752b4e",
  "last_name": "Rose",
  "phone_number": "555-555-5555",
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Retrieve a List of Customers

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

#### Query Parameters

| Name | Type   | Description                               |
| ---- | ------ | ----------------------------------------- |
| prev | string | Retrieve customers after a given cursor.  |
| next | string | Retrieve customers before a given cursor. |

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

```javascript
[
  {
    "created_at": "2019-01-30T13:30:00Z",
    "email": "johnny@rosevideo.com",
    "first_name": "Johnny",
    "id": "a0a877c6-4164-4e8a-8179-48f8d4752b4e"
    "last_name": "Rose",
    "phone_number": "555-555-5555",
    "updated_at": "2019-01-30T13:30:00Z"
  }
]
```

{% endtab %}
{% endtabs %}

## Update a Customer

<mark style="color:orange;">`PUT`</mark> `https://api.gomalomo.com/customers/:id`

#### Path Parameters

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| id   | string | Unique identifier of the customer to update |

#### Request Body

| Name          | Type   | Description              |
| ------------- | ------ | ------------------------ |
| email         | string | Customer's email address |
| first\_name   | string | Customer's first name    |
| last\_name    | string | Customer's last name     |
| phone\_number | string | Customer's phone number  |

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

```javascript
{
  "created_at": "2019-01-30T13:30:00Z",
  "email": "johnny@rosevideo.com",
  "first_name": "Johnny",
  "id": "a0a877c6-4164-4e8a-8179-48f8d4752b4e",
  "last_name": "Rose",
  "phone_number": "555-555-5555",
  "updated_at": "2019-01-30T13:30:00Z"
}
```

{% endtab %}
{% endtabs %}

## Delete a Customer

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

#### Path Parameters

| Name | Type   | Description                                 |
| ---- | ------ | ------------------------------------------- |
| id   | string | Unique identifier of the customer to delete |

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

{% endtab %}
{% endtabs %}

## Retrieve a List of Customer Events

<mark style="color:blue;">`GET`</mark> `https://api.gomalomo.com/customers/:customer_id/events`

#### Path Parameters

| Name         | Type   | Description                                       |
| ------------ | ------ | ------------------------------------------------- |
| customer\_id | string | Unique id of the Customer to retrieve events for. |

#### Query Parameters

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| prev | string | Retrieve events before a given cursor. |
| next | string | Retrieve events after a given cursor.  |

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

```javascript
[
  {
    "created_at": "2019-01-30T13:30:00Z",
    "id": "1a3c1090-efd1-11eb-9a03-0242ac130003",
    "label": "Order #1000 fulfilled",
    "link_back_url": "https://goodest-boi.myshopify.com/admin/orders/5555555555555",
    "properties": {
      "shopify_order": {
        "id": "5555555555555"
      }
    },
    "timestamp": 1548855000
    "type": "ShopifyOrderFulfilled",
    "updated_at": "2019-01-30T13:30:00Z",
  }
]
```

{% endtab %}
{% endtabs %}
