# Booking line

The `Booking Line` object represents the reservation/purchase of a specific activity, service, accommodation or other product from your inventory by **one** `Guest`**.** It holds prices, dates and it's related to `Guest` and `Booking`

## The Booking line object

```json
{
    "id": 30369743,
    "starts_at": "2024-04-09 14:00:00",
    "ends_at": "2024-04-16 10:00:00",
    "status": "confirmed",
    "slot": 0,
    "qty": 7,
    "product_id": "9d84ae87-4365-4b3f-b337-b054657df53e",
    "package_id": null,
    "booking_id": "3d084b8e-032d-4edc-88f9-e9c15e164a80",
    "guest_id": "98194687-4737-48f8-8edc-540bafde9fd5",
    "cart_id": "ced956e4-281b-4cf3-8918-b40c8e82c04e",
    "currency": "EUR",
    "unit_price_excl_tax": 16.8067,
    "unit_price_incl_tax": 20,
    "total_price_excl_tax": 117.65,
    "total_price_incl_tax": 140,
    "final_price_excl_tax": 100,
    "final_price_incl_tax": 119,
    "discounted_price": 17.65,
    "tax_component": 22.35,
    "discounted_tax": 3.35,
    "discount_total": 21,
    "final_tax_component": 19,
    "cancelled_at": null,
    "created_at": "2024-03-28T16:45:01+00:00",
    "updated_at": "2024-03-29T08:14:49+00:00"
},
```

**`id`**

Unique ID of the perso&#x6E;**.**

**`starts_at`** *nullable*

The start date and time of the booking line. Formatted as "YYYY-MM-DD HH:MM:SS". Null when it's dateless purchase like T-shirt or unscheduled activity.

**`ends_at`** *nullable*

The end date and time of the booking line. Formatted as "YYYY-MM-DD HH:MM:SS". Null when it's dateless purchase like T-shirt or unscheduled activity.

**`slot`** *nullable*

An integer representing the sequence or position of the booking line within calendar. Important for accommodations.

**`qty`**

Quantity of the booked item or service.

**`product_id`** *expandable*

A unique identifier for the product associated with this booking line.

**`package_id`** *nullable, expandable*

A unique identifier for the package, if applicable, associated with this booking line.

**`booking_id`** *expandable*

A unique identifier for the booking associated with this booking line.

**`guest_id`** *expandable*

The unique ID of the guest associated with this booking line.

**`cart_id`**

A unique identifier for the cart associated with this purchase.

**`currency`**

A code representing the currency used for the transaction. In **ISO 4217** format.

**`unit_price_excl_tax`**

Unit price of the item excluding tax. This is the price for one unit of the item before any taxes are applied.

**`unit_price_incl_tax`**

Unit price of the item including tax. This is the price for one unit of the item after all applicable taxes have been added. &#x20;

**`total_price_excl_tax`**

Total price of the items excluding tax. This is the aggregate price of all units of the item before any taxes are applied.

**`total_price_incl_tax`**

Total price of the items including tax. This is the aggregate price of all units of the item after all applicable taxes have been added.

**`final_price_excl_tax`**

The final price excluding tax, after applying any discounts or adjustments to the total price excluding tax.

**`final_price_incl_tax`**

The final price including tax, after applying any discounts or adjustments to the total price including tax.

**`discounted_price`**

The value of the discount applied to the original price, not including taxes.

**`tax_component`**

The amount of tax that has been added before discount.

**`discounted_tax`**&#x20;

Tax component of discount.

**`discount_total`**

The total amount saved due to discounts applied on the total price.

**`final_tax_component`**

The amount of tax that has been added after discount.

**`booking_status`**

An indicator of the reservation or purchase status, such as confirmed, pending, or cancelled.

**`cancelled_at`** *nullable*

The timestamp indicating when the booking line was cancelled, if applicable. This field can be `null` if the booking line has not been cancelled.

**`created_at`**

The timestamp indicating when the booking line was initially created.

**`updated_at`**

The timestamp showing the most recent update made to the booking.

## Endpoints

## List bookings lines

> List all bookings lines

