# Agents

Manage system agents. Accessible for administrators only.

# Agent Object

Name Type Comment
id integer Unique agent identifier.
first_name string Agent's first name.
last_name string Agent's last name,
role integer Agent's role.
email string Agent's email.
avatar string A link to user's avatar.
status integer User status identifier.
created_at datetime Agent creation timestamp.
updated_at datetime Agent update timestamp.
last_login_at datetime Timestamp for the agent's last login.

The status attribute can take one of the following values:

Status Value
Active 1
Unconfirmed 2
Banned 3

The role attribute can take one of the following values:

Role Value
Admin 1
Agent 2

# Paginate Agents

GET
/agents

# Request

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

# Example Response

{
    "data": [
      {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "role": 1,
        "email": "john.doe@example.com",
        "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
        "status": 1,
        "created_at": "2020-02-13T10:08:06Z",
        "updated_at": "2020-02-13T10:08:06Z",
        "last_login_at": "2020-02-13T10:08:06Z"
      },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

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

notes-count

A number of notes created by the agent.

assigned-categories-count

A number of categories assigned to this agent.

unresolved-tickets-count

A number of unresolved tickets assigned to this agent.

resolved-tickets-count

A number of resolved tickets assigned to this agent.

# Partial filters

first_name, last_name, email

# Exact filters

status

# View an Agent

GET
/agents/{id}

# Example Request

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

# Example Response

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "role": 1,
    "email": "john.doe@example.com",
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2020-02-13T10:08:06Z",
    "updated_at": "2020-02-13T10:08:06Z",
    "last_login_at": "2020-02-13T10:08:06Z"
  }
}

# Available includes

Same as for when paginating the agents.

# Create an Agent

POST
/agents

# 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 email Yes Unique email address.
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/agents' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.d@example.com",
  "password": "123123",
  "password_confirmation": "123123"
}'

# Example Response

Status: 201 Created

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "role": 1,
    "email": "john.doe@example.com",
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2020-02-13T10:08:06Z",
    "updated_at": "2020-02-13T10:08:06Z",
    "last_login_at": "2020-02-13T10:08:06Z"
  }
}

# Update an Agent

PATCH
/agents/{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 email No Unique email address.
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.
timezone string No A valid timezone identifier according to the timezone_identifiers_list PHP function

# Headers

Accept application/json
Content-Type application/json

# Example Request

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

# Example Response

Status: 200 OK

{
  "data": {
    "id": 1,
    "first_name": "John",
    "last_name": "Wick",
    "role": 1,
    "email": "john.doe@example.com",
    "avatar": "https://api.adorable.io/avatars/285/abott@adorable.png",
    "status": 1,
    "created_at": "2020-02-13T10:08:06Z",
    "updated_at": "2020-02-13T10:08:06Z",
    "last_login_at": "2020-02-13T10:08:06Z"
  }
}

# Delete an Agent

DELETE
/agents/{id}

# Example Request

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

# Example Response

Status: 200 OK

{
    "success": true
}

# View Permissions

GET
/agents/{id}/permissions

# Example Request

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

# Example Response

Status: 200 OK

{
  "data": {
    "manage_articles": true,
    "manage_customers": false,
    "view_all_tickets": true
  }
}

# Update Permissions

PATCH
/agents/{id}/permissions

# Example Request

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

# Example Response

Status: 200 OK

{
  "data": {
    "manage_articles": true,
    "manage_customers": false,
    "view_all_tickets": true
  }
}

# View Notification Settings

GET
/agents/{id}/notifications

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/agents/{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
/agents/{id}/notifications

# Example Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/agents/{id}/notifications' \
--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
  }
}