> 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

# QueryTaxRegions

# Package: tax

# Namespace: TaxRegionsService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/tax-regions/query-tax-regions?apiView=SDK.md

## Permission Scopes:
Manage Orders: SCOPE.DC-STORES.MANAGE-ORDERS

## Introduction

Retrieves a list of tax regions, given the provided paging, filtering, and sorting.

To learn about working with Query methods, see
[API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md),
[Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md),
and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).

---

## REST API

### Schema

```
 Method: queryTaxRegions
 Description: Retrieves a list of tax regions, given the provided paging, filtering, and sorting.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 URL: https://www.wixapis.com/billing/v1/tax-regions/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).  | validation: maxItems 5
           - 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
 Query fields:
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: country | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: subdivision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: appId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryTaxRegionsResponse
  - name: taxRegions | type: array<TaxRegion> | description: Retrieved tax regions.  
     - name: id | type: string | description: Tax region GUID.  | read-only: true | validation: format GUID
     - name: country | type: string | description: 2-letter country code in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, for example `US` or `GB`.  Stored as a code only. No country display name is kept, so you're responsible for translating the code to a human-readable name.  | validation: minLength 2, format COUNTRY
     - name: subdivision | type: string | description: Subdivision (such as a state, prefecture, or province) in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format, without the country prefix. For example, `NY` for New York, `ON` for Ontario, or `BY` for Bavaria.  Use the ISO 3166-2 code, not a display name. A region stored with a full name such as `Georgia` instead of `GA` won't match at calculation time and silently results in no tax being charged. Stored as a code only, so no subdivision display name is kept.  Leave empty or set to `*` to create a region that covers the entire country.  Subdivisions are supported only for the following countries: `AU`, `BR`, `CA`, `FR`, `DE`, `IN`, `IT`, `MX`, `NL`, `PT`, `ES`, `AE`, `GB`, and `US`. For any other country, create the region at the country level.  | validation: maxLength 50
     - name: appId | type: string | description: The app GUID of the tax calculator to use for this region.  Always resolve this value by calling [List Tax Calculators](https://dev.wix.com/docs/rest/business-solutions/e-commerce/tax/tax-calculation/list-tax-calculators.md); never hardcode it. Calculator app GUIDs are installation-scoped and can differ between sites. To use Avalara, pass the app GUID whose calculator display name contains `Avalara`.  | validation: format GUID
     - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price.  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the tax region is updated. To prevent conflicting changes, the current revision must be passed when updating the tax region.  Ignored when creating a tax region.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the tax region was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the tax region was last updated.  | read-only: true | validation: format date-time
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query Tax Regions
Returns all existing tax regions with basic info

```curl
curl -X POST \
    'https://www.wixapis.com/billing/v1/tax-regions/query' \
    -H 'Authorization: <AUTH>' \
    -H 'Content-Type: application/json' \
    -d '{
      "query": {
        "cursorPaging": {},
        "sort": [
          {
            "fieldName": "createdDate",
            "order": "DESC"
          }
        ]
      }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.taxRegions.queryTaxRegions(query)
 Description: Retrieves a list of tax regions, given the provided paging, filtering, and sorting.  To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md).
 # 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: TaxRegionQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor paging options.  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#cursor-paging).  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#filters).  
        - name: sort | type: array<Sorting> | description: Sort object.  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language.md#sorting).  | validation: maxItems 5
           - 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.  
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: country | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: subdivision | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: appId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: _updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryTaxRegionsResponse>
  - name: taxRegions | type: array<TaxRegion> | description: Retrieved tax regions.  
     - name: _id | type: string | description: Tax region GUID.  | read-only: true | validation: format GUID
     - name: country | type: string | description: 2-letter country code in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, for example `US` or `GB`.  Stored as a code only. No country display name is kept, so you're responsible for translating the code to a human-readable name.  | validation: minLength 2, format COUNTRY
     - name: subdivision | type: string | description: Subdivision (such as a state, prefecture, or province) in [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) format, without the country prefix. For example, `NY` for New York, `ON` for Ontario, or `BY` for Bavaria.  Use the ISO 3166-2 code, not a display name. A region stored with a full name such as `Georgia` instead of `GA` won't match at calculation time and silently results in no tax being charged. Stored as a code only, so no subdivision display name is kept.  Leave empty or set to `*` to create a region that covers the entire country.  Subdivisions are supported only for the following countries: `AU`, `BR`, `CA`, `FR`, `DE`, `IN`, `IT`, `MX`, `NL`, `PT`, `ES`, `AE`, `GB`, and `US`. For any other country, create the region at the country level.  | validation: maxLength 50
     - name: appId | type: string | description: The app GUID of the tax calculator to use for this region.  Always resolve this value by calling [List Tax Calculators](https://dev.wix.com/docs/rest/business-solutions/e-commerce/tax/tax-calculation/list-tax-calculators.md); never hardcode it. Calculator app GUIDs are installation-scoped and can differ between sites. To use Avalara, pass the app GUID whose calculator display name contains `Avalara`.  | validation: format GUID
     - name: taxIncludedInPrice | type: boolean | description: Whether tax is included in the price.  
     - name: revision | type: string | description: Revision number, which increments by 1 each time the tax region is updated. To prevent conflicting changes, the current revision must be passed when updating the tax region.  Ignored when creating a tax region.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the tax region was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the tax region was last updated.  | read-only: true 
  - name: pagingMetadata | type: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in current page.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000
     - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page.  + `true`: Another page of results can be retrieved. + `false`: This is the last page.  


```

### Examples

### Query Tax Regions
Query tax regions for the United States.

```javascript
import { taxRegions } from "@wix/ecom";

async function queryTaxRegions() {
  const response = await taxRegions.queryTaxRegions({
    filter: { country: "US" },
    cursorPaging: { limit: 50 },
  });
  return response;
}

/* Promise resolves to:
 * {
 *   "taxRegions": [
 *     {
 *       "_id": "a1b2c3d4-e5f6-7a8b-9c0d-e1f2a3b4c5d6",
 *       "country": "US",
 *       "subdivision": "NY",
 *       "appId": "61f58705-419e-4c30-b498-751c399eb498",
 *       "taxIncludedInPrice": false
 *     }
 *   ],
 *   "pagingMetadata": { "count": 1, "cursors": {} }
 * }
 */

```

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

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


async function queryTaxRegions(query) {
  const response = await myWixClient.taxRegions.queryTaxRegions(query);
};
```

---