```json
{"openapi":"3.0.3","info":{"title":"Bookinglayer Private API","version":"1.0.0"},"servers":[{"url":"http://api.bookinglayer.io/private"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","scheme":"bearer","type":"http"}},"schemas":{"DateRangeFilter":{"pattern":"^\\d{4}-\\d{2}-\\d{2},\\d{4}-\\d{2}-\\d{2}$","type":"string"},"Booking":{"properties":{"id":{"format":"uuid","readOnly":true,"type":"string"},"reference":{"type":"string"},"reference_year":{"type":"string"},"reference_number":{"type":"string"},"reference_suffix":{"type":"string"},"reseller_reference":{"nullable":true,"type":"string"},"is_connect":{"type":"boolean"},"starts_at":{"format":"date-time","type":"string"},"ends_at":{"format":"date-time","type":"string"},"status":{"enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"],"type":"string"},"status_log":{"items":{"$ref":"#/components/schemas/Booking_status_log_inner"},"type":"array"},"booker_id":{"format":"uuid","type":"string"},"check_in_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"check_out_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"web_check_in_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"currency":{"format":"iso-4217","type":"string"},"commission_value":{"format":"float","type":"number"},"commission_percentage":{"format":"float","type":"number"},"channel":{"enum":["partner","backoffice","frontoffice"],"type":"string"},"locations":{"items":{"$ref":"#/components/schemas/Location"},"type":"array"},"cp_guest_management":{"type":"boolean"},"custom_fields":{"format":"json","type":"object"},"pax":{"type":"integer"},"has_transfers":{"type":"boolean"},"has_accommodation":{"type":"boolean"},"has_accommodation_transfers":{"type":"boolean"},"opened":{"type":"boolean"},"disabled_emails":{"type":"boolean"},"is_last_minute":{"type":"boolean"},"payer":{"enum":["booker","guest"],"type":"object"},"total_price_excl_tax":{"format":"float","type":"number"},"total_price_incl_tax":{"format":"float","type":"number"},"discount_total":{"format":"float","type":"number"},"final_price_excl_tax":{"format":"float","type":"number"},"final_price_incl_tax":{"format":"float","type":"number"},"tax_component":{"format":"float","type":"number"},"final_tax_component":{"format":"float","type":"number"},"invoiced_total":{"format":"float","type":"number"},"credited_total":{"format":"float","type":"number"},"due_amount":{"format":"float","type":"number"},"paid_amount":{"format":"float","type":"number"},"refund_amount":{"format":"float","type":"number"},"amount_to_refund":{"format":"float","type":"number"},"cancellation_fee_amount":{"format":"float","type":"number"},"cancellation_fee_percentage":{"format":"float","type":"number"},"google_analytics_client_id":{"nullable":true,"type":"string"},"duration_in_days":{"type":"integer"},"duration_in_nights":{"type":"integer"},"expired_at":{"format":"date-time","type":"string"},"cancelled_at":{"format":"date-time","type":"string"},"expires_at":{"format":"date-time","nullable":true,"type":"string"},"created_at":{"format":"date-time","readOnly":true,"type":"string"},"updated_at":{"format":"date-time","readOnly":true,"type":"string"}},"type":"object"},"Booking_status_log_inner":{"properties":{"status":{"enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"],"type":"string"},"date":{"format":"date-time","type":"string"}},"type":"object"},"Location":{"properties":{"id":{"description":"Location ID","type":"integer"},"backoffice_title":{"description":"Location title","type":"string"},"abbreviation":{"description":"Abbreviated location title","type":"string"},"address":{"description":"Location address","type":"string"},"zip_code":{"description":"Location zip code","type":"string"},"city":{"description":"Location city","type":"string"},"latitude":{"description":"Location latitude","format":"float","type":"number"},"longitude":{"description":"Location longitude","format":"float","type":"number"},"channex_uuid":{"description":"Channex UUID of the location. Null if the location is not exported","format":"UUID","type":"string"},"channex_export_mode":{"description":"Mode in which the location is exported to Channex.","enum":["individual","grouped"],"type":"object"},"channex_messages_module_is_enabled":{"description":"Defines whether the Channex Messages module is enabled for this location","type":"boolean"},"deleted_at":{"description":"Deletion timestamp. Null if the location is not deleted","format":"date-time","type":"string"},"created_at":{"description":"Creation timestamp","format":"date-time","type":"string"},"updated_at":{"description":"Last update timestamp","format":"date-time","type":"string"}},"type":"object"}}},"paths":{"/booking_lines":{"get":{"description":"List all bookings lines","operationId":"listBookingLines","parameters":[{"description":"Number of guests to return","in":"query","name":"limit","required":false,"schema":{"default":10,"format":"int32","maximum":100,"minimum":1,"type":"integer"}},{"description":"Page number","in":"query","name":"page","required":false,"schema":{"default":1,"format":"int32","minimum":1,"type":"integer"}},{"description":"Sorts the results based on the passed field. All possible values can be appended with \",asc\" or \",desc\"","in":"query","name":"sort_by","required":false,"schema":{"enum":["created_at"],"type":"object"}},{"description":"Expand related resources","in":"query","name":"expand","required":false,"schema":{"items":{"enum":["booking","booker","guests","product","package","product_variant"],"type":"string"},"type":"array"}},{"description":"Filter by booking status","in":"query","name":"booking_status","required":false,"schema":{"items":{"enum":["draft","request","pending","waiting_list","confirmed","deposit_paid","paid","cancelled","expired"],"type":"string"},"type":"array"}},{"description":"Filter by start date in local time","in":"query","name":"starts_at","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"description":"Filter by start time in local time","in":"query","name":"start_time","required":false,"schema":{"pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$","type":"string"}},{"description":"Filter by end date in local time","in":"query","name":"ends_at","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"description":"Filter by end time in local time","in":"query","name":"end_time","required":false,"schema":{"pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$","type":"string"}},{"description":"Filter by onsite date in local time, cancelled booking lines are excluded","in":"query","name":"onsite_at","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"description":"Filter by cancelled at date in UTC","in":"query","name":"cancelled_at","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"description":"ID(s) of the booking to filter booking lines by","explode":false,"in":"query","name":"booking_id","required":false,"schema":{"items":{"format":"uuid","type":"string"},"type":"array"},"style":"form"},{"description":"ID(s) of the product to filter booking lines by","explode":false,"in":"query","name":"product_id","required":false,"schema":{"items":{"format":"uuid","type":"string"},"type":"array"},"style":"form"},{"description":"ID(s) of the product variant to filter booking lines by","explode":false,"in":"query","name":"product_variant_id","required":false,"schema":{"items":{"format":"uuid","type":"string"},"type":"array"},"style":"form"},{"description":"Filter by product type","in":"query","name":"product_type","required":false,"schema":{"items":{"enum":["accommodation","activity","package","service","item","rental","bundle","gift_certificate","donation","transfer"],"type":"string"},"type":"array"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Booking"},"type":"array"}}},"description":"A list of booking lines"}},"summary":"List bookings lines"}}}}
```

