> 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: locations

# Namespace: LocationsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/locations/query-locations?apiView=SDK.md

## Permission Scopes:
Read Locations: SCOPE.DC-MULTILOCATION.READ-LOCATIONS

## Introduction

Retrieves locations, given the specified filters, sorting, and paging.

---

## REST API

### Schema

```
 Method: queryLocations
 Description: Retrieves locations, given the specified filters, sorting, and paging.
 URL: https://www.wixapis.com/locations/v1/locations/query
 Method: POST
 Method parameters:
   param name: filterAuthorizedLocationEntities | type: filterAuthorizedLocationEntities | description: Whether to filter only authorized locations  
   param name: query | type: Query    
        - name: filter | type: Value | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
           - ONE-OF: 
              - name: nullValue | type:  | description:   
              - name: numberValue | type: number | description:   
              - name: stringValue | type: string | description:   
              - name: boolValue | type: boolean | description:   
              - name: structValue | type: object | description:   
              - name: listValue | type: ListValue | description:   
                 - name: values | type: array<Value> | description:   
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  | validation: format double
              - name: longitude | type: number | description: Address longitude.  | validation: format double
        - name: paging | type: Paging | description: Paging options to limit and skip the number of items.  
           - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, format int32
           - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
        - name: fields | type: array<string> | description: Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned.  
        - name: fieldsets | type: array<string> | description: Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned.  
 Query fields:
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: description | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: default | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: status | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: locationType | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: fax | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: timeZone | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: email | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: phone | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.subdivision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.city | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.postalCode | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.streetAddress.number | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.streetAddress.name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.streetAddress.apt | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.formattedAddress | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.hint | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.geocode.latitude | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.geocode.longitude | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.openDay | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.openTime | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.closeDay | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.closeTime | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.startDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.endDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.isClosed | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.comment | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: revision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: none | aggregatable: undefined | searchable: undefined
   - field: archived | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
 Return type: QueryLocationsResponse
  - name: locations | type: array<Location> | description: Retrieved locations.  
     - name: id | type: string | description: Location GUID.  | read-only: true | validation: format GUID
     - name: name | type: string | description: Location name.  | validation: maxLength 150
     - name: description | type: string | description: Location description.  | validation: maxLength 500
     - name: default | type: boolean | description: Whether this is the default location. There can only be one default location per site. The default location can't be archived.  | read-only: true 
     - name: status | type: LocationStatus | description: Location status. Defaults to `ACTIVE`. __Notes:__ - [Archiving a location](https://dev.wix.com/api/rest/business-info/locations/archive-location) doesn't affect the location's status. - `INACTIVE` status is currently not supported.  
         - enum: ACTIVE, INACTIVE
     - name: fax | type: string | description: Fax number.  
     - name: timeZone | type: string | description: Timezone in `America/New_York` format.  
     - name: email | type: string | description: Email address.  
     - name: phone | type: string | description: Phone number.  
     - name: address | type: Address | description: Address.  
        - 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.  
        - name: city | type: string | description: City name.  
        - name: postalCode | type: string | description: Postal or zip code.  | validation: maxLength 20
        - name: streetAddress | type: StreetAddress | description: Street address. Includes street name, number, and apartment number in separate fields.  
           - name: number | type: string | description: Street number.  
           - name: name | type: string | description: Street name.  
           - name: apt | type: string | description: Apartment number.  
        - name: formattedAddress | type: string | description: Full address of the location.  
        - name: hint | type: string | description: Extra information that helps finding the location.  | validation: maxLength 500
        - name: geocode | type: AddressLocation | description: Geographic coordinates of location.  
           - name: latitude | type: number | description: Latitude of the location. Must be between -90 and 90.  | validation: format double
           - name: longitude | type: number | description: Longitude of the location. Must be between -180 and 180.  | validation: format double
     - name: businessSchedule | type: BusinessSchedule | description: Business schedule. Array of weekly recurring time periods when the location is open for business. Limited to 100 time periods.  __Note:__ Not supported by Wix Bookings.  
        - name: periods | type: array<TimePeriod> | description: Weekly recurring time periods when the business is regularly open or the service is available. Limited to 100 time periods.  | validation: maxItems 100
           - name: openDay | type: DayOfWeek | description: Day of the week the period starts on.  
                 - enum: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
           - name: openTime | type: string | description: Time the period starts in 24-hour [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) extended format. Valid values are `00:00` to `24:00`, where `24:00` represents midnight at the end of the specified day.  
           - name: closeDay | type: DayOfWeek | description: Day of the week the period ends on.  
           - name: closeTime | type: string | description: Time the period ends in 24-hour [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) extended format. Valid values are `00:00` to `24:00`, where `24:00` represents midnight at the end of the specified day.  __Note:__ If `openDay` and `closeDay` specify the same day of the week `closeTime` must be later than `openTime`.  
        - name: specialHourPeriod | type: array<SpecialHourPeriod> | description: Exceptions to the business's regular hours. The business can be open or closed during the exception.  | validation: maxItems 100
           - name: startDate | type: string | description: Start date and time of the exception in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format and [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  
           - name: endDate | type: string | description: End date and time of the exception in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format and [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  
           - name: isClosed | type: boolean | description: Whether the business is closed (or the service is not available) during the exception.  Default: `true`.  
           - name: comment | type: string | description: Additional info about the exception. For example, "We close earlier on New Year's Eve."  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the location is updated. To prevent conflicting changes, the existing revision must be used when updating a location.  | validation: format int64
     - name: archived | type: boolean | description: Whether the location is archived. Archived locations can't be updated. __Note:__ [Archiving a location](https://dev.wix.com/api/rest/business-info/locations/archive-location) doesn't affect its `status`.  | read-only: true 
     - name: locationTypes | type: array<LocationType> | description: Location types.  | validation: maxItems 10
         - enum: UNKNOWN, BRANCH, OFFICES, RECEPTION, HEADQUARTERS, INVENTORY
     - name: extendedFields | type: ExtendedFields | description: Extended fields for data extensions.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
  - name: pagingMetadata | type: PagingMetadata | description: Paging info.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page.  
  - name: authorizedLocationEntities | type: array<string> | description: Ids of the locations that the requesting entity can manage  | validation: minItems 0, maxItems 100, format GUID


```

