# Support Ticket

## Support Ticket Category List

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/support/get/category-list/`

This API endpoint will give a list of Category which was chosen when creating a support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "CategoryList": [
            {
                "id": <Category-id>,
                "category": "<Category-name>",
                "description": "<Description>"
            },
           ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/support/get/category-list/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/support/get/category-list/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access-token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Create Support Ticket

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/support/create/ticket/`

This API endpoint will create a support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

#### Request Body

| Name                                      | Type   | Description                                                                                                                                                                                                |
| ----------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| subject<mark style="color:red;">\*</mark> | string | ticket subject                                                                                                                                                                                             |
| priority                                  | string | priority id - Possible values are 1(Low), 2(Medium),or 3(High)                                                                                                                                             |
| comment<mark style="color:red;">\*</mark> | string | ticket comment                                                                                                                                                                                             |
| category                                  | string | <p>category  id - Get possible values through <strong>Support Ticket Category List</strong> API endpoint.</p><p><a data-mention href="#support-ticket-category-list">#support-ticket-category-list</a></p> |
| attachment                                | object | attachment file - Upload a attachment file (maximum size 2Mib).                                                                                                                                            |

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

```markup
​​​​​HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var fs = require('fs');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/creat/support/ticket/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>',
  },
  formData: {
    'subject': '<subject>',
    'priority': '<priority-id>',
    'comment': '<comment>',
    'category': '<category-id>',
    'attachment': {
      'value': fs.createReadStream('<file_path>'),
      'options': {
        'filename': '<file_name>',
        'contentType': null
      }
    }
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/creat/support/ticket/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('subject' => '<subject>','priority' => '<priority-id>','comment' => '<comment>','category' => '<category>','attachment'=> new CURLFILE('<file_path>')),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access-token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field            | Description                                        |
| ----------- | ---------------- | ---------------- | -------------------------------------------------- |
| 400         | Validation Error | subject, comment | This field is required.                            |
| 400         | Validation Error | subject          | Ensure this field has no more than 500 characters. |
| 400         | Validation Error | priority         | "\\"priority\\" is not a valid choice.             |
| 400         | Validation Error | category         | Invalid pk"\\"category\\" - object does not exist. |
| 400         | Validation Error | attachment       | File is too big. Max filesize: 2MiB.               |
| 401         | Request Failed   |                  | Currenly Open Ticket Limit Exceed.                 |

## Support Ticket History

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/support/get/ticket/history/`

This API endpoint will provide a history of support tickets. A request without query params provides details of last created 50 tickets.\
To get a range of ticket history provide offset and limit values in query params.\
Also provides filtered details of ticket history when a request with a possible query params. Ticket subject, ticket category, and ticket status are the possible query params.

#### Query Parameters

| Name     | Type   | Description                                                                              |
| -------- | ------ | ---------------------------------------------------------------------------------------- |
| offset   | string | offset value                                                                             |
| limit    | string | limit value                                                                              |
| subject  | string | ticket subject                                                                           |
| category | string | category id - Get possible values through **Support Ticket Category List** API endpoint. |
| status   | string | status id - Possible values are 1(Open), 2(Processing),or 3(Closed)                      |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "TicketList": [
            {
                "id": <ticket_id>,
                "subject": "<ticket_subject>",
                "priority": "<ticket_priority_id>",
                "category": <ticket_category_id>,
                "category_title": "<ticket_category_title>",
                "comment": "<ticket_comment>",
                "status": "<ticket_status_id>"
            }
            ...
        ]
    }
}


------------------------

priority_options = (
    ('1', 'Low'),
    ('2', 'Medium'),
    ('3', 'High'),
)
status_options = (
    ('1', 'Open'),
    ('2', 'Processing'),
    ('3', 'Closed'),
)
```

{% endtab %}
{% endtabs %}

#### Sample code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/get/ticket/history/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/get/ticket/history/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access-token>"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | Field    | Description                      |
| ----------- | ---------------- | -------- | -------------------------------- |
| 400         | Validation Error | category | Catogory id is not valid numeric |
| 400         | Validation Error | status   | Status id is not valid numeric   |

## Support Ticket Tag List

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/support/get/ticket/tags/`

This API endpoint will give a list of Tags which was chosen when updating a support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Bearer access token |
| Authorization<mark style="color:red;">\*</mark> | string | apikey              |

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

```markup
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "TicketTagList": [
            {
                "id": <tag_id>,
                "tag": "<tag_name>",
                "keyword": "<tag_keyword>"
            },
           ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/get/ticket/tags/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/get/ticket/tags/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access-token>"
  ),
));
$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Update Support Ticket

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/support/update/ticket/`

This API endpoint will update a support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

#### Request Body

| Name                                         | Type   | Description                                                                                                                                                                           |
| -------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ticket\_id<mark style="color:red;">\*</mark> | string | Id of ticket which wants to update                                                                                                                                                    |
| priority                                     | string | priority id - Possible values are 1(Low), 2(Medium),or 3(High)                                                                                                                        |
| tags<mark style="color:red;">\*</mark>       | string | <p>tag id - Get possible values through <strong>Support Ticket Tag List</strong> API endpoint.</p><p><a data-mention href="#support-ticket-tag-list">#support-ticket-tag-list</a></p> |

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

