# Get insights overview

> POST https://api.nabrah.ai/api/ext/insights/overview

Group: Analytics. Page: https://www.nabrah.ai/en/docs/api-reference/analytics/get-insights-overview

Returns the workspace overview for a time range, across calls and WhatsApp: conversation totals by channel and call type, outcomes, analysis results, daily trends, top contact reasons, knowledge gaps, repeat contacts and support tickets. Use `channel` to look at calls or WhatsApp only, and `agent_id` for a single agent.

## How the numbers work

- **Same as the dashboard**: These are the numbers shown on the Insights pages of the dashboard, for the same range and filters.
- **Who is counted**: Counts follow the access of the member who created the API key. A key made by a member limited to some WhatsApp numbers only sees those numbers.
- **unavailable**: Lists the parts that could not be loaded this time (for example "whatsapp" or "tickets"). Those parts come back empty; retry later for them.
- **Caching**: Results are cached for 15 minutes, or 1 minute when the range includes today.
- **Errors**: 422 when the range or time zone is not valid. 503 with `insights_timeout` when the query takes too long; try a shorter range.

## Authorization

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

## Body (application/json)

- `start` (string (ISO 8601), required): Start of the range, with a time zone offset, e.g. 2026-11-01T00:00:00+03:00.
- `end` (string (ISO 8601), required): End of the range. Must be after `start`, at most 366 days later, and not after the end of today in `tz`.
- `tz` (string, required): IANA time zone used for daily and hourly buckets, e.g. Asia/Riyadh.
- `agent_id` (string (UUID), optional): Only count conversations handled by this agent.
- `channel` (string, optional): "all" (default), "voice" or "whatsapp".

### Example: All channels

```json
{
  "start": "2026-11-01T00:00:00+03:00",
  "end": "2026-11-12T23:59:59+03:00",
  "tz": "Asia/Riyadh"
}
```

### Example: One agent's calls

```json
{
  "start": "2026-11-01T00:00:00+03:00",
  "end": "2026-11-12T23:59:59+03:00",
  "tz": "Asia/Riyadh",
  "channel": "voice",
  "agent_id": "00000000-0000-4000-8000-000000000000"
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "conversations": {
    "calls": 0,
    "whatsapp": 0,
    "by_call_type": {
      "inbound": 0,
      "outbound": 0,
      "web": 0
    }
  },
  "outcomes": {
    "calls": {
      "not_connected": 0,
      "referred": 0,
      "follow_up": 0,
      "resolved": 0,
      "not_analyzed": 0
    },
    "whatsapp": {
      "referred": 0,
      "resolved": 0,
      "in_progress": 0,
      "not_handled": 0
    }
  },
  "repeat": {
    "contacts": 0,
    "repeats": 0
  },
  "analysis": {
    "analyzed": 0,
    "follow_up": 0,
    "negative": 0,
    "sentiment_answered": 0,
    "satisfaction_answered": 0,
    "satisfied": 0,
    "quality_avg": 0,
    "quality_count": 0,
    "goal_judged": 0,
    "goal_achieved": 0
  },
  "trend": [
    {
      "date": "string",
      "calls": 0,
      "whatsapp": 0
    }
  ],
  "reasons": {
    "mode": "tags",
    "items": [
      {
        "key": "string",
        "count": 0
      }
    ],
    "tagged": 0,
    "untagged": 0
  },
  "knowledge_gaps": [
    {
      "topic": "string",
      "count": 0
    }
  ],
  "tickets": {
    "open": 0,
    "pending": 0,
    "resolved": 0,
    "snoozed": 0,
    "all": 0
  },
  "has_whatsapp": false,
  "has_ticket_inbox": false,
  "unavailable": [
    "string"
  ]
}
```

### 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/insights/overview' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "start": "2026-11-01T00:00:00+03:00",
  "end": "2026-11-12T23:59:59+03:00",
  "tz": "Asia/Riyadh"
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/insights/overview"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "start": "2026-11-01T00:00:00+03:00",
    "end": "2026-11-12T23:59:59+03:00",
    "tz": "Asia/Riyadh"
}

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/insights/overview", {
  method: "POST",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "start": "2026-11-01T00:00:00+03:00",
    "end": "2026-11-12T23:59:59+03:00",
    "tz": "Asia/Riyadh"
  }),
});

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

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "start": "2026-11-01T00:00:00+03:00",
  "end": "2026-11-12T23:59:59+03:00",
  "tz": "Asia/Riyadh"
}`)

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