### Examples

### Query Locations
```curl
curl -X POST \
   'https://www.wixapis.com/locations/v1/locations/query' \
   -H 'Content-Type: application/json' \
   -H 'Authorization: <AUTH>' \
   --data-binary '{
      "query": {
        "filter": {
          "archived": false
        },
        "sort":[{"fieldName":"name","order":"ASC"}]
      }
   }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.businessTools.locations.queryLocations(query, options)
 Description: Retrieves locations, given the specified filters, sorting, and paging.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  query
 Method parameters: 
   param name: query | type: LocationQuery   | required: true 
        - name: filter | type: any<Value> | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
           - ONE-OF: 
              - name: nullValue | type:  | description:   
              - name: numberValue | type: number | description:   
              - name: stringValue | type: string | description:   
              - name: boolValue | type: boolean | description:   
              - name: structValue | type: object | description:   
              - name: listValue | type: ListValue | description:   
                 - name: values | type: array<Value> | description:   
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
        - name: paging | type: Paging | description: Paging options to limit and skip the number of items.  
           - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, format int32
           - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
   param name: options | type: QueryLocationsOptions  none  
        - name: filterAuthorizedLocationEntities | type: boolean | description: Whether to filter only authorized locations  
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: description | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: default | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: status | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: locationType | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: fax | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: timeZone | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: email | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: phone | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.subdivision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.city | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.postalCode | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.streetAddress.number | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: address.streetAddress.name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.openDay | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.openTime | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.closeDay | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.periods.closeTime | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.startDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.endDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.isClosed | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
   - field: businessSchedule.specialHourPeriod.comment | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: revision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: none | aggregatable: undefined | searchable: undefined
   - field: archived | operators: $eq, $ne, $in, $exists | sort: none | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryLocationsResponse>
  - name: locations | type: array<Location> | description: Retrieved locations.  
     - name: _id | type: string | description: Location GUID.  | read-only: true | validation: format GUID
     - name: name | type: string | description: Location name.  | validation: maxLength 150
     - name: description | type: string | description: Location description.  | validation: maxLength 500
     - name: default | type: boolean | description: Whether this is the default location. There can only be one default location per site. The default location can't be archived.  | read-only: true 
     - name: status | type: LocationStatus | description: Location status. Defaults to `ACTIVE`. __Notes:__ - [Archiving a location](https://dev.wix.com/api/rest/business-info/locations/archive-location) doesn't affect the location's status. - `INACTIVE` status is currently not supported.  
         - enum: ACTIVE, INACTIVE
     - name: fax | type: string | description: Fax number.  
     - name: timeZone | type: string | description: Timezone in `America/New_York` format.  
     - name: email | type: string | description: Email address.  
     - name: phone | type: string | description: Phone number.  
     - name: address | type: Address | description: Address.  
        - name: streetAddress | type: StreetAddress | description: none  
           - name: name | type: string | description: none  
           - name: number | type: string | description: none  
        - 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: businessSchedule | type: BusinessSchedule | description: Business schedule. Array of weekly recurring time periods when the location is open for business. Limited to 100 time periods.  __Note:__ Not supported by Wix Bookings.  
        - name: periods | type: array<TimePeriod> | description: Weekly recurring time periods when the business is regularly open or the service is available. Limited to 100 time periods.  | validation: maxItems 100
           - name: openDay | type: DayOfWeek | description: Day of the week the period starts on.  
                 - enum: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
           - name: openTime | type: string | description: Time the period starts in 24-hour [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) extended format. Valid values are `00:00` to `24:00`, where `24:00` represents midnight at the end of the specified day.  
           - name: closeDay | type: DayOfWeek | description: Day of the week the period ends on.  
           - name: closeTime | type: string | description: Time the period ends in 24-hour [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) extended format. Valid values are `00:00` to `24:00`, where `24:00` represents midnight at the end of the specified day.  __Note:__ If `openDay` and `closeDay` specify the same day of the week `closeTime` must be later than `openTime`.  
        - name: specialHourPeriod | type: array<SpecialHourPeriod> | description: Exceptions to the business's regular hours. The business can be open or closed during the exception.  | validation: maxItems 100
           - name: startDate | type: string | description: Start date and time of the exception in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format and [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  
           - name: endDate | type: string | description: End date and time of the exception in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format and [Coordinated Universal Time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time).  
           - name: isClosed | type: boolean | description: Whether the business is closed (or the service is not available) during the exception.  Default: `true`.  
           - name: comment | type: string | description: Additional info about the exception. For example, "We close earlier on New Year's Eve."  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the location is updated. To prevent conflicting changes, the existing revision must be used when updating a location.  | validation: format int64
     - name: archived | type: boolean | description: Whether the location is archived. Archived locations can't be updated. __Note:__ [Archiving a location](https://dev.wix.com/api/rest/business-info/locations/archive-location) doesn't affect its `status`.  | read-only: true 
     - name: locationTypes | type: array<LocationType> | description: Location types.  | validation: maxItems 10
         - enum: UNKNOWN, BRANCH, OFFICES, RECEPTION, HEADQUARTERS, INVENTORY
     - name: extendedFields | type: ExtendedFields | description: Extended fields for data extensions.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
  - name: pagingMetadata | type: PagingMetadata | description: Paging info.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: hasNext | type: boolean | description: Indicates if there are more results after the current page. If `true`, another page of results can be retrieved. If `false`, this is the last page.  
  - name: authorizedLocationEntities | type: array<string> | description: Ids of the locations that the requesting entity can manage  | validation: minItems 0, maxItems 100, format GUID


```

