> 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

# QueryLocations

# Package: services

# Namespace: ServicesService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-locations.md

## Permission Scopes:
Read Bookings - Public Data: SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC

## Introduction

Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md),
given the provided filtering, and whether each location is connected to at
least one of the site's services.

---

## REST API

### Schema

```
 Method: queryLocations
 Description: Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md), given the provided filtering, and whether each location is connected to at least one of the site's services.   ### Defaults  Query Locations has the following default setting, which you can't override: Sorted by `id` in ascending order.  ### Filters  For a complete list of supported filters, refer to the `location` object ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object.md)).  When using date filters, you must use [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  ### See also  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md).
 URL: https://www.wixapis.com/_api/bookings/v2/services/locations/query
 Method: POST
 Method parameters:
   param name: filter | type: QueryLocationsFilter    
        - name: services | type: object | description: Service filter. See [Query Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-services.md) for a list of supported filters.  
        - name: businessLocationIds | type: array<string> | description: List of business GUIDs to filter by.  | validation: maxItems 100, format GUID
 Return type: QueryLocationsResponse
  - name: businessLocations | type: BusinessLocations | description: Retrieved business locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved business locations.  
     - name: locations | type: array<Location> | description: Retrieved business locations.  | validation: maxItems 100
        - ONE-OF: 
           - name: business | type: BusinessLocationOptions | description: Information about business locations. Required when `type` is `BUSINESS`.  
              - name: id | type: string | description: GUID of the business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). When setting a business location, specify only the location GUID. Other location details are overwritten.  | validation: format GUID
              - name: name | type: string | description: Business location name.  | read-only: true | validation: maxLength 150
              - name: default | type: boolean | description: Whether this is the default location. There can only be a single default location per site.  | read-only: true 
              - name: address | type: Address | description: Business location address.  | read-only: true 
                 - ONE-OF: 
                    - name: streetAddress | type: StreetAddress | description: Street name and number.  
                       - name: number | type: string | description: Street number.  | validation: maxLength 255
                       - name: name | type: string | description: Street name.  | validation: maxLength 255
                       - name: apt | type: string | description: Apartment number.  | validation: maxLength 255
                    - name: addressLine | type: string | description:   | validation: maxLength 255
                 - name: country | type: string | description: 2-letter country code in an [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format.  | validation: format COUNTRY
                 - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.  | validation: maxLength 255
                 - name: city | type: string | description: City name.  | validation: maxLength 255
                 - name: postalCode | type: string | description: Postal or zip code.  | validation: maxLength 255
                 - name: formattedAddress | type: string | description: Full address of the location.  | validation: maxLength 512
              - name: email | type: string | description: Business location email.  | read-only: true | validation: format EMAIL
              - name: phone | type: string | description: Business location phone.  | read-only: true | validation: format PHONE
           - name: custom | type: CustomLocationOptions | description: Information about custom locations. Required when `type` is `CUSTOM`.  
              - name: id | type: string | description: GUID of the custom location.  | read-only: true | validation: format GUID
              - name: address | type: Address | description: Address of the custom location.  
        - name: id | type: string | description: Location GUID.  | read-only: true | validation: format GUID
        - name: type | type: LocationType | description: Location type.  Default: `CUSTOM`  
             - enum:
             -     CUSTOM: Location set by the business that is not a standard business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).
             -     BUSINESS: Business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).
             -     CUSTOMER: The customer specifies any address when booking. Available only for appointment-based services.
        - name: calculatedAddress | type: Address | description: Location address. Empty for `{"type": "CUSTOMER"}`.  | read-only: true 
  - name: customLocations | type: CustomLocations | description: Retrieved custom locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved custom locations.  
  - name: customerLocations | type: CustomerLocations | description: Retrieved customer locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved customer locations.  


```

### Examples