```
​​​​​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/update/support/ticket/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access-token>'
  },
  formData: {
    'ticket_id': '<ticket id>',
    'priority': '<priority id>',
    'tags': '<tag id>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/update/support/ticket/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('ticket_id' => '<ticket id>','priority' => '<ticket id>','tags' => '<tag id>'),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <accsess-token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | Field    | Description                                                                                                                                |
| ----------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| 400         | Invalid Input    | ticket   | <p>You are not the owner of the requested ticket,</p><p>Ticket id is not valid,</p><p>Ticket id is required and this may not be blank.</p> |
| 400         | Validation Error | priority | "\\"priority\\" is not a valid choice.                                                                                                     |
| 400         | Validation Error | tags     | <p>This list may not be empty.</p><p>Incorrect type. Expected pk value, received str.</p><p>Invalid pk "tags" - object does not exist.</p> |

## Get Ticket Detailed View

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/support/ticket/detailed-view/`

This API endpoint will provide a detailed view of support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

#### Request Body

| Name                                         | Type   | Description |
| -------------------------------------------- | ------ | ----------- |
| ticket\_id<mark style="color:red;">\*</mark> | string | ticket id   |

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

```html
HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "ticket": {
            "id": <ticket id>,
            "subject": "<subject>",
            "priority": "<priority_id>",
            "category": <category_id>,
            "comment": "<comment>",
            "status": "<status_id>",
            "tags": [
                tag id
            ]
        },
        "author": "<author_email>",
        "conversations": [            
            {
                "id": <conversations_id>,
                "ticket": <ticket_id>,
                "comment": "<comment>",
                "author":"<conversation_author_email>"
            },
            ...
        ],
        "attachments": [
            {
                "id": <attachments id>,
                "conversation_id": <conversation id>
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/support/ticket/detailed-view/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
 formData: {
  'ticket_id': '<ticket id>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "https://<domain>/<api prefix>/<version>/support/ticket/detailed-view/",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => array('ticket_id' => '<ticket id>'),
  CURLOPT_HTTPHEADER => arra(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


```

#### Error Responses

| Status Code | Error Type    | Field  | Description                                                                                                                                |
| ----------- | ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| 400         | Invalid Input | ticket | <p>You are not the owner of the requested ticket,</p><p>Ticket id is not valid.</p><p>Ticket id is required and this may not be blank.</p> |

## Get Attachment

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/support/ticket/download/<attachment_id>/`

This API endpoint will return an HTTP Response of the attachment file.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | Apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

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

```
Get HTTP Response of attachment file.
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/support/ticket/download/<attachment_id>/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/support/ticket/download/<attachment_id>/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Ticket Add Conversation

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/support/ticket/conversation/`

This API endpoint will add a conversation to support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

#### Request Body

| Name                                      | Type   | Description                                   |
| ----------------------------------------- | ------ | --------------------------------------------- |
| ticket<mark style="color:red;">\*</mark>  | string | ticket id                                     |
| comment<mark style="color:red;">\*</mark> | string | conversation comment                          |
| attachment                                | string | Upload a attachment file (maximum size 2Mib). |

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

```
​​​​​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

#### Node

```php
var request = require('request');
var fs = require('fs');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/support/ticket/conversation/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {
    'ticket': '<ticket id>',
    'comment': '<comment>',
    'attachment': {
      'value': fs.createReadStream('file path'),
      'options': {
        'filename': '<filename>',
        'contentType': null
      }
    }
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**&#x20;

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/support/ticket/conversation/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('ticket' => '<ticket id>','comment' => '<comment>','attachment'=> new CURLFILE('file path')),
  CURLOPT_HTTPHEADER => array(
    "apikey: <apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | Field      | Description                                                                                                                                                                                                                     |
| ----------- | ---------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | ticket     | <p>This field is required.</p><p>You are not the owner of the requested ticket.</p><p>Incorrect type. Expected pk value, received str.</p><p>Invalid pk "ticket" - object does not exist.</p><p>This field may not be null.</p> |
| 400         | Validation Error | comment    | <p>This field is required.</p><p>This field may not be blank.</p>                                                                                                                                                               |
| 400         | Validation Error | attachment | File is too big. Max filesize: 2MiB.                                                                                                                                                                                            |

## Change Ticket Status

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/‎support/ticket/status/`

This API endpoint will change status of support ticket.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access-token |

#### Request Body

| Name                                     | Type   | Description                                                |
| ---------------------------------------- | ------ | ---------------------------------------------------------- |
| ticket<mark style="color:red;">\*</mark> | string | ticket id                                                  |
| status<mark style="color:red;">\*</mark> | string | status id - Possible values are 2(to open) and 3(to close) |

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

```markup
​​​​​HTTP/1.1 200 OK
Content-Type: application/json
​
Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/‎support/ticket/status/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {
    'ticket': '<ticket id>',
    'status': '<status id>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

#### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://<domain>/<api prefix>/<version>/‎support/ticket/status/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('ticket' => '<ticket id>','status' => '<status id>'),
  CURLOPT_HTTPHEADER => array(
    "apikey:<apikey>",
    "Authorization: Bearer <access token>",
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | Field  | Description                                                                                                                                                                                                                     |
| ----------- | ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Validation Error | ticket | <p>You Can't open or close this Ticket,</p><p>Ticket id is not valid</p><p>Ticket is  already closed,</p><p>Ticket is already processing,<br>Ticket is already open,</p><p>Ticket id is required and this may not be blank.</p> |
| 400         | Validation Error | status | <p>""status" is not a valid choice.</p><p>Status id is required and this may not be blank.</p>                                                                                                                                  |
