# Tickets

Manage all tickets. Available to all user roles, however user user can see only those tickets that he has access to.

# Ticket Object

Name Type Comment
id integer Unique ticket identifier.
title string Ticket title.
body string The text of the ticket.
status integer Ticket status.
private boolean true if ticket is private, false otherwise.
additional object Additional info about the ticket.
category_id integer The unique identifier of the category this ticket belongs to.
assigned_agent_id integer The unique identifier of the assigned agent, null if there is no agent assigned.
agent_assigned_at datetime Timestamp when the agent is assigned to this ticket.
created_at datetime Ticket creation timestamp.
updated_at datetime Ticket update timestamp.

The status attribute can take one of the following values:

Status Value
Open 1
Pending 2
Closed 3

# Paginate Tickets

GET
/tickets

# Request

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

# Example Response

{
    "data": [
      {
        "id": 161,
        "title": "Random Ticket Updated 2",
        "body": "Wohooo",
        "status": 1,
        "private": false,
        "additional": [],
        "category_id": 12,
        "assigned_agent_id": 1,
        "agent_assigned_at": "2019-09-30 12:09:10",
        "created_at": "2019-09-30 12:09:10",
        "updated_at": "2019-09-30 12:20:09"
    },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

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

user

A user who owns the ticket.

creator

A user who created the ticket. Can be different than the user in case if ticket is created by agent in behalf of the customer.

attachments

An array of attachment objects.

attachments-count

A number of attachments available for the ticket.

category

A category to which the ticket belongs to.

agent

Assigned agent object.

last_reply

The most recent ticket comment.

last_reply.user

The user who created the last comment. Can be either agent or customer object.

last_read_by_me

A timestamp which represents the last time when current user has read the ticket.

replies-count

A number of replies/comments available for the ticket.

# Sortable Fields

id, title, status, private, updated_at, created_at.

# Partial filters

first_name, last_name, email

A search filter that can be used as a partial search for the following fields: ticket.id, ticket.title, ticket.envato_purchase_code, ticket.body, creator.first_name, creator.last_name, creator.email, creator.envato_username.

# Exact filters

status, categories, agents

# View a Ticket

GET
/tickets/{id}

# Example Request

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

# Example Response

{
  "data": {
      "id": 161,
      "title": "Random Ticket Updated 2",
      "body": "Wohooo",
      "status": 1,
      "private": false,
      "additional": [],
      "category_id": 12,
      "assigned_agent_id": 1,
      "agent_assigned_at": "2019-09-30 12:09:10",
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:20:09"
  }
}

# Available includes

Same as for when paginating the customers.

# Create a Ticket

POST
/tickets

# Parameters

Parameter Type Required Validation
category number Yes Valid category id.
title string Yes Any string with length shorter or equal to 250 characters.
body string Yes Any string/HTML.
private boolean No true if ticket should be private, false otherwise.
attachments array No A list of attachment IDs for the attachments that should be associated with the ticket.
first_name string No Customer's first name.
last_name string No Customer's last name.
email email Only if customer_id is not provided. Valid email address for the customer who is submitting a ticket.
customer_id number Only if email if not provided. Valid customer id.

TIP

If a customer with the specified email address does not exist, a new account will be automatically created for him.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/tickets' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "My Random Ticket",
  "body": "How are you doing?",
  "category": 11,
  "customer": 245
}'

# Example Response

Status: 201 Created

{
  "data": {
      "id": 161,
      "title": "My Random Ticket",
      "body": "How are you doing?",
      "status": 1,
      "private": false,
      "additional": [],
      "category_id": 11,
      "assigned_agent_id": 1,
      "agent_assigned_at": "2019-09-30 12:09:10",
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:20:09"
  }
}

# Update a Ticket

PATCH
/tickets/{id}

# Parameters

Parameter Type Required Validation
category number No Valid category id.
title string No Any string with length shorter or equal to 250 characters.
body string No Any string/HTML.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/tickets/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "Random Ticket Updated 2",
  "body": "Wohooo",
  "category": 12
}'

# Example Response

Status: 200 OK

{
  "data": {
      "id": 161,
      "title": "Random Ticket Updated 2",
      "body": "Wohooo",
      "status": 1,
      "private": false,
      "additional": [],
      "category_id": 12,
      "assigned_agent_id": 1,
      "agent_assigned_at": "2019-09-30 12:09:10",
      "created_at": "2019-09-30 12:09:10",
      "updated_at": "2019-09-30 12:20:09"
  }
}

# Make Public

PUT
/tickets/{id}/privacy

# Headers

Accept application/json
Content-Type application/json

# Example Request

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

# Example Response

Status: 200 OK

{
  "success": true
}

# Make Private

DELETE
/tickets/{id}/privacy

# Headers

Accept application/json
Content-Type application/json

# Example Request

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

# Example Response

Status: 200 OK

{
  "success": true
}

# Assign an Agent

PUT
/tickets/{id}/agents
Parameter Type Required Validation
agent integer Yes Valid agent identifier.

# Headers

Accept application/json
Content-Type application/json

# Example Request

curl --location --request PUT 'https://yoursubdomain.support-hub.io/api/tickets/{id}/privacy' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "agent": 123
}'

# Example Response

Status: 200 OK

{
  "success": true
}