# Review widgets

Embeddable widgets showing reviews

Endpoint: `https://api.bookingmood.com/v1/review_widgets`, supporting `GET`, `POST`, `DELETE`, `PATCH`. Authenticate with the header `Authorization: Bearer YOUR_API_KEY` (see [authentication](https://www.bookingmood.com/en-NZ/api-reference/authentication.md)).

## The review widget object

| Attribute | Type | Description |
| --- | --- | --- |
| `id` | `uuid` |  |
| `organization_id` | `uuid` | Identifier of the organization this widget is defined in. References [`organizations.id`](https://www.bookingmood.com/en-NZ/api-reference/organizations.md). |
| `created_at` | `timestamp with time zone` | Creation timestamp. Read-only: set by the database. |
| `updated_at` | `timestamp with time zone` | Last modification timestamp. Read-only: set by the database. |
| `color_background` | `text` | Background color of the widget. |
| `color_primary` | `text` | Primary color of the widget. |
| `color_text` | `text` | Text color of the widget. |
| `font` | `text \| null` | Font of the widget. |
| `fts` | `tsvector` | Read-only: set by the database. |
| `language` | `Language` | Language of the widget. |
| `layout` | `ReviewWidgetLayout` | Layout of the reviews: `grid`, `list` or `summary`. |
| `number_of_items` | `integer` | Number of reviews to show. |
| `show_branding` | `boolean` | Whether to show the Bookingmood branding. |
| `title` | `text` | Title of the widget. |

```json
{
  "id": "00000000-0000-0000-0000-000000000000",
  "organization_id": "00000000-0000-0000-0000-000000000000",
  "created_at": "2026-10-30T23:37:06.265Z",
  "updated_at": "2026-10-30T23:37:06.265Z",
  "color_background": "#fff",
  "color_primary": "#067f54",
  "color_text": "#000",
  "font": "",
  "language": "en-US",
  "layout": "grid",
  "number_of_items": 6,
  "show_branding": true,
  "title": "Summer cottage"
}
```

### Types

```typescript
type Language = 
  | "be-BY"
  | "bg-BG"
  | "cs-CZ"
  | "da-DK"
  | "de-DE"
  | "en-GB"
  | "en-NZ"
  | "en-US"
  | "es-ES"
  | "eu-ES"
  | "fr-FR"
  | "gr-EL"
  | "he-IL"
  | "hr-HR"
  | "hu-HU"
  | "it-IT"
  | "ja-JP"
  | "lt-LT"
  | "lv-LV"
  | "nl-NL"
  | "nn-NO"
  | "pl-PL"
  | "pt-BR"
  | "ro-RO"
  | "ru-RU"
  | "sk-SK"
  | "sl-SI"
  | "sr-Cyrl"
  | "sr-Latn"
  | "sv-SE"
  | "tr-TR"
  | "uk-UA";

type ReviewWidgetLayout = "grid" | "list" | "summary";
```

### Related resources

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

| Embed | Type | Description |
| --- | --- | --- |
| `organizations(*)` | `object \| null` | The [organization](https://www.bookingmood.com/en-NZ/api-reference/organizations.md) referenced by `organization_id`. |
| `review_widget_listings(*)` | `array` | The [review widget listings](https://www.bookingmood.com/en-NZ/api-reference/review_widget_listings.md) referencing this review widget through `review_widget_listings.review_widget_id`. |

## List review widgets

`GET /v1/review_widgets`

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

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

Responses:

- `200`: A list of review widgets 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.

## Create review widgets

`POST /v1/review_widgets`

Insert one review widget or an array of review widgets. The body is a `Partial` review widget object, so columns with a default can be left out. Read-only attributes can't be written.

```bash
curl -X POST "https://api.bookingmood.com/v1/review_widgets" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "00000000-0000-0000-0000-000000000000",
    "color_background": "#fff",
    "color_primary": "#067f54",
    "color_text": "#000",
    "language": "en-US",
    "layout": "grid",
    "number_of_items": 6,
    "show_branding": true,
    "title": "Summer cottage"
  }'
```

Responses:

- `201`: The newly created review widgets with the selected columns.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

## Delete review widgets

`DELETE /v1/review_widgets`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/en-NZ/api-reference/filtering.md)). Without filters, this request deletes all review widgets you have access to. Always filter on at least one column, e.g. `id=eq.{id}`.

```bash
curl -X DELETE "https://api.bookingmood.com/v1/review_widgets?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Responses:

- `200`: The deleted review widgets with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column or an invalid filter.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.

## Update review widgets

`PATCH /v1/review_widgets`

Filter on any attribute with `column=operator.value` (see [filtering](https://www.bookingmood.com/en-NZ/api-reference/filtering.md)). Without filters, this request updates all review widgets you have access to. Always filter on at least one column, e.g. `id=eq.{id}`. The body holds the attributes to change.

```bash
curl -X PATCH "https://api.bookingmood.com/v1/review_widgets?id=eq.00000000-0000-0000-0000-000000000000" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "color_background": "#fff"
  }'
```

Responses:

- `200`: The updated review widgets with the selected columns. `204` without a body when sending the header `Prefer: return=minimal`.
- `400`: The request is malformed, for example an unknown column, an invalid filter or an invalid body.
- `401`: The API key is missing or invalid.
- `403`: The API key has no permission for this change, for example when writing rows of another organization.
- `409`: The change conflicts with existing data, for example a duplicate key or a reference to a row that does not exist.

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