## Fetch booking line

> Fetch a single booking line by its ID.

```json
{"openapi":"3.0.3","info":{"title":"Bookinglayer Private API","version":"1.0.0"},"servers":[{"url":"http://api.bookinglayer.io/private"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","scheme":"bearer","type":"http"}},"schemas":{"fetchBookingLine_200_response":{"properties":{"data":{"$ref":"#/components/schemas/Booking"}},"type":"object"},"Booking":{"properties":{"id":{"format":"uuid","readOnly":true,"type":"string"},"reference":{"type":"string"},"reference_year":{"type":"string"},"reference_number":{"type":"string"},"reference_suffix":{"type":"string"},"reseller_reference":{"nullable":true,"type":"string"},"is_connect":{"type":"boolean"},"starts_at":{"format":"date-time","type":"string"},"ends_at":{"format":"date-time","type":"string"},"status":{"enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"],"type":"string"},"status_log":{"items":{"$ref":"#/components/schemas/Booking_status_log_inner"},"type":"array"},"booker_id":{"format":"uuid","type":"string"},"check_in_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"check_out_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"web_check_in_status":{"enum":["nobody","somebody","everybody"],"type":"string"},"currency":{"format":"iso-4217","type":"string"},"commission_value":{"format":"float","type":"number"},"commission_percentage":{"format":"float","type":"number"},"channel":{"enum":["partner","backoffice","frontoffice"],"type":"string"},"locations":{"items":{"$ref":"#/components/schemas/Location"},"type":"array"},"cp_guest_management":{"type":"boolean"},"custom_fields":{"format":"json","type":"object"},"pax":{"type":"integer"},"has_transfers":{"type":"boolean"},"has_accommodation":{"type":"boolean"},"has_accommodation_transfers":{"type":"boolean"},"opened":{"type":"boolean"},"disabled_emails":{"type":"boolean"},"is_last_minute":{"type":"boolean"},"payer":{"enum":["booker","guest"],"type":"object"},"total_price_excl_tax":{"format":"float","type":"number"},"total_price_incl_tax":{"format":"float","type":"number"},"discount_total":{"format":"float","type":"number"},"final_price_excl_tax":{"format":"float","type":"number"},"final_price_incl_tax":{"format":"float","type":"number"},"tax_component":{"format":"float","type":"number"},"final_tax_component":{"format":"float","type":"number"},"invoiced_total":{"format":"float","type":"number"},"credited_total":{"format":"float","type":"number"},"due_amount":{"format":"float","type":"number"},"paid_amount":{"format":"float","type":"number"},"refund_amount":{"format":"float","type":"number"},"amount_to_refund":{"format":"float","type":"number"},"cancellation_fee_amount":{"format":"float","type":"number"},"cancellation_fee_percentage":{"format":"float","type":"number"},"google_analytics_client_id":{"nullable":true,"type":"string"},"duration_in_days":{"type":"integer"},"duration_in_nights":{"type":"integer"},"expired_at":{"format":"date-time","type":"string"},"cancelled_at":{"format":"date-time","type":"string"},"expires_at":{"format":"date-time","nullable":true,"type":"string"},"created_at":{"format":"date-time","readOnly":true,"type":"string"},"updated_at":{"format":"date-time","readOnly":true,"type":"string"}},"type":"object"},"Booking_status_log_inner":{"properties":{"status":{"enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"],"type":"string"},"date":{"format":"date-time","type":"string"}},"type":"object"},"Location":{"properties":{"id":{"description":"Location ID","type":"integer"},"backoffice_title":{"description":"Location title","type":"string"},"abbreviation":{"description":"Abbreviated location title","type":"string"},"address":{"description":"Location address","type":"string"},"zip_code":{"description":"Location zip code","type":"string"},"city":{"description":"Location city","type":"string"},"latitude":{"description":"Location latitude","format":"float","type":"number"},"longitude":{"description":"Location longitude","format":"float","type":"number"},"channex_uuid":{"description":"Channex UUID of the location. Null if the location is not exported","format":"UUID","type":"string"},"channex_export_mode":{"description":"Mode in which the location is exported to Channex.","enum":["individual","grouped"],"type":"object"},"channex_messages_module_is_enabled":{"description":"Defines whether the Channex Messages module is enabled for this location","type":"boolean"},"deleted_at":{"description":"Deletion timestamp. Null if the location is not deleted","format":"date-time","type":"string"},"created_at":{"description":"Creation timestamp","format":"date-time","type":"string"},"updated_at":{"description":"Last update timestamp","format":"date-time","type":"string"}},"type":"object"}}},"paths":{"/booking_lines/{booking_line_id}":{"get":{"description":"Fetch a single booking line by its ID.","operationId":"fetchBookingLine","parameters":[{"description":"Expand related resources","in":"query","name":"expand","required":false,"schema":{"items":{"enum":["booker","guests"],"type":"string"},"type":"array"}},{"description":"The ID of the booking line to fetch","in":"path","name":"booking_line_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/fetchBookingLine_200_response"}}},"description":"A booking line object"}},"summary":"Fetch booking line"}}}}
```

