# Events

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

**Auth:** widget domain, widget secret, or organisation API key  
**Status:** `202 Accepted`

Send **feedback** and **click** events from your own UI. Search and message events are recorded automatically when those endpoints are used, so you do not (and cannot) post them here.

## Body

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | string | yes | `feedback` or `click` |
| `session_id` | string | no | Analytics session |
| `meta` | object | depends | Fields for that type (below) |

### Feedback (`type: "feedback"`)

| Meta field | Required | Description |
|---|---|---|
| `rating` | yes | `"up"` or `"down"` |
| `conversation_id` | no | Chat conversation id |
| `answer_id` | no | Specific answer id |
| `comment` | no | Free text, max 2048 characters |

### Click (`type: "click"`)

| Meta field | Required | Description |
|---|---|---|
| `url` | yes | Destination URL |
| `rank` | no | Zero-based result position |
| `source` | no | Where the click came from (for example your search UI) |

Extra meta fields that do not apply to the event type are ignored.

## Response

```json
{ "recorded": true }
```

## Example

```bash
curl -sS -X POST \
  -H "Content-Type: application/json" \
  -H "Origin: https://example.com" \
  -d '{
    "type": "feedback",
    "session_id": "…",
    "meta": { "rating": "up", "answer_id": "…" }
  }' \
  "https://datalumo.app/api/v1/{organisation}/widgets/{widget}/events"
```
