# Page events

Source: https://help.ruuster.com/idx/events

> Send batched page events, such as results views and listing views, as counts for your usage reports.

```http
GET https://idx.ruuster.com/v1/events
```

publishable or secret key · free · never cached

A batch of up to 20 page events, such as a results view, a listing view or a photo opened, sent from
the browser as counts for your usage reports. `b` is the batch as a JSON array, base64url-encoded.

## What to know

- It costs no units and is never cached.
- Events carry counts only: no prices, addresses, search values, names or emails.
- Events from `localhost` are checked and answered but not counted, so your own development never shows
  up as visitors.
- It is optional. For your own analytics, use the GA4 events the recipe components push:
  [Analytics: GA4 and Google Tag Manager](https://help.ruuster.com/idx/guide-analytics).

## Query parameters

| Name | Type | Description |
|---|---|---|
| `b` | string | A batch of up to 20 events: base64url of a JSON array, at most 4 KB decoded. At most 5500 characters. Required. |

## Response

The answer is `{ ok: true, data, meta }`. These are the fields of `data`; `meta` carries `brokerageId`, `freshness.asOf`, `mls` (each board's display rules) and `canonical`.

| Field | Type | Description |
|---|---|---|
| `accepted` | integer |  |
| `dropped` | integer |  |

## Errors

These are the error codes this endpoint can answer. Every error has the same body; [Errors](https://help.ruuster.com/idx/reference-errors) explains each code and what to show.

`invalid_parameter`, `secret_key_in_url`, `invalid_credentials`, `missing_credentials`, `payment_required`, `access_revoked`, `brokerage_not_enabled`, `origin_not_allowed`, `origin_required`, `secret_key_in_browser`, `internal_error`, `api_paused`, `source_unavailable`

## Example request

cURL:

```bash
curl -s -G "https://idx.ruuster.com/v1/events" \
  --data-urlencode b=W3sia2luZCI6InJlc3VsdHNfdmlldyIsImF0IjoiMjAyNi0xMC0yMlQxNDo1OTowMC4wMDBaIiwic2lkIjoic184ZjJrMXgiLCJlbWJlZElkIjpudWxsLCJzdXJmYWNlIjoicmVzdWx0cyIsImxpc3RpbmdJZCI6bnVsbH1d \
  -H "Authorization: Bearer $IDX_SECRET_KEY"
```

TypeScript:

```typescript
import { createClient } from "@ruuster/idx";

const idx = createClient({ secretKey: process.env.IDX_SECRET_KEY });

const r = await idx.request("/events", {
  b: "W3sia2luZCI6InJlc3VsdHNfdmlldyIsImF0IjoiMjAyNi0xMC0yMlQxNDo1OTowMC4wMDBaIiwic2lkIjoic184ZjJrMXgiLCJlbWJlZElkIjpudWxsLCJzdXJmYWNlIjoicmVzdWx0cyIsImxpc3RpbmdJZCI6bnVsbH1d",
});
if (!r.ok) throw new Error(`${r.error.code}: ${r.error.message}`);
console.log(r.data);
```

Python:

```python
import os

import requests

res = requests.get(
    "https://idx.ruuster.com/v1/events",
    params={
        "b": "W3sia2luZCI6InJlc3VsdHNfdmlldyIsImF0IjoiMjAyNi0xMC0yMlQxNDo1OTowMC4wMDBaIiwic2lkIjoic184ZjJrMXgiLCJlbWJlZElkIjpudWxsLCJzdXJmYWNlIjoicmVzdWx0cyIsImxpc3RpbmdJZCI6bnVsbH1d",
    },
    headers={"Authorization": "Bearer " + os.environ["IDX_SECRET_KEY"]},
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(body["error"]["code"] + ": " + body["error"]["message"])
print(body["data"])
```

PHP:

```php
<?php

$query = http_build_query([
    'b' => 'W3sia2luZCI6InJlc3VsdHNfdmlldyIsImF0IjoiMjAyNi0xMC0yMlQxNDo1OTowMC4wMDBaIiwic2lkIjoic184ZjJrMXgiLCJlbWJlZElkIjpudWxsLCJzdXJmYWNlIjoicmVzdWx0cyIsImxpc3RpbmdJZCI6bnVsbH1d',
], '', '&', PHP_QUERY_RFC3986);
$ch = curl_init('https://idx.ruuster.com/v1/events' . '?' . $query);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('IDX_SECRET_KEY')],
    CURLOPT_TIMEOUT => 30,
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body['ok']) {
    throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
print_r($body['data']);
```

## Example response

```json
{
  "ok": true,
  "data": {
    "accepted": 1,
    "dropped": 0
  },
  "meta": {
    "brokerageId": "bbbbbbbb-0000-4000-8000-000000000001",
    "freshness": {
      "asOf": "2026-10-22T15:00:00.000Z"
    },
    "mls": [],
    "canonical": null,
    "audience": "display"
  }
}
```
