# Search

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

**Auth:** widget domain, widget secret, or organisation API key with `search`  
**Widget type:** search or chatbot

Search across the sources linked to the widget. Search does not use answer credits.

## Body

| Field | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Max 1024 characters |
| `filters` | object | no | Optional filters |
| `sort` | string | no | Optional sort |
| `limit` | int | no | 1-50, default `10` |
| `session_id` | string | no | Analytics session; created for you if omitted |

## Response

```json
{
  "data": [
    {
      "id": "0194b…",
      "external_id": "wp-42",
      "name": "Hello world",
      "url": "https://example.com/hello-world#section",
      "snippet": "…matching text…",
      "score": 0.87,
      "meta": null
    }
  ],
  "session_id": "…"
}
```

`url` is the link you can show as a citation (page URL, with a section anchor when available).

## Example

```bash
curl -sS -X POST \
  -H "Authorization: Bearer $WIDGET_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"query": "how does pricing work", "limit": 5}' \
  "https://datalumo.app/api/v1/{organisation}/widgets/{widget}/search"
```