### Query locations
```curl
curl -X POST 'https://www.wixapis.com/bookings/v2/services/locations/query' \
-H 'Authorization: <AUTH>' \
-d '{
  "filter": {
    "businessLocationIds": ["11f78622-ae7e-44d8-94e1-b2b4a77d0ffe"]
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.services.queryLocations(options)
 Description: Retrieves 3 separate lists of business, custom, and customer [locations](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md), given the provided filtering, and whether each location is connected to at least one of the site's services.   ### Defaults  Query Locations has the following default setting, which you can't override: Sorted by `id` in ascending order.  ### Filters  For a complete list of supported filters, refer to the `location` object ([REST](https://dev.wix.com/docs/rest/business-management/locations/location-object.md)).  When using date filters, you must use [UTC time](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  ### See also  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md) and [Sorting and Paging](https://dev.wix.com/docs/rest/articles/getting-started/sorting-and-paging.md).
 Method parameters:
   param name: options | type: QueryLocationsOptions  none  
        - name: filter | type: QueryLocationsFilter | description: Filter.  
           - name: services | type: object | description: Service filter. See [Query Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-services.md) for a list of supported filters.  
           - name: businessLocationIds | type: array<string> | description: List of business GUIDs to filter by.  | validation: maxItems 100, format GUID
 Return type: PROMISE<QueryLocationsResponse>
  - name: businessLocations | type: BusinessLocations | description: Retrieved business locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved business locations.  
     - name: locations | type: array<Location> | description: Retrieved business locations.  | validation: maxItems 100
        - ONE-OF: 
           - name: business | type: BusinessLocationOptions | description: Information about business locations. Required when `type` is `BUSINESS`.  
              - name: _id | type: string | description: GUID of the business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). When setting a business location, specify only the location GUID. Other location details are overwritten.  | validation: format GUID
              - name: name | type: string | description: Business location name.  | read-only: true | validation: maxLength 150
              - name: default | type: boolean | description: Whether this is the default location. There can only be a single default location per site.  | read-only: true 
              - name: address | type: Address | description: Business location address.  | read-only: true 
                 - name: city | type: string | description: none  
                 - name: subdivision | type: string | description: none  
                 - name: country | type: string | description: none  
                 - name: postalCode | type: string | description: none  
                 - name: addressLine1 | type: string | description: none  
              - name: email | type: string | description: Business location email.  | read-only: true | validation: format EMAIL
              - name: phone | type: string | description: Business location phone.  | read-only: true | validation: format PHONE
           - name: custom | type: CustomLocationOptions | description: Information about custom locations. Required when `type` is `CUSTOM`.  
              - name: _id | type: string | description: GUID of the custom location.  | read-only: true | validation: format GUID
              - name: address | type: Address | description: Address of the custom location.  
        - name: _id | type: string | description: Location GUID.  | read-only: true | validation: format GUID
        - name: type | type: LocationType | description: Location type.  Default: `CUSTOM`  
             - enum:
             -     CUSTOM: Location set by the business that is not a standard business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).
             -     BUSINESS: Business [location](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md).
             -     CUSTOMER: The customer specifies any address when booking. Available only for appointment-based services.
        - name: calculatedAddress | type: Address | description: Location address. Empty for `{"type": "CUSTOMER"}`.  | read-only: true 
  - name: customLocations | type: CustomLocations | description: Retrieved custom locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved custom locations.  
  - name: customerLocations | type: CustomerLocations | description: Retrieved customer locations and whether each location is connected to at least one service.  
     - name: exists | type: boolean | description: Whether at least one service matching the filter is connected to any of the retrieved customer locations.  


```

### Examples

### queryLocations
```javascript
import { services } from '@wix/bookings';

async function queryLocations(options) {
  const response = await services.queryLocations(options);
};
```

### queryLocations (with elevated permissions)
```javascript
import { services } from '@wix/bookings';
import { auth } from '@wix/essentials';

async function myQueryLocationsMethod(options) {
  const elevatedQueryLocations = auth.elevate(services.queryLocations);
  const response = await elevatedQueryLocations(options);
}
```

### queryLocations (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { services } from '@wix/bookings';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { services },
  // Include the auth strategy and host as relevant
});


async function queryLocations(options) {
  const response = await myWixClient.services.queryLocations(options);
};
```

---