> For the complete documentation index, see [llms.txt](https://docs.bookinglayer.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bookinglayer.com/api/core-resources/booking-lines.md).

# Booking lines

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.1.0","info":{"title":"Bookinglayer Private API","version":"1.0.0"},"tags":[{"name":"Booking Lines"}],"servers":[{"url":"http://api.bookinglayer.io/private"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"DateRangeFilter":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2},\\d{4}-\\d{2}-\\d{2}$"},"Booking":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"reference":{"type":"string"},"reference_year":{"type":"string"},"reference_number":{"type":"string"},"reference_suffix":{"type":"string"},"reseller_reference":{"type":["string","null"]},"is_connect":{"type":"boolean"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"]},"status_log":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string","enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"]},"date":{"type":"string","format":"date-time"}}}},"booker_id":{"type":"string","format":"uuid"},"check_in_status":{"type":"string","enum":["nobody","somebody","everybody"]},"check_out_status":{"type":"string","enum":["nobody","somebody","everybody"]},"web_check_in_status":{"type":"string","enum":["nobody","somebody","everybody"]},"currency":{"type":"string","format":"iso-4217"},"commission_value":{"type":"number","format":"float"},"commission_percentage":{"type":"number","format":"float"},"channel":{"type":"string","enum":["partner","backoffice","frontoffice"]},"partnership_id":{"type":["integer","null"]},"partnership":{"description":"Loaded if expand contains partnership","$ref":"#/components/schemas/Partnership"},"locations":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"cp_guest_management":{"type":"boolean"},"custom_fields":{"type":"object","format":"json"},"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"]},"total_price_excl_tax":{"type":"number","format":"float"},"total_price_incl_tax":{"type":"number","format":"float"},"discount_total":{"type":"number","format":"float"},"applied_discounts":{"type":"array","description":"Discounts applied to the booking. Loaded if expand contains applied_discounts","items":{"$ref":"#/components/schemas/AppliedDiscount"}},"final_price_excl_tax":{"type":"number","format":"float"},"final_price_incl_tax":{"type":"number","format":"float"},"tax_component":{"type":"number","format":"float"},"final_tax_component":{"type":"number","format":"float"},"invoiced_total":{"type":"number","format":"float"},"credited_total":{"type":"number","format":"float"},"due_amount":{"type":"number","format":"float"},"paid_amount":{"type":"number","format":"float"},"refund_amount":{"type":"number","format":"float"},"amount_to_refund":{"type":"number","format":"float"},"cancellation_fee_amount":{"type":"number","format":"float"},"cancellation_fee_percentage":{"type":"number","format":"float"},"google_analytics_client_id":{"type":["string","null"]},"meta_client_id":{"type":["string","null"]},"duration_in_days":{"type":"integer"},"duration_in_nights":{"type":"integer"},"expired_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":"string","format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true}}},"Partnership":{"type":"object","properties":{"id":{"type":"integer"},"type":{"type":"string","enum":["channel","company"]},"agent_id":{"type":"integer"},"business_id":{"type":"integer"},"referral_code":{"type":"string"},"commission":{"type":"number","format":"float"},"commission_policy":{"type":"string","enum":["init","update"]},"color":{"type":"string"},"default_currency_id":{"type":"integer"},"payment_gateway_id":{"type":"integer"},"disable_emails":{"type":"boolean"},"email_policy":{"type":"string","enum":["send_to_partner","send_to_customer","dont_send"]},"email":{"type":"string"},"webhook":{"type":"string"},"webhook_bearer":{"type":"string"},"order_init_status":{"type":"string","enum":["draft","request","pending","confirmed","deposit_paid","paid","cancelled","expired","waiting_list"]},"order_auto_expiry_day_amount":{"type":"integer"},"my_allocator_price_modifier":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"}}},"Location":{"type":"object","properties":{"id":{"type":"integer","description":"Location ID"},"backoffice_title":{"type":"string","description":"Location title"},"abbreviation":{"type":"string","description":"Abbreviated location title"},"address":{"type":"string","description":"Location address"},"zip_code":{"type":"string","description":"Location zip code"},"city":{"type":"string","description":"Location city"},"latitude":{"type":"number","format":"float","description":"Location latitude"},"longitude":{"type":"number","format":"float","description":"Location longitude"},"channex_uuid":{"type":"string","format":"UUID","description":"Channex UUID of the location. Null if the location is not exported"},"channex_export_mode":{"description":"Mode in which the location is exported to Channex.","enum":["individual","grouped"]},"channex_messages_module_is_enabled":{"type":"boolean","description":"Defines whether the Channex Messages module is enabled for this location"},"deleted_at":{"type":"string","format":"date-time","description":"Deletion timestamp. Null if the location is not deleted"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp"},"updated_at":{"type":"string","format":"date-time","description":"Last update timestamp"}}},"AppliedDiscount":{"type":"object","properties":{"id":{"type":"integer"},"discount":{"$ref":"#/components/schemas/Discount"},"discount_title":{"type":"string","description":"Backoffice title of the discount, kept as it was when the discount got applied"},"discount_code":{"type":"string","nullable":true,"description":"Code the discount was redeemed by, null when it was applied without one"},"discount_apply_to_total":{"type":"boolean","description":"True when the discount was applied to the whole booking instead of selected lines"},"discounted_total":{"type":"number","format":"float","description":"Sum of discounted_price and discounted_tax"},"discounted_price":{"type":"number","format":"float"},"discounted_tax":{"type":"number","format":"float"},"discount_type":{"type":"string","enum":["percent","fixed"]},"translations":{"type":"object","description":"Translated titles per locale, empty when the discount carried none at the time it was applied","additionalProperties":{"type":"object","properties":{"title":{"type":"string"}}}}}},"Discount":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","description":"A coupon is handed out as codes, a discount is applied without any. Named when the discount is created and never changed afterwards.\n","enum":["coupon","discount"]},"backoffice_title":{"type":"string"},"translations":{"type":"object","properties":{"en":{"type":"object","properties":{"title":{"type":"string"}}}}},"priority":{"type":"integer"},"type":{"type":"string","enum":["fixed","percent"]},"percent":{"type":"number","description":"Percentage taken off, carried when `type` is percent. A discount is either percentage based or fixed, so `percent` and `values` never hold the discount together, `type` says which one counts.\n"},"values":{"type":"array","description":"Amount taken off per currency, carried when `type` is fixed. A booking in a currency the discount has no value for is only discounted when the business converts currencies, otherwise the discount comes to nothing.\n","items":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency code"},"value":{"type":"number"}}}},"first_code":{"type":"string","nullable":true,"description":"The oldest code of the discount, null when it has none. Only present when the `first_code` expand is requested. The whole list of codes is served by the /discounts/{discount}/codes endpoint.\n"},"usage_limit":{"type":"integer","nullable":true,"description":"Redeem limits of all codes together, null when at least one code has no limit of its own and for a discount without codes. Only present when the `codes_usage_limit` and `codes_unlimited_count` expands are requested.\n"},"usage_count":{"type":"integer","description":"Redeems of all codes together. Only present when the `codes_used_amount` expand is requested.\n"},"codes_count":{"type":"integer","description":"Number of codes of this discount. Only present when the `codes_count` expand is requested."},"apply_to_total":{"type":"boolean"},"apply_to_partners":{"type":"boolean"},"apply_to_package_items":{"type":"boolean"},"minimum_nights":{"type":"integer"},"minimum_spend":{"type":"number","description":"Amount a booking has to reach for the discount to apply, in the default currency of the business. Weighed against the booking total as it stands, without converting currencies, so a booking made in another currency is held against the same number.\n"},"minimum_persons":{"type":"integer"},"maximum_persons":{"type":"integer"},"stop_further_processing":{"type":"boolean"},"is_auto":{"type":"boolean","description":"True lets the booking engine apply the discount on its own to every booking that matches it. False keeps the booking engine from reaching for it, unless a booker types one of its codes, so it is otherwise handed out by hand in the backoffice. Only a discount runs automatically, a coupon is redeemed by its code, so the flag is turned back off when `kind` is coupon.\n"},"is_active":{"type":"boolean"},"valid_from":{"type":"string","format":"date"},"valid_to":{"type":"string","format":"date"},"early_bird_until_days":{"type":"integer","description":"Applies to bookings made at least this many days before check in. A discount can offer this end together with `last_minute_since_days`, either of them is then enough to earn it, so the early bird days have to sit above the last minute ones.\n"},"last_minute_since_days":{"type":"integer","description":"Applies to bookings made at most this many days before check in. A discount can offer this end together with `early_bird_until_days`, and a booking made somewhere between the two ends then earns neither.\n"},"check_in_date_from":{"type":"string","format":"date"},"check_in_date_to":{"type":"string","format":"date"},"valid_products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"exclude_transfers":{"type":"boolean"},"created_at":{"type":"string","format":"datetime"}}},"Product":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"root_id":{"type":"string","format":"uuid","readOnly":true},"qty":{"type":"integer","default":1},"backoffice_title":{"type":"string"},"translations":{"type":"object","properties":{"en":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"extended_description":{"type":["string","null"]},"link_url":{"type":["string","null"]},"link_title":{"type":["string","null"]},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]}}},"es":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"extended_description":{"type":["string","null"]},"link_url":{"type":["string","null"]},"link_title":{"type":["string","null"]},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]}}}}},"type":{"type":"string","enum":["accommodation","activity","package","service","item","rental","bundle","gift_certificate","donation","transfer"]},"abbreviation":{"type":"string"},"sku":{"type":"string"},"main_image":{"type":"object","properties":{"id":{"type":"integer","readOnly":true},"original":{"type":"string","format":"uri"},"tiny":{"type":"string","format":"uri"},"small":{"type":"string","format":"uri"},"medium":{"type":"string","format":"uri"},"large":{"type":"string","format":"uri"},"created_at":{"type":"string","format":"date-time","readOnly":true}}},"category_id":{"type":"integer"},"accommodation_type_id":{"type":"integer"},"has_accommodation":{"type":"boolean"},"location_id":{"type":"integer"},"ghost_parent_id":{"type":["string","null"],"format":"UUID","description":"UUID of the ghost parent"},"default_start_time":{"type":["string","null"],"format":"time"},"default_end_time":{"type":["string","null"],"format":"time"},"deleted_at":{"type":["string","null"],"format":"date-time","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"special_group_id":{"type":["string","null"],"description":"Slug of the product special group the product belongs to. Required when the business is using special groups."}},"required":["backoffice_title","location_id","category_id","type"]}}},"paths":{"/booking_lines":{"get":{"tags":["Booking Lines"],"summary":"List bookings lines","description":"List all bookings lines","operationId":"listBookingLines","parameters":[{"name":"limit","in":"query","description":"Number of guests to return","required":false,"schema":{"type":"integer","format":"int32","minimum":1,"maximum":100,"default":10}},{"name":"page","in":"query","description":"Page number","required":false,"schema":{"type":"integer","format":"int32","minimum":1,"default":1}},{"name":"sort_by","in":"query","description":"Sorts the results based on the passed field. All possible values can be appended with \",asc\" or \",desc\"","required":false,"schema":{"enum":["created_at","guest.full_name","guest.booking_related_data.checked_in_at","guest.booking_related_data.checked_out_at"]}},{"name":"expand","in":"query","description":"Expand related resources","required":false,"schema":{"items":{"enum":["booking","booker","guests","product","package","product_variant"],"type":"string"},"type":"array"}},{"name":"booking_status","in":"query","description":"Filter by booking status","required":false,"schema":{"type":"array","items":{"type":"string","enum":["draft","request","pending","waiting_list","confirmed","deposit_paid","paid","cancelled","expired"]}}},{"name":"starts_at","in":"query","description":"Filter by start date in local time","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"name":"start_time","in":"query","description":"Filter by start time in local time","required":false,"schema":{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"}},{"name":"ends_at","in":"query","description":"Filter by end date in local time","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"name":"end_time","in":"query","description":"Filter by end time in local time","required":false,"schema":{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"}},{"name":"onsite_at","in":"query","description":"Filter by onsite date in local time, cancelled booking lines are excluded","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"name":"cancelled_at","in":"query","description":"Filter by cancelled at date in UTC","required":false,"schema":{"$ref":"#/components/schemas/DateRangeFilter"}},{"name":"booking_id","in":"query","description":"ID(s) of the booking to filter booking lines by","required":false,"style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"product_id","in":"query","description":"ID(s) of the product to filter booking lines by","required":false,"style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"product_variant_id","in":"query","description":"ID(s) of the product variant to filter booking lines by","required":false,"style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","format":"uuid"}}},{"name":"product_type","in":"query","description":"Filter by product type","required":false,"schema":{"type":"array","items":{"type":"string","enum":["accommodation","activity","package","service","item","rental","bundle","gift_certificate","donation","transfer"]}}}],"responses":{"200":{"description":"A list of booking lines","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Booking"}}}}}}}}}}
```

## Fetch booking line

> Fetch a single booking line by its ID.

```json
{"openapi":"3.1.0","info":{"title":"Bookinglayer Private API","version":"1.0.0"},"tags":[{"name":"Booking Lines"}],"servers":[{"url":"http://api.bookinglayer.io/private"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Booking":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"reference":{"type":"string"},"reference_year":{"type":"string"},"reference_number":{"type":"string"},"reference_suffix":{"type":"string"},"reseller_reference":{"type":["string","null"]},"is_connect":{"type":"boolean"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"]},"status_log":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string","enum":["draft","pending","confirmed","deposit_paid","paid","expired","cancelled","waiting_list"]},"date":{"type":"string","format":"date-time"}}}},"booker_id":{"type":"string","format":"uuid"},"check_in_status":{"type":"string","enum":["nobody","somebody","everybody"]},"check_out_status":{"type":"string","enum":["nobody","somebody","everybody"]},"web_check_in_status":{"type":"string","enum":["nobody","somebody","everybody"]},"currency":{"type":"string","format":"iso-4217"},"commission_value":{"type":"number","format":"float"},"commission_percentage":{"type":"number","format":"float"},"channel":{"type":"string","enum":["partner","backoffice","frontoffice"]},"partnership_id":{"type":["integer","null"]},"partnership":{"description":"Loaded if expand contains partnership","$ref":"#/components/schemas/Partnership"},"locations":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"cp_guest_management":{"type":"boolean"},"custom_fields":{"type":"object","format":"json"},"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"]},"total_price_excl_tax":{"type":"number","format":"float"},"total_price_incl_tax":{"type":"number","format":"float"},"discount_total":{"type":"number","format":"float"},"applied_discounts":{"type":"array","description":"Discounts applied to the booking. Loaded if expand contains applied_discounts","items":{"$ref":"#/components/schemas/AppliedDiscount"}},"final_price_excl_tax":{"type":"number","format":"float"},"final_price_incl_tax":{"type":"number","format":"float"},"tax_component":{"type":"number","format":"float"},"final_tax_component":{"type":"number","format":"float"},"invoiced_total":{"type":"number","format":"float"},"credited_total":{"type":"number","format":"float"},"due_amount":{"type":"number","format":"float"},"paid_amount":{"type":"number","format":"float"},"refund_amount":{"type":"number","format":"float"},"amount_to_refund":{"type":"number","format":"float"},"cancellation_fee_amount":{"type":"number","format":"float"},"cancellation_fee_percentage":{"type":"number","format":"float"},"google_analytics_client_id":{"type":["string","null"]},"meta_client_id":{"type":["string","null"]},"duration_in_days":{"type":"integer"},"duration_in_nights":{"type":"integer"},"expired_at":{"type":"string","format":"date-time"},"cancelled_at":{"type":"string","format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true}}},"Partnership":{"type":"object","properties":{"id":{"type":"integer"},"type":{"type":"string","enum":["channel","company"]},"agent_id":{"type":"integer"},"business_id":{"type":"integer"},"referral_code":{"type":"string"},"commission":{"type":"number","format":"float"},"commission_policy":{"type":"string","enum":["init","update"]},"color":{"type":"string"},"default_currency_id":{"type":"integer"},"payment_gateway_id":{"type":"integer"},"disable_emails":{"type":"boolean"},"email_policy":{"type":"string","enum":["send_to_partner","send_to_customer","dont_send"]},"email":{"type":"string"},"webhook":{"type":"string"},"webhook_bearer":{"type":"string"},"order_init_status":{"type":"string","enum":["draft","request","pending","confirmed","deposit_paid","paid","cancelled","expired","waiting_list"]},"order_auto_expiry_day_amount":{"type":"integer"},"my_allocator_price_modifier":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"deleted_at":{"type":"string","format":"date-time"}}},"Location":{"type":"object","properties":{"id":{"type":"integer","description":"Location ID"},"backoffice_title":{"type":"string","description":"Location title"},"abbreviation":{"type":"string","description":"Abbreviated location title"},"address":{"type":"string","description":"Location address"},"zip_code":{"type":"string","description":"Location zip code"},"city":{"type":"string","description":"Location city"},"latitude":{"type":"number","format":"float","description":"Location latitude"},"longitude":{"type":"number","format":"float","description":"Location longitude"},"channex_uuid":{"type":"string","format":"UUID","description":"Channex UUID of the location. Null if the location is not exported"},"channex_export_mode":{"description":"Mode in which the location is exported to Channex.","enum":["individual","grouped"]},"channex_messages_module_is_enabled":{"type":"boolean","description":"Defines whether the Channex Messages module is enabled for this location"},"deleted_at":{"type":"string","format":"date-time","description":"Deletion timestamp. Null if the location is not deleted"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp"},"updated_at":{"type":"string","format":"date-time","description":"Last update timestamp"}}},"AppliedDiscount":{"type":"object","properties":{"id":{"type":"integer"},"discount":{"$ref":"#/components/schemas/Discount"},"discount_title":{"type":"string","description":"Backoffice title of the discount, kept as it was when the discount got applied"},"discount_code":{"type":"string","nullable":true,"description":"Code the discount was redeemed by, null when it was applied without one"},"discount_apply_to_total":{"type":"boolean","description":"True when the discount was applied to the whole booking instead of selected lines"},"discounted_total":{"type":"number","format":"float","description":"Sum of discounted_price and discounted_tax"},"discounted_price":{"type":"number","format":"float"},"discounted_tax":{"type":"number","format":"float"},"discount_type":{"type":"string","enum":["percent","fixed"]},"translations":{"type":"object","description":"Translated titles per locale, empty when the discount carried none at the time it was applied","additionalProperties":{"type":"object","properties":{"title":{"type":"string"}}}}}},"Discount":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","description":"A coupon is handed out as codes, a discount is applied without any. Named when the discount is created and never changed afterwards.\n","enum":["coupon","discount"]},"backoffice_title":{"type":"string"},"translations":{"type":"object","properties":{"en":{"type":"object","properties":{"title":{"type":"string"}}}}},"priority":{"type":"integer"},"type":{"type":"string","enum":["fixed","percent"]},"percent":{"type":"number","description":"Percentage taken off, carried when `type` is percent. A discount is either percentage based or fixed, so `percent` and `values` never hold the discount together, `type` says which one counts.\n"},"values":{"type":"array","description":"Amount taken off per currency, carried when `type` is fixed. A booking in a currency the discount has no value for is only discounted when the business converts currencies, otherwise the discount comes to nothing.\n","items":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency code"},"value":{"type":"number"}}}},"first_code":{"type":"string","nullable":true,"description":"The oldest code of the discount, null when it has none. Only present when the `first_code` expand is requested. The whole list of codes is served by the /discounts/{discount}/codes endpoint.\n"},"usage_limit":{"type":"integer","nullable":true,"description":"Redeem limits of all codes together, null when at least one code has no limit of its own and for a discount without codes. Only present when the `codes_usage_limit` and `codes_unlimited_count` expands are requested.\n"},"usage_count":{"type":"integer","description":"Redeems of all codes together. Only present when the `codes_used_amount` expand is requested.\n"},"codes_count":{"type":"integer","description":"Number of codes of this discount. Only present when the `codes_count` expand is requested."},"apply_to_total":{"type":"boolean"},"apply_to_partners":{"type":"boolean"},"apply_to_package_items":{"type":"boolean"},"minimum_nights":{"type":"integer"},"minimum_spend":{"type":"number","description":"Amount a booking has to reach for the discount to apply, in the default currency of the business. Weighed against the booking total as it stands, without converting currencies, so a booking made in another currency is held against the same number.\n"},"minimum_persons":{"type":"integer"},"maximum_persons":{"type":"integer"},"stop_further_processing":{"type":"boolean"},"is_auto":{"type":"boolean","description":"True lets the booking engine apply the discount on its own to every booking that matches it. False keeps the booking engine from reaching for it, unless a booker types one of its codes, so it is otherwise handed out by hand in the backoffice. Only a discount runs automatically, a coupon is redeemed by its code, so the flag is turned back off when `kind` is coupon.\n"},"is_active":{"type":"boolean"},"valid_from":{"type":"string","format":"date"},"valid_to":{"type":"string","format":"date"},"early_bird_until_days":{"type":"integer","description":"Applies to bookings made at least this many days before check in. A discount can offer this end together with `last_minute_since_days`, either of them is then enough to earn it, so the early bird days have to sit above the last minute ones.\n"},"last_minute_since_days":{"type":"integer","description":"Applies to bookings made at most this many days before check in. A discount can offer this end together with `early_bird_until_days`, and a booking made somewhere between the two ends then earns neither.\n"},"check_in_date_from":{"type":"string","format":"date"},"check_in_date_to":{"type":"string","format":"date"},"valid_products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"exclude_transfers":{"type":"boolean"},"created_at":{"type":"string","format":"datetime"}}},"Product":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"root_id":{"type":"string","format":"uuid","readOnly":true},"qty":{"type":"integer","default":1},"backoffice_title":{"type":"string"},"translations":{"type":"object","properties":{"en":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"extended_description":{"type":["string","null"]},"link_url":{"type":["string","null"]},"link_title":{"type":["string","null"]},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]}}},"es":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":["string","null"]},"extended_description":{"type":["string","null"]},"link_url":{"type":["string","null"]},"link_title":{"type":["string","null"]},"meta_title":{"type":["string","null"]},"meta_description":{"type":["string","null"]}}}}},"type":{"type":"string","enum":["accommodation","activity","package","service","item","rental","bundle","gift_certificate","donation","transfer"]},"abbreviation":{"type":"string"},"sku":{"type":"string"},"main_image":{"type":"object","properties":{"id":{"type":"integer","readOnly":true},"original":{"type":"string","format":"uri"},"tiny":{"type":"string","format":"uri"},"small":{"type":"string","format":"uri"},"medium":{"type":"string","format":"uri"},"large":{"type":"string","format":"uri"},"created_at":{"type":"string","format":"date-time","readOnly":true}}},"category_id":{"type":"integer"},"accommodation_type_id":{"type":"integer"},"has_accommodation":{"type":"boolean"},"location_id":{"type":"integer"},"ghost_parent_id":{"type":["string","null"],"format":"UUID","description":"UUID of the ghost parent"},"default_start_time":{"type":["string","null"],"format":"time"},"default_end_time":{"type":["string","null"],"format":"time"},"deleted_at":{"type":["string","null"],"format":"date-time","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"special_group_id":{"type":["string","null"],"description":"Slug of the product special group the product belongs to. Required when the business is using special groups."}},"required":["backoffice_title","location_id","category_id","type"]}}},"paths":{"/booking_lines/{booking_line_id}":{"get":{"tags":["Booking Lines"],"summary":"Fetch booking line","description":"Fetch a single booking line by its ID.","operationId":"fetchBookingLine","parameters":[{"name":"expand","in":"query","description":"Expand related resources","required":false,"schema":{"items":{"enum":["booker","guests"],"type":"string"},"type":"array"}},{"name":"booking_line_id","in":"path","description":"The ID of the booking line to fetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"A booking line object","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Booking"}}}}}}}}}}}
```

## 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](/api/webhooks.md).

### `BookingLinesCreated`

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

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

### `BookingLinesUpdated`

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

```json
{
    "event": "BookingLinesUpdated",
    "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]
    }
}
```
