# Booking webhooks

Receive webhook notifications whenever bookings are created, updated or deleted. Booking webhooks can be used to trigger actions in your application whenever a booking is changed, for example to keep an external calendar or scheduling system up to date.

## Events[​](#events "Direct link to Events")

| Event             | Description                                                        |
| ----------------- | ------------------------------------------------------------------ |
| `booking.created` | Occurs whenever a new booking is created.                          |
| `booking.updated` | Occurs whenever any booking's information or resources is updated. |
| `booking.deleted` | Occurs whenever a booking is deleted.                              |

## Example Payload[​](#example-payload "Direct link to Example Payload")

We return JSON-formatted content with the following structure.

| Name    | Example content                                                                    | Description                                                |
| ------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| `id`    | `90fffd9c-6f31-43f5-84ce-264c7ca8be37`                                             | UUID of the booking                                        |
| `type`  | `booking`                                                                          | Resource type                                              |
| `event` | `booking.updated`                                                                  | Event that triggered the webhook, lowercase, dot-separated |
| `url`   | `https://app.freispace.com/dashboard?booking=90fffd9c-6f31-43f5-84ce-264c7ca8be37` | URL to the updated booking                                 |
| `data`  | `{}`                                                                               | The booking's information                                  |

```
{

    "id": "90fffd9c-6f31-43f5-84ce-264c7ca8be37",

    "type": "booking",

    "event": "booking.updated",

    "url": "https://app.freispace.com/dashboard?booking=90fffd9c-6f31-43f5-84ce-264c7ca8be37",

    "data": {

        "id": "90fffd9c-6f31-43f5-84ce-264c7ca8be37",

        "name": "E01 - Fine Cut",

        "start": "2023-08-08T00:00:00", // UTC

        "start_timezone": "Europe/Berlin",

        "end": "2023-08-18T00:00:00", // UTC

        "end_timezone": "Europe/Berlin",

        "all_day": true, // Boolean, whether this is a full-day booking. A full-day booking on Monday the 3rd would have a start datetime of `2023-01-03T00:00:00` and an end of `2023-01-04T00:00:00`

        "byline": null,

        "description": null, // may contain HTML

        "color": null,  // If given, colours are a HEX colour value (e.g. `#00ff00`).

        "optional": false,

        "status": {

            "id": "afcd1a07-ec58-4393-b808-a452a5a09e6b",

            "name": "Confirmed",

            "description": null,

            "icon": "check-circle",

            "color": "#057a55"

        },

        "project": {

            "id": "9d526060-599b-4e29-b9b6-cc5bcc20dacb",

            "name": "E01",

            "byline": null,

            "number": "P156-1",

        },

        "resources": {

            "suites": [

                {

                    "id": "6478ecaf-1fc5-4266-831e-fcd96a4bc098",

                    "name": "Avid 01",

                    "byline": "Z420",

                    "description": null,

                    "color": "#a200ad",

                    "site": {

                        "id": "0537b566-7bed-4aae-9544-f5ae01547c7b",

                        "name": "Berlin",

                        "description": "<p>HQ</p>"

                    }

                }

            ],

            "resources": [

                {

                    "id": "08e22f05-41e5-41df-8df8-d7d3404f5035",

                    "name": "Notebook 01",

                    "number": null,

                    "cost": 0,

                    "cost_unit": "day", // Cost units may generally be `minute`, `hour`, `day`, `week`, `month` or `usage`

                    "byline": null,

                    "description": null,

                    "color": "#e6de00",

                    "email": null,

                    "photo_url": "https://assets.app.freispace.com/freispace-public/resource_photos/08e22f05-41e5-41df-8df8-d7d3404f5035.svg"

                }

            ],

            "staffs": [

                {

                    "id": "a893354c-ce2c-407d-b893-278bead7aa4c",

                    "name": "Jane Doe",

                    "title": "Editor",

                    "number": null,

                    "cost": 0,

                    "cost_unit": null,

                    "photo_url": "https://assets.app.freispace.com/freispace-public/staff_photos/a893354c-ce2c-407d-b893-278bead7aa4c.svg"

                }

            ]

        }

    }

}
```

info

`start` and `end` datetimes are always in UTC. You can use `start_timezone` and `end_timezone` to convert them to the user's local time.
