# Change ticket type

> POST https://api.nabrah.ai/api/ext/omni_v2/ticket/{id}/update_type

Group: Tickets. Page: https://www.nabrah.ai/en/docs/api-reference/tickets/change-ticket-type

Updates the category (type) of the ticket identified by path `id`. Send the new value in the `ticket_type` field. Returns a boolean indicating success. The value should match one of the ticket types configured on the ticket's inbox (`config.ticket_types`).

## Request

- **ticket_type**: The new ticket category. Should be one of the types allowed by the inbox configuration (see the inbox `config.ticket_types` list). Fields: `ticket_type`.

Response is a bare boolean: `true` on success.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `id` (integer, required): Numeric identifier of the ticket whose type to update. From GET /api/ext/omni_v2/ticket or the create-ticket response.

## Body (application/json)

### Example: Update type

Recategorize the ticket.

```json
{
  "ticket_type": "billing"
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
false
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request POST \
  --url 'https://api.nabrah.ai/api/ext/omni_v2/ticket/<id>/update_type' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "ticket_type": "billing"
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/ticket/<id>/update_type"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "ticket_type": "billing"
}

response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/omni_v2/ticket/<id>/update_type", {
  method: "POST",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "ticket_type": "billing"
  }),
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "ticket_type": "billing"
}`)

	req, _ := http.NewRequest("POST", "https://api.nabrah.ai/api/ext/omni_v2/ticket/<id>/update_type", payload)
	req.Header.Set("X-API-Key", "<your-api-key>")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