### Examples

### Retrieve locations using multiple filters (with $w)
This is an example of a page where user searches for locations, and the search results populates a dropdown. The query only returns active locations.

```javascript
/*******************************************
 * Backend code - query-location.web.js/ts *
 ******************************************/

import { Permissions, webMethod } from '@wix/web-methods';
import { locations } from '@wix/business-tools';
import { auth } from '@wix/essentials';

export const queryLocationsByNameStart = webMethod(Permissions.Anyone, async (searchInput) => {
  try {
    const elevatedQueryLocations = auth.elevate(locations.queryLocations)
    const result = await elevatedQueryLocations()
      .startsWith('name', searchInput)
      .eq('status', 'ACTIVE')
      .find();

    return result.items;
  } catch (error) {
    console.error(error);
    throw new Error(error);
  }
});

/*************
 * Page code *
 ************/

import { queryLocationsByNameStart } from 'backend/query-location.web';

$w.onReady(() => {
  $w('#getBranchLocations').onClick(async () => {
    const searchName = $w('#search').value;
    const locations = await queryLocationsByNameStart(searchName);

    const dropdownOptions = locations.map((location) => {
      return {
        label: location.name,
        value: location._id
      }
    });
    $w('#locationsDropdown').options = dropdownOptions;
  });
});

```

