# Change ticket priority

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

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

Sets (toggles) the priority of the ticket identified by path `id`. Send the desired level in the `priority` field of the request body. Returns a boolean indicating success. High-priority tickets are surfaced more prominently in support queues.

## Request

- **priority**: The priority level to apply, e.g. `urgent`, `high`, `medium`, `low`. Setting the same value the ticket already has may clear it back to no priority (toggle behavior). Fields: `priority`.

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 priority to set. From GET /api/ext/omni_v2/ticket or the create-ticket response.

## Body (application/json)

### Example: Set urgent

Mark the ticket as urgent.

```json
{
  "priority": "urgent"
}
```

### Example: Set low

Mark the ticket as low priority.

```json
{
  "priority": "low"
}
```

## 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>/toggle_priority' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "priority": "urgent"
}'
```

### Python

```python
import requests

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

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>/toggle_priority", {
  method: "POST",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "priority": "urgent"
  }),
});

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

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "priority": "urgent"
}`)

	req, _ := http.NewRequest("POST", "https://api.nabrah.ai/api/ext/omni_v2/ticket/<id>/toggle_priority", 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))
}
```
