> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

> **Deprecated.** This method is deprecated. Planned removal date: 2025-01-01.

# Method name: queryBookings()

# Method package: wixBookingsBackend

# Method menu location: wixBookingsBackend --> Bookings --> queryBookings

# Method Link: https://dev.wix.com/docs/velo/apis/wix-bookings-backend/bookings/query-bookings.md

# Method Description:

**Deprecated.**
Query Bookings has been replaced with the Bookings V2 [Query Bookings](https://dev.wix.com/docs/api-reference/business-solutions/bookings/bookings/bookings-reader-v2/query-extended-bookings?apiView=SDK.md) SDK method and will be removed on June 30, 2026.

The `queryBookings()` function builds a query to retrieve a list of bookings and returns a [BookingsQueryBuilder](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/introduction.md) object.

The returned object contains the query definition which is typically used to run the query using the [`find()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/find.md) function.

You can refine the query by chaining `BookingsQueryBuilder` functions onto the query. `BookingsQueryBuilder` functions enable you to sort, filter, and control the results that `queryBookings()` returns.

The query runs with the following `BookingsQueryBuilder` defaults that you can override:

+ [`eq`](wix-bookings-backend.Bookings.BookingsQueryBuilder.html.#eq): `"status": "CONFIRMED"`
+ [`skip`](wix-bookings-backend.Bookings.BookingsQueryBuilder.html.#skip): `0`
+ [`limit`](wix-bookings-backend.Bookings.BookingsQueryBuilder.html.#limit): `50`
+ [`descending`](wix-bookings-backend.Bookings.BookingsQueryBuilder.html.#descending): `_createdDate`

The functions that are chained to `queryBookings()` are applied in the order they are called. For example, if you sort on the `_createdDate` property in ascending order and then on the `status` property in descending order, the results are sorted first by the created date of the items and then, if there are multiple results with the same date, the items are sorted by status in descending order, per created date value.


The following `BookingsQueryBuilder` functions are supported for `queryBookings()`. 
For a full description of the Booking object, see the object returned for the [`items`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-result/items.md) property in [`BookingsQueryResult`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-result/introduction.md). 

|Property|Filters|Description|
|--|--|--|
|`_id`|[`eq()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/eq.md)| Query for a specific booking.   `eq("_id","46ce4cd4-46ff-4aa7-9cc0-02fd4f0f3209")`|
|`contactId` | [`eq()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/eq.md)| Bookings made by the specified contact ID. `eq("contactId","8711a950-74cc-4608-80fb-8f09df9cbbf4")`|
|`sessionId`| [`eq()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/eq.md), [`hasSome()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/has-some.md)|Bookings made to a given session or a list of sessions.  `hasSome("sessionId","[193ZPR9ppP9emJUCLevcLf6orynNE45", "c8UhG9ppABemJUCLevcLf6orynNE98"] )`|
|`startTime`| [`ge()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/ge.md) , [`lt()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/lt.md), [`ascending()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/ascending.md), [`descending()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/descending.md)|Bookings with a schedule or session start time (UTC) earlier than a given time, or at a given time or later.   `ge("startTime", "2020-04-27T10:00:00.000Z")`|
|`endTime`|[`gt()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/gt.md), [`le()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/le.md)|Bookings with a schedule or session end time (UTC) later than a given time, or at a given time or earlier.  `gt("endTime", "2020-04-27T10:00:00.000Z")`|
|`status`|[`eq()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/eq.md), [`hasSome()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/has-some.md)|Bookings with a given status or a status that is in a given list of statuses.  `hasSome("status", ["CONFIRMED", "PENDING_APPROVAL","CANCELED"])`|
|`_createdDate`|[`ge()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/ge.md), [`lt()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/lt.md), [`ascending()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/ascending.md), [`descending()`](https://dev.wix.com/docs/velo/api-reference/wix-bookings-backend/bookings/bookings-query-builder/descending.md)|Bookings created at a given date or later, or earlier than a given date.  `lt("_createdDate", "2020-04-27T10:00:00.000Z")`|

You can only use one filter function for each property. If a property is used in more than one filter, only the first filter will work.

>**Notes:**
> + By default, `queryBookings()` retrieves only statuses of `"CONFIRMED"`. To retrieve all booking statuses use a `hasSome()` filter with all of the statuses.
> + When using the `queryBookings()` function immediately following a change to your bookings, the data retrieved may not contain your most recent changes. See [Wix-data and Eventual Consistency](https://dev.wix.com/docs/velo/apis/wix-data/introduction.md) for more information. To solve this problem, you can use the [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Timeouts_and_intervals#setTimeout) function to delay querying for a number of seconds, following any changes to your bookings data.
> + Only users with **[Bookings Admin](https://support.wix.com/en/article/roles-permissions-overview#bookings-admin)** permissions can retrieve other customers' bookings. You can override the permissions by setting the `suppressAuth` options to `true`.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## List all bookings

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { bookings } from 'wix-bookings-backend';

export const queryBookings = webMethod(Permissions.Anyone, () => {
  return bookings
    .queryBookings()
    .hasSome("status", ["PENDING_CHECKOUT", "CONFIRMED", "CANCELED", "PENDING", "PENDING_APPROVAL", "DECLINED"])
    .find()
    .then((queryResult) => {
      return queryResult.items;
    })
    .catch((error) => {
      return error;
    });
});
```

## Retrieve bookings that are pending approval, where the creation date is on or after December 20, 2020 at 10 am, and the start date of the session is before January 7, 2021 at 5 pm

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { bookings } from 'wix-bookings-backend';

export const queryBookings = webMethod(Permissions.Anyone, () => {
  return bookings
    .queryBookings()
    .eq("status", "PENDING_APPROVAL")
    .ge("_createdDate", "2020-12-20T10:00:00.000Z")
    .lt("startTime", "2021-01-07T17:00:00.000Z")
    .find()
    .then((queryResult) => {
      return queryResult.items;
    })
    .catch((error) => {
      return error;
    });
});
```

---