### Retrieve all locations (with elevated permissions)
```javascript
import { locations } from '@wix/business-tools';
import { auth } from '@wix/essentials';

export async function myQueryLocationsFunction() {
  try {
    const elevatedQueryLocations = auth.elevate(locations.queryLocations);
    const myLocations = await elevatedQueryLocations().find();
    const items = myLocations.items;
    console.log('Locations:', items);

    return items;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Returns items:
 * [
 *   {
 *     "_id": "5c6e81a4-5270-4f66-9688-49d1fd9153ef",
 *     "address": {
 *       "city": "Amsterdam",
 *       "country": "NL",
 *       "formatted": "CityHub, Bellamystraat, Amsterdam, Netherlands",
 *       "location": {
 *         "latitude": 52.3672879,
 *         "longitude": 4.867098899999998
 *       },
 *       "postalCode": "1053 BE",
 *       "streetAddress": {
 *         "apt": "",
 *         "name": "Bellamystraat",
 *         "number": "3"
 *       },
 *       "subdivision": "NH"
 *     },
 *     "archived": false,
 *     "businessSchedule": {
 *       "periods": [],
 *       "specialHourPeriod": []
 *     },
 *     "default": false,
 *     "email": "amsterdam.store@example.com",
 *     "fax": "+31 20 765 4321",
 *     "name": "Bellamystraat",
 *     "phone": "+31 20 123 4567",
 *     "status": "ACTIVE",
 *     "timeZone": "Europe/Amsterdam",
 *     "revision": "1"
 *   },
 *   {
 *     "_id": "e3b2c1ff-2bf2-41da-9f4a-983c8799074a",
 *     "address": {
 *       "city": "Brisbane City",
 *       "country": "AU",
 *       "formatted": "Arise, Margaret Street, Brisbane City QLD, Australia",
 *       "location": {
 *         "latitude": -27.4718535,
 *         "longitude": 153.0288312
 *       },
 *       "postalCode": "4000",
 *       "streetAddress": {
 *         "apt": "",
 *         "name": "Margaret Street",
 *         "number": "222"
 *       },
 *       "subdivision": "QLD"
 *     },
 *     "archived": false,
 *     "businessSchedule": {
 *       "periods": [],
 *       "specialHourPeriod": []
 *     },
 *     "default": false,
 *     "email": "australia.store@examp;e.com",
 *     "fax": "+61 2 9876 5432",
 *     "name": "Margaret Street",
 *     "phone": "+61 2 1234 5678",
 *     "revision": "1",
 *     "status": "ACTIVE",
 *     "timeZone": "Australia/Brisbane"
 *   }
 * ]
 */

```

### Retrieve all locations
```javascript
import { locations } from '@wix/business-tools';

export async function myQueryLocationsFunction() {
  try {
    const myLocations = await locations.queryLocations().find();
    const items = myLocations.items;
    console.log('Locations:', items);

    return items;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Returns items:
 * [
 *   {
 *     "_id": "5c6e81a4-5270-4f66-9688-49d1fd9153ef",
 *     "address": {
 *       "city": "Amsterdam",
 *       "country": "NL",
 *       "formatted": "CityHub, Bellamystraat, Amsterdam, Netherlands",
 *       "location": {
 *         "latitude": 52.3672879,
 *         "longitude": 4.867098899999998
 *       },
 *       "postalCode": "1053 BE",
 *       "streetAddress": {
 *         "apt": "",
 *         "name": "Bellamystraat",
 *         "number": "3"
 *       },
 *       "subdivision": "NH"
 *     },
 *     "archived": false,
 *     "businessSchedule": {
 *       "periods": [],
 *       "specialHourPeriod": []
 *     },
 *     "default": false,
 *     "email": "amsterdam.store@example.com",
 *     "fax": "+31 20 765 4321",
 *     "name": "Bellamystraat",
 *     "phone": "+31 20 123 4567",
 *     "status": "ACTIVE",
 *     "timeZone": "Europe/Amsterdam",
 *     "revision": "1"
 *   },
 *   {
 *     "_id": "e3b2c1ff-2bf2-41da-9f4a-983c8799074a",
 *     "address": {
 *       "city": "Brisbane City",
 *       "country": "AU",
 *       "formatted": "Arise, Margaret Street, Brisbane City QLD, Australia",
 *       "location": {
 *         "latitude": -27.4718535,
 *         "longitude": 153.0288312
 *       },
 *       "postalCode": "4000",
 *       "streetAddress": {
 *         "apt": "",
 *         "name": "Margaret Street",
 *         "number": "222"
 *       },
 *       "subdivision": "QLD"
 *     },
 *     "archived": false,
 *     "businessSchedule": {
 *       "periods": [],
 *       "specialHourPeriod": []
 *     },
 *     "default": false,
 *     "email": "australia.store@examp;e.com",
 *     "fax": "+61 2 9876 5432",
 *     "name": "Margaret Street",
 *     "phone": "+61 2 1234 5678",
 *     "revision": "1",
 *     "status": "ACTIVE",
 *     "timeZone": "Australia/Brisbane"
 *   }
 * ]
 */
```

### 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 { locations } from '@wix/business-tools';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


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

---