> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# QueryPremiumAssets

# Package: coreServices

# Namespace: PremiumAssetReaderService

# Method link: https://dev.wix.com/docs/api-reference/account-level/premium/premium-platform/core-services/premium-asset-v2/query-premium-assets.md

## Permission Scopes:
Manage Premium Subscriptions: SCOPE.PREMIUM.MANAGE-SUBSCRIPTIONS

## Introduction

Retrieves a list of up to 100 Premium assets, given the provided paging,
filtering, and sorting.


Query Premium Assets runs with these defaults, which you can override:

- `cursorPaging.limit` is `50`

Pass the ID of the account whose assets you want to retrieve in the
`targetAccountId` header. The call fails without it.

Which assets are returned depends on what the caller is permitted on. A
caller permitted on the target account receives all of the account's assets.
A caller permitted only on a specific site receives that site's assets alone,
and the results are filtered to that site. In the second case the site is
taken from the call scope, so a call with neither an account permission nor a
site in scope fails.

Assets for which the account is
[Billing Manager](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps)
aren't returned by default. Pass `{"includePermitted": true}` to include
them. Sort isn't guaranteed to be applied when `includePermitted` is `true`.

Sorting applies to the first page of results. Following requests use the
cursor token, which already carries the sort from the first call.

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: queryPremiumAssets
 Description: Retrieves a list of up to 100 Premium assets, given the provided paging, filtering, and sorting.   Query Premium Assets runs with these defaults, which you can override:  - `cursorPaging.limit` is `50`  Pass the GUID of the account whose assets you want to retrieve in the `targetAccountId` header. The call fails without it.  Which assets are returned depends on what the caller is permitted on. A caller permitted on the target account receives all of the account's assets. A caller permitted only on a specific site receives that site's assets alone, and the results are filtered to that site. In the second case the site is taken from the call scope, so a call with neither an account permission nor a site in scope fails.  Assets for which the account is [Billing Manager](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps) aren't returned by default. Pass `{"includePermitted": true}` to include them. Sort isn't guaranteed to be applied when `includePermitted` is `true`.  Sorting applies to the first page of results. Following requests use the cursor token, which already carries the sort from the first call.  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/premium-assets/v2/premium-assets/query
 Method: POST
 Method parameters:
   param name: cursorQuery | 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 64000
        - 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
           - 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
   param name: includePermitted | type: includePermitted | description: Whether the response includes also Premium assets for which the specified account is [Billing Manager](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps).  Sort isn't guaranteed to be applied when this is `true`. The service may ignore this setting when permitted assets cannot affect the result, such as when filtering for unassigned assets.  Default: `false`  
   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
 Return type: QueryPremiumAssetsResponse
  - name: premiumAssets | type: array<PremiumAsset> | description: Retrieved Premium assets.  
     - ONE-OF: 
        - name: domainsData | type: DomainData | description: Information about the [domain](https://support.wix.com/en/article/purchasing-a-domain-from-wix-3133977). Available only for domains.  
           - name: domain | type: string | description: Domain name including TLD.  | validation: format HOSTNAME
           - name: primary | type: boolean | description: Whether the domain is the site's [primary domain](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). Available only in case the domains is assigned to a site.  
           - name: privacy | type: DomainPrivacy | description: Whether the domain owner's personal information is stored in the WHOIS database or replaced with details about Wix. Learn more about [domain privacy](https://support.wix.com/en/article/about-domain-privacy).  
                 - enum:
                 -     UNKNOWN_PRIVACY: here's no information about the domain's privacy
                 -     NOT_PURCHASED: Privacy feature not purchased for this domain. The domain owner's personal information is publicly visible in the WHOIS database.
                 -     PRIVACY_TURNED_ON: Privacy feature purchased and enabled. The domain owner's personal information is replaced with Wix's details in the WHOIS database.
                 -     PRIVACY_TURNED_OFF: Privacy feature purchased and disabled. The domain owner's personal information is publicly visible in the WHOIS database, because the domain owner has disabled the domain's privacy in Wix.
           - name: expirationDate | type: string | description: Expiration date of the domain in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | validation: format date-time
           - name: validExtendPeriod | type: TimeInterval | description: Information about the time period during which the domain owner can extend the domain. Learn more about [extending domains](https://support.wix.com/en/article/extending-your-wix-domain-subscription).  
              - name: startTime | type: string | description: Timestamp of interval start. No value implies negative infinity  | validation: format date-time
              - name: endTime | type: string | description: Timestamp of interval end. No value implies positive infinity  | validation: format date-time
           - name: validInRegistrar | type: boolean | description: Whether the domain's registration is valid at the external registrar.  
           - name: redemptionPeriod | type: TimeInterval | description: Information about the time period during which the domain owner can redeem the domain. During this time the owner can't extend the domain regularly. Learn more about [redeeming domains](https://support.wix.com/en/article/retrieving-an-expired-domain-during-the-redemption-period).  
           - name: dnssecSupported | type: boolean | description: Whether dnssec was bought by user  
           - name: insuranceSupported | type: boolean | description: Whether insurance was bought by user  
           - name: insuranceActivated | type: boolean | description: Whether domain insurance has been activated  
        - name: mailboxesData | type: MailboxData | description: Information about the [business email](https://support.wix.com/en/article/business-email-an-overview). Available only for mailboxes.  
           - name: domainName | type: string | description: Domain name including TLD to which the business email is connected.  
           - name: seats | type: integer | description: Number of licenses for the business email.  
           - name: vendor | type: VendorType | description: External company that sold the business email.  
                 - enum:
                 -     UNKNOWN_VENDOR: There is no information about the business email's vendor
                 -     GOOGLE: [Google Workspace](https://support.wix.com/en/article/google-workspace-choosing-a-plan) used for mail
                 -     MSN: MSN Office Suite used for mail
        - name: digitalGoodsData | type: DigitalGoodsData | description: Information about the digital good. Available only for digital goods.  
           - name: digitalGoodsType | type: DigitalGoodsType | description: Type of the digital good.  
                 - enum:
                 -     UNKNOWN_DIGITAL_GOOD_TYPE: There's no information about the type of digital good.
                 -     IMAGE: Image purchased from Wix.
                 -     VIDEO: Video purchased from Wix.
                 -     LOGO: Logo created with the [Wix Logo Maker](https://support.wix.com/en/article/wix-logo-creating-a-logo-with-the-new-wix-logo-maker).
        - name: typeSpecificFields | type: TypeSpecificFields | description: Custom fields defined by the product schema. These key-value pairs are copied from the subscription's metadata field, which usually originates from the billing order's external params. Useful for storing product-specific data like domain names for mailboxes.  
           - name: fields | type: object | description:   | validation: maxItems 20, format map
     - name: createdDate | type: string | description: Date and time the asset was created in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the asset was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true | validation: format date-time
     - name: premiumId | type: string | description: Premium GUID of the asset. Available for all product types.  + For subscriptions identical to the GUID of the subscription. + For domains identical to the [registration GUID](https://dev.wix.com/docs/rest/business-management/domain-registrar/registar/registration-object.md). + For digital goods identical to the GUID of the digital goods package. + For mailboxes identical to the Google mailbox GUID.  | read-only: true | validation: format GUID
     - name: sourceEntityCreatedDate | type: string | description: Date and time the source entity was created in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true | validation: format date-time
     - name: sourceEntityOriginalCreationDate | type: string | description: Date and time the original source entity was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. Differs from `source_entity_created_date` when the subscription was created by transfer, and is equal when created by purchase.  | read-only: true | validation: format date-time
     - name: siteData | type: SiteData | description: Information about the site to which the asset is connected to.  
        - name: metasiteId | type: string | description: GUID of the metassite that the asset belongs to.  | validation: format GUID
        - name: siteName | type: string | description: Human-readable display name of the Wix site that the asset belongs to.  
     - name: accountOwnerId | type: string | description: GUID of the Wix account that owns the asset. Can be a workspace GUID or an account GUID.  | validation: format GUID
     - name: billingReference | type: BillingReference | description: Information about the asset's billing provider.  
        - name: providerName | type: ProviderName | description: Name of the billing system that manages the subscription.  
             - enum:
             -     UNKNOWN_BILLING_PROVIDER: There is no information about the billing system.
             -     SBS: Wix Billing.
             -     LICENSER: Premium Licenser.
             -     BASS: Billing and Subscriptions System.
             -     RESELLER: [External reseller](https://dev.wix.com/api/rest/account-level-apis/resellers/introduction).
             -     RECURRING_INVOICES: Recurring invoices.
        - name: providerReferenceId | type: string | description: Current provider reference GUID.  
     - name: status | type: AssetStatus | description: Status of the asset.  
         - enum:
         -     UNKNOWN_STATUS: There is no information about the asset's status.
         -     ACTIVE: The asset is available to the customer.
         -     NOT_ACTIVE: The asset isn't available to the customer. Covers every inactive situation - cancelled, expired, stopped, failed and fraudulent subscriptions all report `"NOT_ACTIVE"` and aren't distinguished. Subscriptions pending at the billing provider also report `"NOT_ACTIVE"` rather than `"PENDING"`.
         -     TRANSFERRED: The asset has been transferred and no longer available to the customer. There is a new asset that is created as part of the transfer.
         -     PENDING: The asset isn't yet available to the customer, because of an ongoing external process. Used when creating a subscription for a product purchased with a payment method that doesn't settle immediately, such as Boleto or SEPA.
     - name: deliveryComplete | type: boolean | description: Whether the asset is actually available to the owner. Relevant only for domains with status `"ACTIVE"`.  
     - name: renewalType | type: RenewalType | description: Information about whether the asset renews at the end of the current billing cycle.  
         - enum:
         -     UNKNOWN_RENEWAL_TYPE: There is no information about the asset's renewal type
         -     AUTO_RENEW_ON: Subscription renewed when current period ends with automatic payment method, for example credit card
         -     AUTO_RENEW_OFF: Subscription is turned off at current period end date
         -     MANUAL: Subscription is renewed when current period ends only if paid for manually
     - name: billingCycle | type: Cycle | description: Information about the asset's billing cycle.  
        - name: cycleType | type: CycleType | description: Payment type. + `UNKNOWN`: The payment type hasn't been set. + `ONE_TIME`: The reseller pays Wix in a single payment. + `RECURRING`: The reseller pays Wix on a recurring schedule.  
             - enum: ONE_TIME, RECURRING
        - name: cycleDuration | type: Duration | description: Duration of the billing cycle. Available only for `RECURRING` payments.  
           - name: unit | type: DurationUnit | description: Unit of the billing cycle.  
                 - enum:
                 -     DAY: day
                 -     WEEK: week
                 -     MONTH: month
                 -     YEAR: year
           - name: count | type: integer | description: Count of units that make up the billing cycle.  | validation: minimum 0
     - name: subscriptionEndDate | type: string | description: Date and time the asset expires in `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for `{"renewalType": "AUTO_RENEW_OFF"}`.  | validation: format date-time
     - name: pendingChanges | type: ServicePendingChanges | description: Information about changes to the asset that are still pending. Available only for `{"status": "PENDING"}`.  
        - name: billingCycle | type: Cycle | description: Information about the billing cycle.  
        - name: product | type: ProductData | description: The product that will be change to at the end of period. Only id and name are populated  
           - name: productId | type: string | description: Product GUID of the asset as defined in the product catalog.  
           - name: productFamilyId | type: string | description: Product family GUID of the asset as defined in the product catalog.  | validation: format GUID
           - name: productTypeId | type: string | description: Product type GUID of the asset as defined in the product catalog.  | validation: format GUID
           - name: productTypeName | type: string | description: Name of the product type as defined in the product catalog.  
           - name: productName | type: string | description: Name of the product as defined in the product catalog.  Returned as an empty string for domains, business email, and digital goods. For those assets, use `domainsData.domain`, `mailboxesData.domainName`, or `digitalGoodsData.digitalGoodsType` instead.  
           - name: productContext | type: string | description: Whether the assets belongs to a Wix account or site. Account level assets can't be assigned to a site. Each account may only own a single asset for each product. Site level assets can be assigned to a site or exist floating (assigned to an account but not to a site). Each site may only own a single asset for each product.  
     - name: productData | type: ProductData | description: Information about the Premium entity related to the asset. Available for all assets.  
     - name: wixBillingDetails | type: BillingDetails | description: Information about the asset's billing.  
        - name: paymentMethod | type: PaymentMethod | description: Information about the payment method.  
           - name: paymentMethodType | type: string | description: Information about the payment method.  
           - name: paymentMethodSubType | type: string | description: Subtype of the payment method.  
           - name: paymentBrand | type: string | description: The brand of the payment method  | validation: maxLength 100
           - name: displayLabel | type: string | description: Human-readable description. Relevant for credit cards.  
           - name: paymentSourceId | type: string | description: GUID of the payment source.  
           - name: billingAccountOwner | type: string | description: GUID of the owner of the payment method.  | validation: format GUID
        - name: lastInvoiceDetails | type: InvoiceDetails | description: Details about the last invoice. Identical to `last_successful_invoice_details` in case the `paymentStatus` of the last invoice is `"PAID"` or `"REFUNDED"`.  
           - name: invoiceId | type: string | description: GUID of the invoice.  
           - name: date | type: string | description: Date of the invoice in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | validation: format date-time
           - name: currencyCode | type: string | description: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.  | validation: format CURRENCY
           - name: amount | type: string | description: Amount the customer was charged, as a string.  The representation isn't guaranteed to be consistent across billing providers: some report the amount in the currency's minor units, for example `950` for 9.50, and others report a decimal value, for example `9.50`. Read `billingReference.providerName` to see which billing provider an asset comes from, and don't assume a single format across assets.  | validation: format DECIMAL_VALUE
           - name: paymentStatus | type: PaymentStatus | description: Status of the payment.  
                 - enum:
                 -     UNKNOWN_PAYMENT_STATUS: There's no information about the payment status.
                 -     PAID: The customer has successfully paid for the invoice.
                 -     REFUNDED: The customer has been refunded.
                 -     CHARGE_ATTEMPT_FAILED: A charge was attempted but the payment couldn't be collected. Relevant for the following invoice statuses in the billing systems: `"CREDIT_NOTE"`, `"ERROR_CHARGES"`, `"DECLINED_CHARGES"`, and `"BAD_DEBT"`.
                 -     IN_PROGRESS: A charge is currently in progress.
                 -     NO_PAYMENT: There is no invoice. Relevant mostly for transferred assets.
                 -     NOT_BILLABLE: The invoice requires a manual payment from the customer, because the payment can't be collected automatically.
        - name: nextInvoiceDetails | type: NextInvoiceDetails | description: Details about the next invoice. Doesn't include information about the price and currency, since those values may change before the next invoice is sent. If needed, you can retrieve this information directly from the relevant billing system.  
           - name: date | type: string | description: Next billing date in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | validation: format date-time
        - name: lastSuccessfulInvoiceDetails | type: InvoiceDetails | description: Details about the last succesful invoice. Identical to `last_invoice_details` in case the `paymentStatus` of the last invoice is `"PAID"` or `"REFUNDED"`.  
        - name: customCharges | type: boolean | description: Whether the invoice is sent on behalf of a non-Wix app, with the app provider using the Custom Charges SPI.  
     - name: moneyBackPeriodEndDate | type: string | description: End date and time of the refund period in `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for products that support a money back policy.  | validation: format date-time
     - name: freeTrialData | type: FreeTrialData | description: Information about the asset's free trial or deferred billing state. Populated when the asset was purchased with a free trial, and also while billing is deferred pending an external activation. Remains populated after a trial ends, with `inFreeTrialPeriod` set to `false`.  
        - name: endDate | type: string | description: date when the free trial ends  | read-only: true | validation: format date-time
        - name: inFreeTrialPeriod | type: boolean | description: Whether the asset is currently within its free trial period. Also `true` when billing is deferred pending external activation (`pendingExternalActivation` is `true`). Use `pendingExternalActivation` to distinguish a free trial from a deferred-billing hold.  | read-only: true 
        - name: pendingExternalActivation | type: boolean | description: Whether billing for the asset is on hold pending activation by an external party. While this is `true` the customer isn't charged, and the asset only starts billing once the external activation completes.  | read-only: true 
     - name: seats | type: integer | description: Number of seats/licenses for the subscription. Null means the asset doesn't support seats.  | validation: minimum 1, maximum 500, format int32
  - 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.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: METASITE_MISSING_IN_CONTEXT | Description: The caller isn't permitted on the target account, and no meta site was supplied in the call context to fall back to.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: TARGET_ACCOUNT_MISSING_IN_CONTEXT | Description: No target account was supplied in the call context.


```

### Examples

### Retrieve the active Premium assets that belong to an account
```curl
curl -X POST \
'https://www.wixapis.com/premium-assets/v2/premium-assets/query' \
-H 'Authorization: <AUTH>' \
-H 'targetAccountId: <TARGET_ACCOUNT_ID>' \
-H 'Content-Type: application/json' \
-d '{
  "cursorQuery": {
    "filter": {
      "status": "ACTIVE"
    },
    "cursorPaging": {
      "limit": 2
    }
  },
  "includePermitted": false
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.premiumAssets.premiumAssets.queryPremiumAssets(options)
 Description: Retrieves a list of up to 100 Premium assets, given the provided paging, filtering, and sorting.   Query Premium Assets runs with these defaults, which you can override:  - `cursorPaging.limit` is `50`  Pass the GUID of the account whose assets you want to retrieve in the `targetAccountId` header. The call fails without it.  Which assets are returned depends on what the caller is permitted on. A caller permitted on the target account receives all of the account's assets. A caller permitted only on a specific site receives that site's assets alone, and the results are filtered to that site. In the second case the site is taken from the call scope, so a call with neither an account permission nor a site in scope fails.  Assets for which the account is [Billing Manager](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps) aren't returned by default. Pass `{"includePermitted": true}` to include them. Sort isn't guaranteed to be applied when `includePermitted` is `true`.  Sorting applies to the first page of results. Following requests use the cursor token, which already carries the sort from the first call.  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).
 Method parameters:
   param name: options | type: QueryPremiumAssetsOptions  none  
        - name: cursorQuery | type: CursorQuery | description: [WQL expression](https://dev.wix.com/api/rest/getting-started/api-query-language).  
           - ONE-OF: 
              - 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 64000
           - 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
              - 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: includePermitted | type: boolean | description: Whether the response includes also Premium assets for which the specified account is [Billing Manager](https://support.wix.com/en/article/roles-permissions-overview#roles-for-integrated-wix-apps).  Sort isn't guaranteed to be applied when this is `true`. The service may ignore this setting when permitted assets cannot affect the result, such as when filtering for unassigned assets.  Default: `false`  
 Return type: PROMISE<QueryPremiumAssetsResponse>
  - name: premiumAssets | type: array<PremiumAsset> | description: Retrieved Premium assets.  
     - ONE-OF: 
        - name: domainsData | type: DomainData | description: Information about the [domain](https://support.wix.com/en/article/purchasing-a-domain-from-wix-3133977). Available only for domains.  
           - name: domain | type: string | description: Domain name including TLD.  | validation: format HOSTNAME
           - name: primary | type: boolean | description: Whether the domain is the site's [primary domain](https://support.wix.com/en/article/switching-your-primary-and-redirected-domains). Available only in case the domains is assigned to a site.  
           - name: privacy | type: DomainPrivacy | description: Whether the domain owner's personal information is stored in the WHOIS database or replaced with details about Wix. Learn more about [domain privacy](https://support.wix.com/en/article/about-domain-privacy).  
                 - enum:
                 -     UNKNOWN_PRIVACY: here's no information about the domain's privacy
                 -     NOT_PURCHASED: Privacy feature not purchased for this domain. The domain owner's personal information is publicly visible in the WHOIS database.
                 -     PRIVACY_TURNED_ON: Privacy feature purchased and enabled. The domain owner's personal information is replaced with Wix's details in the WHOIS database.
                 -     PRIVACY_TURNED_OFF: Privacy feature purchased and disabled. The domain owner's personal information is publicly visible in the WHOIS database, because the domain owner has disabled the domain's privacy in Wix.
           - name: expirationDate | type: Date | description: Expiration date of the domain in `YYYY-MM-DDThh:mm:ss.sssZ` format.  
           - name: validExtendPeriod | type: TimeInterval | description: Information about the time period during which the domain owner can extend the domain. Learn more about [extending domains](https://support.wix.com/en/article/extending-your-wix-domain-subscription).  
              - name: startTime | type: Date | description: Timestamp of interval start. No value implies negative infinity  
              - name: endTime | type: Date | description: Timestamp of interval end. No value implies positive infinity  
           - name: validInRegistrar | type: boolean | description: Whether the domain's registration is valid at the external registrar.  
           - name: redemptionPeriod | type: TimeInterval | description: Information about the time period during which the domain owner can redeem the domain. During this time the owner can't extend the domain regularly. Learn more about [redeeming domains](https://support.wix.com/en/article/retrieving-an-expired-domain-during-the-redemption-period).  
           - name: dnssecSupported | type: boolean | description: Whether dnssec was bought by user  
           - name: insuranceSupported | type: boolean | description: Whether insurance was bought by user  
           - name: insuranceActivated | type: boolean | description: Whether domain insurance has been activated  
        - name: mailboxesData | type: MailboxData | description: Information about the [business email](https://support.wix.com/en/article/business-email-an-overview). Available only for mailboxes.  
           - name: domainName | type: string | description: Domain name including TLD to which the business email is connected.  
           - name: seats | type: integer | description: Number of licenses for the business email.  
           - name: vendor | type: VendorType | description: External company that sold the business email.  
                 - enum:
                 -     UNKNOWN_VENDOR: There is no information about the business email's vendor
                 -     GOOGLE: [Google Workspace](https://support.wix.com/en/article/google-workspace-choosing-a-plan) used for mail
                 -     MSN: MSN Office Suite used for mail
        - name: digitalGoodsData | type: DigitalGoodsData | description: Information about the digital good. Available only for digital goods.  
           - name: digitalGoodsType | type: DigitalGoodsType | description: Type of the digital good.  
                 - enum:
                 -     UNKNOWN_DIGITAL_GOOD_TYPE: There's no information about the type of digital good.
                 -     IMAGE: Image purchased from Wix.
                 -     VIDEO: Video purchased from Wix.
                 -     LOGO: Logo created with the [Wix Logo Maker](https://support.wix.com/en/article/wix-logo-creating-a-logo-with-the-new-wix-logo-maker).
        - name: typeSpecificFields | type: TypeSpecificFields | description: Custom fields defined by the product schema. These key-value pairs are copied from the subscription's metadata field, which usually originates from the billing order's external params. Useful for storing product-specific data like domain names for mailboxes.  
           - name: fields | type: object | description:   | validation: maxItems 20, format map
     - name: _createdDate | type: Date | description: Date and time the asset was created in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the asset was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true 
     - name: premiumId | type: string | description: Premium GUID of the asset. Available for all product types.  + For subscriptions identical to the GUID of the subscription. + For domains identical to the [registration GUID](https://dev.wix.com/docs/rest/business-management/domain-registrar/registar/registration-object.md). + For digital goods identical to the GUID of the digital goods package. + For mailboxes identical to the Google mailbox GUID.  | read-only: true | validation: format GUID
     - name: sourceEntityCreatedDate | type: Date | description: Date and time the source entity was created in `YYYY-MM-DDThh:mm:ss.sssZ` format.  | read-only: true 
     - name: sourceEntityOriginalCreationDate | type: Date | description: Date and time the original source entity was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. Differs from `source_entity_created_date` when the subscription was created by transfer, and is equal when created by purchase.  | read-only: true 
     - name: siteData | type: SiteData | description: Information about the site to which the asset is connected to.  
        - name: metasiteId | type: string | description: GUID of the metassite that the asset belongs to.  | validation: format GUID
        - name: siteName | type: string | description: Human-readable display name of the Wix site that the asset belongs to.  
     - name: accountOwnerId | type: string | description: GUID of the Wix account that owns the asset. Can be a workspace GUID or an account GUID.  | validation: format GUID
     - name: billingReference | type: BillingReference | description: Information about the asset's billing provider.  
        - name: providerName | type: ProviderName | description: Name of the billing system that manages the subscription.  
             - enum:
             -     UNKNOWN_BILLING_PROVIDER: There is no information about the billing system.
             -     SBS: Wix Billing.
             -     LICENSER: Premium Licenser.
             -     BASS: Billing and Subscriptions System.
             -     RESELLER: [External reseller](https://dev.wix.com/api/rest/account-level-apis/resellers/introduction).
             -     RECURRING_INVOICES: Recurring invoices.
        - name: providerReferenceId | type: string | description: Current provider reference GUID.  
     - name: status | type: AssetStatus | description: Status of the asset.  
         - enum:
         -     UNKNOWN_STATUS: There is no information about the asset's status.
         -     ACTIVE: The asset is available to the customer.
         -     NOT_ACTIVE: The asset isn't available to the customer. Covers every inactive situation - cancelled, expired, stopped, failed and fraudulent subscriptions all report `"NOT_ACTIVE"` and aren't distinguished. Subscriptions pending at the billing provider also report `"NOT_ACTIVE"` rather than `"PENDING"`.
         -     TRANSFERRED: The asset has been transferred and no longer available to the customer. There is a new asset that is created as part of the transfer.
         -     PENDING: The asset isn't yet available to the customer, because of an ongoing external process. Used when creating a subscription for a product purchased with a payment method that doesn't settle immediately, such as Boleto or SEPA.
     - name: deliveryComplete | type: boolean | description: Whether the asset is actually available to the owner. Relevant only for domains with status `"ACTIVE"`.  
     - name: renewalType | type: RenewalType | description: Information about whether the asset renews at the end of the current billing cycle.  
         - enum:
         -     UNKNOWN_RENEWAL_TYPE: There is no information about the asset's renewal type
         -     AUTO_RENEW_ON: Subscription renewed when current period ends with automatic payment method, for example credit card
         -     AUTO_RENEW_OFF: Subscription is turned off at current period end date
         -     MANUAL: Subscription is renewed when current period ends only if paid for manually
     - name: billingCycle | type: Cycle | description: Information about the asset's billing cycle.  
        - name: cycleType | type: CycleType | description: Payment type. + `UNKNOWN`: The payment type hasn't been set. + `ONE_TIME`: The reseller pays Wix in a single payment. + `RECURRING`: The reseller pays Wix on a recurring schedule.  
             - enum: ONE_TIME, RECURRING
        - name: cycleDuration | type: Duration | description: Duration of the billing cycle. Available only for `RECURRING` payments.  
           - name: unit | type: DurationUnit | description: Unit of the billing cycle.  
                 - enum:
                 -     DAY: day
                 -     WEEK: week
                 -     MONTH: month
                 -     YEAR: year
           - name: count | type: integer | description: Count of units that make up the billing cycle.  | validation: minimum 0
     - name: subscriptionEndDate | type: Date | description: Date and time the asset expires in `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for `{"renewalType": "AUTO_RENEW_OFF"}`.  
     - name: pendingChanges | type: ServicePendingChanges | description: Information about changes to the asset that are still pending. Available only for `{"status": "PENDING"}`.  
        - name: billingCycle | type: Cycle | description: Information about the billing cycle.  
        - name: product | type: ProductData | description: The product that will be change to at the end of period. Only id and name are populated  
           - name: productId | type: string | description: Product GUID of the asset as defined in the product catalog.  
           - name: productFamilyId | type: string | description: Product family GUID of the asset as defined in the product catalog.  | validation: format GUID
           - name: productTypeId | type: string | description: Product type GUID of the asset as defined in the product catalog.  | validation: format GUID
           - name: productTypeName | type: string | description: Name of the product type as defined in the product catalog.  
           - name: productName | type: string | description: Name of the product as defined in the product catalog.  Returned as an empty string for domains, business email, and digital goods. For those assets, use `domainsData.domain`, `mailboxesData.domainName`, or `digitalGoodsData.digitalGoodsType` instead.  
           - name: productContext | type: string | description: Whether the assets belongs to a Wix account or site. Account level assets can't be assigned to a site. Each account may only own a single asset for each product. Site level assets can be assigned to a site or exist floating (assigned to an account but not to a site). Each site may only own a single asset for each product.  
     - name: productData | type: ProductData | description: Information about the Premium entity related to the asset. Available for all assets.  
     - name: wixBillingDetails | type: BillingDetails | description: Information about the asset's billing.  
        - name: paymentMethod | type: PaymentMethod | description: Information about the payment method.  
           - name: paymentMethodType | type: string | description: Information about the payment method.  
           - name: paymentMethodSubType | type: string | description: Subtype of the payment method.  
           - name: paymentBrand | type: string | description: The brand of the payment method  | validation: maxLength 100
           - name: displayLabel | type: string | description: Human-readable description. Relevant for credit cards.  
           - name: paymentSourceId | type: string | description: GUID of the payment source.  
           - name: billingAccountOwner | type: string | description: GUID of the owner of the payment method.  | validation: format GUID
        - name: lastInvoiceDetails | type: InvoiceDetails | description: Details about the last invoice. Identical to `last_successful_invoice_details` in case the `paymentStatus` of the last invoice is `"PAID"` or `"REFUNDED"`.  
           - name: invoiceId | type: string | description: GUID of the invoice.  
           - name: date | type: Date | description: Date of the invoice in `YYYY-MM-DDThh:mm:ss.sssZ` format.  
           - name: currencyCode | type: string | description: 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.  | validation: format CURRENCY
           - name: amount | type: string | description: Amount the customer was charged, as a string.  The representation isn't guaranteed to be consistent across billing providers: some report the amount in the currency's minor units, for example `950` for 9.50, and others report a decimal value, for example `9.50`. Read `billingReference.providerName` to see which billing provider an asset comes from, and don't assume a single format across assets.  | validation: format DECIMAL_VALUE
           - name: paymentStatus | type: PaymentStatus | description: Status of the payment.  
                 - enum:
                 -     UNKNOWN_PAYMENT_STATUS: There's no information about the payment status.
                 -     PAID: The customer has successfully paid for the invoice.
                 -     REFUNDED: The customer has been refunded.
                 -     CHARGE_ATTEMPT_FAILED: A charge was attempted but the payment couldn't be collected. Relevant for the following invoice statuses in the billing systems: `"CREDIT_NOTE"`, `"ERROR_CHARGES"`, `"DECLINED_CHARGES"`, and `"BAD_DEBT"`.
                 -     IN_PROGRESS: A charge is currently in progress.
                 -     NO_PAYMENT: There is no invoice. Relevant mostly for transferred assets.
                 -     NOT_BILLABLE: The invoice requires a manual payment from the customer, because the payment can't be collected automatically.
        - name: nextInvoiceDetails | type: NextInvoiceDetails | description: Details about the next invoice. Doesn't include information about the price and currency, since those values may change before the next invoice is sent. If needed, you can retrieve this information directly from the relevant billing system.  
           - name: date | type: Date | description: Next billing date in `YYYY-MM-DDThh:mm:ss.sssZ` format.  
        - name: lastSuccessfulInvoiceDetails | type: InvoiceDetails | description: Details about the last succesful invoice. Identical to `last_invoice_details` in case the `paymentStatus` of the last invoice is `"PAID"` or `"REFUNDED"`.  
        - name: customCharges | type: boolean | description: Whether the invoice is sent on behalf of a non-Wix app, with the app provider using the Custom Charges SPI.  
     - name: moneyBackPeriodEndDate | type: Date | description: End date and time of the refund period in `YYYY-MM-DDThh:mm:ss.sssZ` format. Available only for products that support a money back policy.  
     - name: freeTrialData | type: FreeTrialData | description: Information about the asset's free trial or deferred billing state. Populated when the asset was purchased with a free trial, and also while billing is deferred pending an external activation. Remains populated after a trial ends, with `inFreeTrialPeriod` set to `false`.  
        - name: endDate | type: Date | description: date when the free trial ends  | read-only: true 
        - name: inFreeTrialPeriod | type: boolean | description: Whether the asset is currently within its free trial period. Also `true` when billing is deferred pending external activation (`pendingExternalActivation` is `true`). Use `pendingExternalActivation` to distinguish a free trial from a deferred-billing hold.  | read-only: true 
        - name: pendingExternalActivation | type: boolean | description: Whether billing for the asset is on hold pending activation by an external party. While this is `true` the customer isn't charged, and the asset only starts billing once the external activation completes.  | read-only: true 
     - name: seats | type: integer | description: Number of seats/licenses for the subscription. Null means the asset doesn't support seats.  | validation: minimum 1, maximum 500, format int32
  - 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.  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: METASITE_MISSING_IN_CONTEXT | Description: The caller isn't permitted on the target account, and no meta site was supplied in the call context to fall back to.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: TARGET_ACCOUNT_MISSING_IN_CONTEXT | Description: No target account was supplied in the call context.


```

### Examples

### Retrieve the active Premium assets that belong to an account
```javascript
import { premiumAssets } from "@wix/premium-assets";

async function queryPremiumAssets() {
  const response = await premiumAssets.queryPremiumAssets({
    cursorQuery: {
      filter: { status: "ACTIVE" },
      cursorPaging: { limit: 2 },
    },
    includePermitted: false,
  });

  return response;
}

/* Promise resolves to:
 * {
 *   "premiumAssets": [
 *     {
 *       "_createdDate": "2024-10-08T12:27:48.325Z",
 *       "_updatedDate": "2025-05-14T11:50:35.497Z",
 *       "premiumId": "87410a8e-8ad6-44ef-8af8-c975fab07633",
 *       "sourceEntityCreatedDate": "2024-10-08T12:27:47.964Z",
 *       "siteData": {
 *         "metasiteId": "9f2e4b61-5c83-4a17-b0d9-6e1c7a3f8d45",
 *         "siteName": "my-bakery"
 *       },
 *       "accountOwnerId": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *       "billingReference": {
 *         "providerName": "SBS",
 *         "providerReferenceId": "0da61df2-19a3-415a-a7f9-f0a5fa81b51f"
 *       },
 *       "status": "ACTIVE",
 *       "deliveryComplete": true,
 *       "renewalType": "AUTO_RENEW_ON",
 *       "billingCycle": {
 *         "cycleType": "RECURRING",
 *         "cycleDuration": {
 *           "unit": "YEAR",
 *           "count": 2
 *         }
 *       },
 *       "subscriptionEndDate": "2026-10-08T12:27:47Z",
 *       "productData": {
 *         "productId": "afeda7e3-07b1-42a4-9308-60ca92038843",
 *         "productFamilyId": "c37d2b5e-8bff-4bbc-8958-182cf0b7c9b3",
 *         "productTypeId": "7f6a333b-83db-468a-925a-af09aa5800f2",
 *         "productTypeName": "Email Marketing",
 *         "productName": "Essentials",
 *         "productContext": "SITE"
 *       },
 *       "wixBillingDetails": {
 *         "paymentMethod": {
 *           "paymentMethodType": "CREDIT_CARD",
 *           "paymentMethodSubType": "MasterCard",
 *           "paymentBrand": "MasterCard",
 *           "displayLabel": "4152",
 *           "paymentSourceId": "bd50db74-26f7-4936-9943-ebfc2a67bac7",
 *           "billingAccountOwner": "d7a341c4-196b-46e7-813c-2b0fc1847ec6"
 *         },
 *         "lastInvoiceDetails": {
 *           "invoiceId": "1140591415",
 *           "date": "2024-10-08T12:27:47Z",
 *           "currencyCode": "USD",
 *           "amount": "0",
 *           "paymentStatus": "PAID"
 *         },
 *         "nextInvoiceDetails": {
 *           "date": "2026-10-08T12:27:47Z"
 *         },
 *         "customCharges": false
 *       },
 *       "moneyBackPeriodEndDate": "2024-10-22T12:27:47.964Z"
 *     },
 *     {
 *       "_createdDate": "2024-10-01T18:11:19.247Z",
 *       "_updatedDate": "2026-09-19T21:26:25.633Z",
 *       "premiumId": "0f591bfc-b892-409d-b01f-8008b4e5624e",
 *       "sourceEntityCreatedDate": "2024-10-01T18:11:19Z",
 *       "domainsData": {
 *         "domain": "my-bakery.com",
 *         "primary": false,
 *         "privacy": "PRIVACY_TURNED_ON",
 *         "expirationDate": "2026-10-01T18:11:17Z",
 *         "validExtendPeriod": {
 *           "startTime": "2024-10-01T18:11:17Z",
 *           "endTime": "2026-11-10T18:11:17Z"
 *         },
 *         "validInRegistrar": true,
 *         "redemptionPeriod": {
 *           "startTime": "2026-11-10T18:11:17Z",
 *           "endTime": "2026-12-10T18:11:17Z"
 *         },
 *         "dnssecSupported": false,
 *         "insuranceSupported": false,
 *         "insuranceActivated": false
 *       },
 *       "accountOwnerId": "d7a341c4-196b-46e7-813c-2b0fc1847ec6",
 *       "billingReference": {
 *         "providerName": "SBS",
 *         "providerReferenceId": "b7e6d2ef-5bf2-4273-8970-4053749978cc"
 *       },
 *       "status": "ACTIVE",
 *       "deliveryComplete": true,
 *       "renewalType": "AUTO_RENEW_ON",
 *       "billingCycle": {
 *         "cycleType": "RECURRING",
 *         "cycleDuration": {
 *           "unit": "YEAR",
 *           "count": 2
 *         }
 *       },
 *       "subscriptionEndDate": "2026-10-01T18:11:17Z",
 *       "productData": {
 *         "productId": "2856",
 *         "productTypeId": "72af0602-1321-4897-8299-f507480b2bb8",
 *         "productTypeName": "Domain",
 *         "productName": ""
 *       },
 *       "wixBillingDetails": {
 *         "paymentMethod": {
 *           "paymentMethodType": "CREDIT_CARD",
 *           "paymentMethodSubType": "Visa",
 *           "paymentBrand": "Visa",
 *           "displayLabel": "0564",
 *           "paymentSourceId": "a91a4b38-8f3a-4a38-8984-19f7743048cf",
 *           "billingAccountOwner": "d7a341c4-196b-46e7-813c-2b0fc1847ec6"
 *         },
 *         "lastInvoiceDetails": {
 *           "invoiceId": "1259603185",
 *           "currencyCode": "USD",
 *           "amount": "6457",
 *           "paymentStatus": "CHARGE_ATTEMPT_FAILED"
 *         },
 *         "nextInvoiceDetails": {
 *           "date": "2026-09-01T18:11:17Z"
 *         },
 *         "customCharges": false
 *       }
 *     }
 *   ],
 *   "pagingMetadata": {
 *     "count": 2,
 *     "cursors": {
 *       "next": "<NEXT_CURSOR>"
 *     },
 *     "hasNext": true
 *   }
 * }
 */

```

### queryPremiumAssets (self-hosted)
Self-hosted 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 { premiumAssets } from '@wix/premium-assets';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryPremiumAssets(options) {
  const response = await myWixClient.premiumAssets.queryPremiumAssets(options);
};
```

---