> 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

# QueryGiftCardProducts

# Package: giftCards

# Namespace: GiftCardProductService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/gift-cards/gift-card-products/query-gift-card-products.md

## Permission Scopes:
Manage eCommerce - all permissions: SCOPE.DC-ECOM-MEGA.MANAGE-ECOM

## Introduction

Retrieves a list of up to 1,000 gift card products, given the provided paging, filtering, and sorting.


Query Gift Card Products runs with these defaults, which you can override:

- `createdDate` is sorted in `DESC` order
- `paging.limit` is `50`
- `paging.offset` is `0`

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: queryGiftCardProducts
 Description: Retrieves a list of up to 1,000 gift card products, given the provided paging, filtering, and sorting.   Query Gift Card Products runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0`  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/gift-cards/v1/gift-card-products/query
 Method: POST
 Method parameters:
   param name: query | type: CursorQuery    
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - 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 in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | 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
 Query fields:
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: presetVariants.id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | 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
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: fixedExpirationDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: presetVariants.price | operators: $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: QueryGiftCardProductsResponse
  - name: giftCardProducts | type: array<GiftCardProduct> | description: List of gift card products.  
     - ONE-OF: 
        - name: fixedExpirationDate | type: string | description: Fixed expiration date for all gift cards created from this product.  | validation: format date-time
        - name: relativeExpirationDate | type: RelativeExpirationDate | description: Expiration period relative to the date of purchase.  
           - name: value | type: integer | description: Number of time periods until expiration. For example, a `value` of `6` with a `period` of `MONTHS` means the gift card expires 6 months after purchase.  | validation: minimum 1
           - name: period | type: TimePeriod | description: Unit of time for the expiration period.  
                 - enum: DAYS, WEEKS, MONTHS, YEARS
     - name: id | type: string | description: Gift card product GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the gift card product is updated. To prevent conflicting changes, the current revision must be passed when updating the gift card product.  Ignored when creating a gift card product.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the gift card product was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the gift card product was last updated.  | read-only: true | validation: format date-time
     - name: name | type: string | description: Gift card product name.  | validation: maxLength 55
     - name: description | type: string | description: Gift card product description.  | validation: maxLength 3000
     - name: image | type: Image | description: Gift card product image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
        - name: id | type: string | description: WixMedia image GUID.  | validation: maxLength 200
        - name: url | type: string | description: WixMedia image GUID.  | validation: format WEB_URL
        - name: height | type: integer | description: Original image height.  | read-only: true 
        - name: width | type: integer | description: Original image width.  | read-only: true 
        - name: altText | type: string | description: Image alt text.  | validation: maxLength 200
        - name: filename | type: string | description: Image filename.  | read-only: true | validation: maxLength 200
     - name: expirationType | type: ExpirationType | description: Expiration type for gift cards created from this product.  
         - enum:
         -     NONE: Gift cards created from this product don't expire.
         -     FIXED: Gift cards expire on a specific date.
         -     RELATIVE: Gift cards expire after a set period from the date of purchase.
     - name: presetVariants | type: array<PresetVariant> | description: List of preset variants with predefined denominations that buyers can choose from. A product can have both preset variants and a custom variant.  When updating, the entire list is replaced. There's no way to update an individual preset variant.  | validation: minItems 0, maxItems 200
        - name: id | type: string | description: Preset variant GUID.  | read-only: true | validation: format GUID
        - name: price | type: MultiCurrencyPrice | description: Price the buyer pays for the gift card. The currency is the site's default currency.  
           - name: amount | type: string | description: Amount.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
           - name: convertedAmount | type: string | description: Converted amount.  | read-only: true | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
           - name: formattedAmount | type: string | description: Amount formatted with currency symbol.  | read-only: true 
           - name: formattedConvertedAmount | type: string | description: Converted amount formatted with currency symbol.  | read-only: true 
        - name: value | type: MultiCurrencyPrice | description: Balance loaded onto the gift card. Can differ from `price` to support promotional pricing. For example, a gift card with a `value` of $50 could have a `price` of $45.  
        - name: image | type: Image | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
     - name: customVariant | type: CustomVariant | description: Custom variant that allows buyers to choose their own gift card amount within a defined range. A product can have both preset variants and a custom variant.  
        - name: minValue | type: MultiCurrencyPrice | description: Minimum gift card amount a buyer can choose. The currency is the site's default currency.  
        - name: maxValue | type: MultiCurrencyPrice | description: Maximum gift card amount a buyer can choose. The currency is the site's default currency.  
        - name: image | type: Image | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the gift card product object.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - 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: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | 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 Gift Card Products
Queries existing gift card products with a filter by name, sorting by created date, and limit of 20 results.

```curl
curl -X POST \
  'https://www.wixapis.com/gift-cards/v1/gift-card-products/query' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
      "filter": {
        "name": "Super Gift"
      },
      "sort": [
        {
          "fieldName": "createdDate",
          "order": "DESC"
        }
      ],
      "cursorPaging": {
        "limit": 20
      }
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.giftVouchers.giftVoucherProducts.queryGiftCardProducts(query)
 Description: Retrieves a list of up to 1,000 gift card products, given the provided paging, filtering, and sorting.   Query Gift Card Products runs with these defaults, which you can override:  - `createdDate` is sorted in `DESC` order - `paging.limit` is `50` - `paging.offset` is `0`  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: GiftCardProductQuery   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`.  
        - 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 in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`  
        - name: sort | type: array<Sorting> | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`  | 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
 Query fields:
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | aggregatable: undefined | searchable: undefined
   - field: presetVariants._id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: none | 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
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: fixedExpirationDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
   - field: presetVariants.price | operators: $exists | sort: ASC, DESC | aggregatable: undefined | searchable: undefined
 Return type: PROMISE<QueryGiftCardProductsResponse>
  - name: giftCardProducts | type: array<GiftCardProduct> | description: List of gift card products.  
     - ONE-OF: 
        - name: fixedExpirationDate | type: Date | description: Fixed expiration date for all gift cards created from this product.  
        - name: relativeExpirationDate | type: RelativeExpirationDate | description: Expiration period relative to the date of purchase.  
           - name: value | type: integer | description: Number of time periods until expiration. For example, a `value` of `6` with a `period` of `MONTHS` means the gift card expires 6 months after purchase.  | validation: minimum 1
           - name: period | type: TimePeriod | description: Unit of time for the expiration period.  
                 - enum: DAYS, WEEKS, MONTHS, YEARS
     - name: _id | type: string | description: Gift card product GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the gift card product is updated. To prevent conflicting changes, the current revision must be passed when updating the gift card product.  Ignored when creating a gift card product.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the gift card product was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the gift card product was last updated.  | read-only: true 
     - name: name | type: string | description: Gift card product name.  | validation: maxLength 55
     - name: description | type: string | description: Gift card product description.  | validation: maxLength 3000
     - name: image | type: string | description: Gift card product image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
     - name: expirationType | type: ExpirationType | description: Expiration type for gift cards created from this product.  
         - enum:
         -     NONE: Gift cards created from this product don't expire.
         -     FIXED: Gift cards expire on a specific date.
         -     RELATIVE: Gift cards expire after a set period from the date of purchase.
     - name: presetVariants | type: array<PresetVariant> | description: List of preset variants with predefined denominations that buyers can choose from. A product can have both preset variants and a custom variant.  When updating, the entire list is replaced. There's no way to update an individual preset variant.  | validation: minItems 0, maxItems 200
        - name: _id | type: string | description: Preset variant GUID.  | read-only: true | validation: format GUID
        - name: price | type: MultiCurrencyPrice | description: Price the buyer pays for the gift card. The currency is the site's default currency.  
           - name: amount | type: string | description: Amount.  | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
           - name: convertedAmount | type: string | description: Converted amount.  | read-only: true | validation: decimalValue {"gte":"0","lte":"1000000000000000"}
           - name: formattedAmount | type: string | description: Amount formatted with currency symbol.  | read-only: true 
           - name: formattedConvertedAmount | type: string | description: Converted amount formatted with currency symbol.  | read-only: true 
        - name: value | type: MultiCurrencyPrice | description: Balance loaded onto the gift card. Can differ from `price` to support promotional pricing. For example, a gift card with a `value` of $50 could have a `price` of $45.  
        - name: image | type: string | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
     - name: customVariant | type: CustomVariant | description: Custom variant that allows buyers to choose their own gift card amount within a defined range. A product can have both preset variants and a custom variant.  
        - name: minValue | type: MultiCurrencyPrice | description: Minimum gift card amount a buyer can choose. The currency is the site's default currency.  
        - name: maxValue | type: MultiCurrencyPrice | description: Maximum gift card amount a buyer can choose. The currency is the site's default currency.  
        - name: image | type: string | description: Variant-level image that overrides the product-level image. Only images from the Wix Media Manager are supported. To use an external image, first upload it to the Wix Media Manager.  When setting the image, you must provide at least `id`, `width`, and `height`. The `id` is the file name from the image URL. For example, for `https://static.wixstatic.com/media/5cc69183e7954e2c9760fa2383870992.jpg`, the `id` is `5cc69183e7954e2c9760fa2383870992.jpg`.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the gift card product object.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
        - 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: CursorPagingMetadata | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | 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

### queryGiftCardProducts
```javascript
import { giftVoucherProducts } from '@wix/gift-vouchers';

async function queryGiftCardProducts(query) {
  const response = await giftVoucherProducts.queryGiftCardProducts(query);
};
```

### queryGiftCardProducts (with elevated permissions)
```javascript
import { giftVoucherProducts } from '@wix/gift-vouchers';
import { auth } from '@wix/essentials';

async function myQueryGiftCardProductsMethod(query) {
  const elevatedQueryGiftCardProducts = auth.elevate(giftVoucherProducts.queryGiftCardProducts);
  const response = await elevatedQueryGiftCardProducts(query);
}
```

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

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


async function queryGiftCardProducts(query) {
  const response = await myWixClient.giftVoucherProducts.queryGiftCardProducts(query);
};
```

---