## Webhooks

Webhooks are a mechanism for Bookinglayer to notify other apps when something happens in the system. They are described in detail in a dedicated [Webhooks document](https://docs.bookinglayer.com/api/webhooks).

### `BookingLinesCreated`

Sends new booking line IDs via a webhook call when a booking line gets created.

```json
{
    "event": "BookingLinesCreated",
    "data": {
        "ids": [30369743, 30369745]
    }
}
```

### `BookingLinesUpdates`

Sends booking line IDs via a webhook call when an existing booking line gets updated.

```json
{
    "event": "BookingLinesUpdates",
    "data": {
        "ids": [30369743, 30369745]
    }
}
```

### `BookingLinesDeleted`

Sends deleted booking line IDs via a webhook call when a booking line gets deleted.

```json
    "event": "BookingLinesDeleted",
    "data": {
        "ids": [30369743, 30369745]
    }
}
```

### `BookingLinesCancelled`

Sends cancelled booking line IDs via a webhook call when a booking line gets cancelled.

```json
    "event": "BookingLinesCancelled",
    "data": {
        "ids": [30369743, 30369745]
    }
}
```

### `BookingLinesReinstated`

Sends reinstated booking line IDs via a webhook call when a booking line gets reinstated.

```json
    "event": "BookingLinesReinstated",
    "data": {
        "ids": [30369743, 30369745]
    }
}
```
