# Site views

Logs of each page view on a site

Endpoint: `https://api.bookingmood.com/v1/site_views`, supporting `GET`. Authenticate with the header `Authorization: Bearer YOUR_API_KEY` (see [authentication](https://www.bookingmood.com/be-BY/api-reference/authentication.md)).

## The site view object

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `integer` | Unique identifier. |
| `site_id` | `uuid` | Identifier of the viewed site. References [`sites.id`](https://www.bookingmood.com/be-BY/api-reference/sites.md). |
| `created_at` | `timestamp with time zone` | Creation timestamp. Read-only: set by the database. |
| `country` | `text \| null` | Country of the visitor. |
| `pathname` | `text` | Pathname of the viewed page. |
| `referer` | `text \| null` | Referer of the view. |
| `session` | `uuid` | Identifier of the visitor's session. |

```json
{
  "id": 0,
  "site_id": "00000000-0000-0000-0000-000000000000",
  "created_at": "2026-10-30T23:18:45.588Z",
  "country": "NL",
  "pathname": "",
  "referer": "",
  "session": "00000000-0000-0000-0000-000000000000"
}
```

### Related resources

Embed related resources with the [`select` parameter](https://www.bookingmood.com/be-BY/api-reference/selecting.md), e.g. `select=*,sites(*)`. Resources related through more than one column need the column as a hint, like `table!column(*)`.

| Embed | Type | Description |
| --- | --- | --- |
| `sites(*)` | `object \| null` | The [site](https://www.bookingmood.com/be-BY/api-reference/sites.md) referenced by `site_id`. |

## List site views

`GET /v1/site_views`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/be-BY/api-reference/filtering.md)). Choose columns and embed related resources with `select` (see [selecting](https://www.bookingmood.com/be-BY/api-reference/selecting.md)), and sort and paginate with `order`, `limit` and `offset` (see [sorting and pagination](https://www.bookingmood.com/be-BY/api-reference/sorting-pagination.md)).

```bash
curl -X GET "https://api.bookingmood.com/v1/site_views?select=*&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: A list of site views with the selected columns. `206` when the list is a partial range.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.

Errors have a JSON body with a `code`, `message`, `details` and `hint`. See the [introduction](https://www.bookingmood.com/be-BY/api-reference.md) for more on errors. The full API is described by the OpenAPI spec at https://api.bookingmood.com/v1/openapi.json.
