# Customers
Customers are the targeted buyers that buy from your business.
# The Customer Object
# Sample
{
"house_account_balance": 0,
"loyalty_balance": 0,
"tags": [
{
"id": "fhhsd8r5"
}
],
"id": "8d831",
"name": "James Lapda",
"dial_code": 966,
"phone": "565445254",
"email": "m.steuber@ecs.net",
"gender": 1,
"birth_date": "1986-09-17",
"is_blacklisted": false,
"is_house_account_enabled": true,
"house_account_limit": 1000,
"is_loyalty_enabled": 1,
"created_at": "2019-04-22 14:18:54",
"updated_at": "2019-05-02 10:14:49",
"deleted_at": null,
"last_order_at": "2019-11-27 09:40:35",
"order_count": 3,
"addresses": [
{
"id": "8d92cc27",
"delivery_zone": {
"id": "8d86ac81"
}
}
]
}
# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the customer. | |
name | string | updatable | Name of the customer. |
dial_code | integer | updatable | Dial code of the phone of the customer. |
phone | string | updatable | Phone of the customer. |
email | string | nullable updatable | Email of the Customer. |
gender | integer | nullable updatable | Value 1 represents Male, while 2 represents female. |
birth_date | string | nullable updatable | Customer birthdate YYYY-MM-DD. |
house_account_limit | integer | nullable updatable | Returned when application has customers.accounts.read scope. Updatable when application has customers.accounts.write scope. |
house_account_balance | double | nullable | Returned when application has customers.accounts.read scope. |
loyalty_balance | double | nullable | Returned when application has customers.loyalty.read scope. |
is_loyalty_enabled | boolean | updatable | Determine if loyalty is enabled for the customer. Updatable when application has customers.loyalty.write scope. |
is_blacklisted | boolean | updatable | Determine if customer is blacklisted. |
is_house_account_enabled | boolean | updatable | Determine if house account is enabled for the customer. Updatable when application has customers.accounts.write scope. |
tags | array | updatable includable | List of Tag objects attached to the customer. |
addresses | array | includable | List of Customer Addresses objects attached to the customer. |
addresses.delivery_Zone | object | includable | The Delivery Zone objects attached to the customer. |
last_order_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC for the last order made by the customer |
order_count | integer | nullable | Count of customer orders |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the customer was created. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the customer was updated. |
deleted_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC at which the customer was deleted. |
# List Customers
GET /customers
# Scope
customers.list
# Filters
nameemailphonedial_codetags.idis_blacklistedis_house_account_enabledis_loyalty_enabledhas_ordersupdated_afteris_deleted
# Response
{
"data": [
{
"house_account_balance": 0,
"loyalty_balance": 0,
"tags": [
{
"id": "fhhsd8r5"
}
],
"id": "8d831",
"name": "James Lapda",
"dial_code": 966,
"phone": "565445254",
"email": "m.steuber@ecs.net",
"gender": 1,
"birth_date": "1986-09-17",
"is_blacklisted": false,
"is_house_account_enabled": true,
"house_account_limit": 1000,
"is_loyalty_enabled": 1,
"created_at": "2019-04-22 14:18:54",
"updated_at": "2019-05-02 10:14:49",
"deleted_at": null,
"last_order_at": "2019-11-27 09:40:35",
"order_count": 3,
"addresses": [
{
"id": "8d92cc27"
}
]
}
]
}
# Get Customer
GET /customers/{customerId}
# Scope
customers.get
# Response
{
"data": {
"house_account_balance": 0,
"loyalty_balance": 0,
"tags": [
{
"id": "fhhsd8r5"
}
],
"id": "8d831",
"name": "James Lapda",
"dial_code": 966,
"phone": "565445254",
"email": "m.steuber@ecs.net",
"gender": 1,
"birth_date": "1986-09-17",
"is_blacklisted": false,
"is_house_account_enabled": true,
"house_account_limit": 1000,
"is_loyalty_enabled": 1,
"created_at": "2019-04-22 14:18:54",
"updated_at": "2019-05-02 10:14:49",
"deleted_at": null,
"last_order_at": "2019-11-27 09:40:35",
"order_count": 3,
"addresses": [
{
"id": "8d92cc27",
"delivery_zone": {
"id": "8d86ac81"
}
}
]
}
}
# Create Customer
POST /customers
# Scope
customers.write
# Request
{
"name": "Simona",
"dial_code": 1,
"phone": "1234567890",
"email": "simona@example.net",
"gender": 1,
"birth_date": "2016-09-17",
"house_account_limit": 100,
"house_account_balance": 300,
"is_loyalty_enabled": false,
"is_blacklisted": false,
"is_house_account_enabled": true,
"tags": [
{
"id": "8d06aaa0"
}
]
}
# Response
{
"data": {
"house_account_balance": 0,
"loyalty_balance": 0,
"tags": [
{
"id": "fhhsd8r5"
}
],
"id": "8d831",
"name": "James Lapda",
"dial_code": 966,
"phone": "565445254",
"email": "m.steuber@ecs.net",
"gender": 1,
"birth_date": "1986-09-17",
"is_blacklisted": false,
"is_house_account_enabled": true,
"house_account_limit": 1000,
"is_loyalty_enabled": 1,
"created_at": "2019-04-22 14:18:54",
"updated_at": "2019-05-02 10:14:49",
"deleted_at": null,
"last_order_at": "2019-11-27 09:40:35",
"order_count": 3,
"addresses": [
{
"id": "8d92cc27",
"delivery_zone": {
"id": "8d86ac81"
}
}
]
}
}
# Update Customer
PUT /customers/{customerId}
# Scope
customers.write
# Request
{
"name": "Simona",
"dial_code": 1,
"phone": "1234567890",
"email": "simona@example.net",
"gender": 1,
"birth_date": "2016-09-17",
"house_account_limit": 100,
"house_account_balance": 300,
"is_loyalty_enabled": false,
"is_blacklisted": false,
"is_house_account_enabled": true,
"tags": [
{
"id": "8d06aaa0"
}
]
}
# Response
{
"data": {
"house_account_balance": 0,
"loyalty_balance": 0,
"tags": [
{
"id": "fhhsd8r5"
}
],
"id": "8d831",
"name": "James Lapda",
"dial_code": 966,
"phone": "565445254",
"email": "m.steuber@ecs.net",
"gender": 1,
"birth_date": "1986-09-17",
"is_blacklisted": false,
"is_house_account_enabled": true,
"house_account_limit": 1000,
"is_loyalty_enabled": 1,
"created_at": "2019-04-22 14:18:54",
"updated_at": "2019-05-02 10:14:49",
"deleted_at": null,
"last_order_at": "2019-11-27 09:40:35",
"order_count": 3,
"addresses": [
{
"id": "8d92cc27",
"delivery_zone": {
"id": "8d86ac81"
}
}
]
}
}
# Delete Customer
DELETE /customers/{customerId}
# Scope
admin.write
# Restore Customer
PUT /customers/{customerId}/restore
# Scope
admin.restore