# Customers

Manage system customers. Accessible for administrators and agents with appropriate permission.

# Customer Object

Name Type Comment
id integer Unique customer identifier.
first_name string Customer's first name.
last_name string Customer's last name,
email string Customer's email.
company string Customer's company name.
avatar string A link to user's avatar.
status integer User status identifier.
envato_username string Customer's Envato username, if Envato account is connected.
created_at datetime Agent creation timestamp.
updated_at datetime Agent update timestamp.
last_login_at datetime Timestamp for the customer's last login.

The status attribute can take one of the following values:

Status Value
Active 1
Unconfirmed 2
Banned 3

# Note Object

Name Type Comment
id integer Unique customer identifier.
text string A note text.
created_at datetime Agent creation timestamp.
updated_at datetime Agent update timestamp.

# Paginate Customers

GET
/customers

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/customers' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": [
      {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
        "company": "Acme Corp.",
        "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
        "status": 1,
        "envato_username": null,
        "created_at": "2019-09-23 09:11:24",
        "updated_at": "2019-09-23 09:11:24",
        "last_login_at": "2019-09-23 09:11:24"
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

If provided, the available includes will be part of the response for each customer object.

tickets-count

A number of tickets created by the customer.

notes-count

A number of notes created by the customer.

# Partial filters

first_name, last_name, email, company

# Exact filters

status

# View a Customer

GET
/customers/{id}

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/customers/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "company": null,
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2019-09-23 09:11:24",
    "updated_at": "2019-09-23 09:11:24",
    "last_login_at": "2019-09-23 09:11:24"
  }
}

# Available includes

Same as for when paginating the customers.

# Create a Customer

POST
/customers

# Parameters

Parameter Type Required Validation
first_name string Yes Any string that is max 250 characters long.
last_name string Yes Any string that is max 250 characters long.
email string Yes Unique email address.
company string No Company name, if applicable.
password string Yes Any string that is min 6 characters long.
password_confirmation string Yes The same as password field.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/customers' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.d@example.com",
  "company": "Acme Corp.",
  "password": "123123",
  "password_confirmation": "123123"
}'

# Example Response

Status: 201 Created

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "company": "Acme Corp.",
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2019-09-23 09:11:24",
    "updated_at": "2019-09-23 09:11:24",
    "last_login_at": null
  }
}

# Update a Customer

PATCH
/customers/{id}

# Parameters

Parameter Type Required Validation
first_name string No Any string that is max 250 characters long.
last_name string No Any string that is max 250 characters long.
email string No Unique email address.
company string No Company name, if applicable.
new_password string No Any string that is min 6 characters long.
new_password_confirmation string Only if new_password field is present The same as new_password field.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/customers/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "first_name": "Alice"
}'

# Example Response

Status: 200 OK

{
  "data": {
    "id": 1,
    "first_name": "Alice",
    "last_name": "Doe",
    "email": "john.doe@example.com",
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2019-09-23 09:11:24",
    "updated_at": "2019-09-23 09:11:24",
    "last_login_at": "2019-09-23 09:11:24"
  }
}

# Delete a Customer

DELETE
/customers/{id}

# Example Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/customers'

# Example Response

Status: 200 OK

{
    "success": true
}

# View Notification Settings

GET
/customers/{id}/notifications

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/customers/{id}/notifications' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

Status: 200 OK

{
  "data": {
    "new_ticket": false,
    "new_comment": true,
    "ticket_reassigned": true
  }
}

# Update Notification Settings

PATCH
/customers/{id}/notifications

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/customers/{id}/permissions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "new_ticket": false
}'

# Example Response

Status: 200 OK

{
  "data": {
    "new_ticket": false,
    "new_comment": true,
    "ticket_reassigned": true
  }
}

# Paginate Notes

GET
/customers/{id}/notes

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/customers/{id}/notes' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": [
      {
        "id": 1,
        "text": "This is some random note about the customer...",
        "created_at": "2019-09-23 09:11:24",
        "updated_at": "2019-09-23 09:11:24",
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

If provided, the available includes will be part of the response for each customer object.

creator

An agent who created the note.

user

Customer for which the note was created.

# Partial filters

text

# Exact filters

creator_id

# Create a Note

POST
/customers/{id}/notes

# Parameters

Parameter Type Required Validation
note string Yes Any string/HTML.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/customers' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "note": "This is a customer note."
}'

# Example Response

Status: 201 Created

{
  "data": {
    "id": 123,
    "text": "This is a customer note."
    "created_at": "2019-09-23 09:11:24",
    "updated_at": "2019-09-23 09:11:24",
  }
}

# Delete a Note

DELETE
/customers/{customer_id}/notes/{note_id}

# Example Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/customers/{customer_id}/notes/{note_id}'

# Example Response

Status: 200 OK

{
    "success": true
}