# Summarize

```
POST /api/v1/{organisation}/widgets/{widget}/summarize
```

**Auth:** widget domain, widget secret, or organisation API key with `summarize`  
**Billing:** uses answer allowance, same as chat (**402** when none are left)

Returns a short overview of the best matching pages for a query. Useful when you want “what does our site say about X?” without a full chat thread.

## Body

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Max 2048 characters |
| `filters` | object | no | Optional search filters |
| `limit` | int | no | How many top results to base the summary on, 1-20, default `8` |
| `browser_language` | string | no | Language hint for the summary |
| `stream` | bool | no | Stream the summary text |

## JSON response

When there is enough relevant content:

```json
{
  "data": {
    "text": "A concise overview…",
    "sources": [ /* same fields as search hits */ ],
    "summarized": true
  }
}
```

When there is too little to summarise (or the query looks like simple navigation, such as a single keyword):

```json
{
  "data": {
    "text": "",
    "sources": [],
    "summarized": false
  }
}
```

Always check `summarized` before showing `text`.

## Streaming

Uses the same event types as chat (`token`, `done`, `error`). The final `done` payload includes `{ "summarized": true }`. If there is nothing worth summarising, you get a normal JSON response with `summarized: false` instead of a stream.
