# Count tickets

> GET https://api.nabrah.ai/api/ext/omni_v2/ticket/counts

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

Returns ticket counts for the project's inbox: a per-status breakdown (open, pending, resolved, snoozed, all) and a per-assignment breakdown (all, me, unassigned, assigned). Use it to render status and assignment filter tabs without paging through tickets.

## Authentication & scope

Like every Omni v2 ticket endpoint, this is scoped to a single project by your Web API key.

- **X-API-Key header**: Send your Web key (prefix `nb_`) in the `X-API-Key` header. The key is bound to exactly one project, so there is no `project_id` parameter. Validate the key with GET /api/ext/test first.

## Response shape

- **status_counts**: Ticket totals per lifecycle status, plus `all` (the sum across statuses). These drive the status tabs. Fields: `open`, `pending`, `resolved`, `snoozed`, `all`.
- **assignment_counts**: Ticket totals per assignment bucket for the selected status. `all` is the total for that status; `assigned` = all - unassigned. Fields: `all`, `me`, `unassigned`, `assigned`.

Counts are current server-side snapshots and reflect the whole inbox for the given scope, not a single page.

## How the two scopes combine

Mirrors a support dashboard's tabs so a badge always matches the list it opens.

- **status_counts respect assignee_type**: Passing `assignee_type=me` returns per-status counts of only your tickets, matching a `status` + `assignee_type=me` listing.
- **assignment_counts respect status**: The assignment breakdown is always computed for the selected `status` (all statuses when `status=all`), so you can show every bucket and let the user switch.

## Authorization

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

## Query parameters

- `status` (enum(open | pending | resolved | snoozed | all), optional): Lifecycle status the assignment breakdown is computed for. One of `open`, `pending`, `resolved`, `snoozed`, or `all`. Defaults to `all`. Also selects which status the `assignment_counts` cover.
- `assignee_type` (enum(all | me | unassigned | assigned), optional): Assignment bucket the per-status counts are scoped to. One of `all`, `me`, `unassigned`, or `assigned`. Defaults to `all`. Use `me` to count only the caller's tickets per status, and so on.

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "status_counts": {
    "open": 0,
    "pending": 0,
    "resolved": 0,
    "snoozed": 0,
    "all": 0
  },
  "assignment_counts": {
    "all": 0,
    "me": 0,
    "unassigned": 0,
    "assigned": 0
  }
}
```

### 422 Validation Error

Content type: `application/json`

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

## Request examples

### cURL

```bash
curl --request GET \
  --url 'https://api.nabrah.ai/api/ext/omni_v2/ticket/counts' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/ticket/counts"
headers = {"X-API-Key": "<your-api-key>"}

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

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/omni_v2/ticket/counts", {
  method: "GET",
  headers: { "X-API-Key": "<your-api-key>" },
});

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

### Go

```go
package main

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

func main() {
	req, _ := http.NewRequest("GET", "https://api.nabrah.ai/api/ext/omni_v2/ticket/counts", nil)
	req.Header.Set("X-API-Key", "<your-api-key>")

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

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