> 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

# SearchBillableItems

# Package: getPaid

# Namespace: BillableItems

# Method link: https://dev.wix.com/docs/api-reference/business-management/get-paid/billable-items/search-billable-items.md

## Permission Scopes:
Manage Billable Items: SCOPE.BILLABLE_ITEMS.MANAGE-BILLABLE-ITEMS

## Introduction

Retrieves a list of up to 100 billable items, given the specified filtering, search expression, sorting, and cursor paging.

Learn more about [API query language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md).

---

## REST API

### Schema

```
 Method: searchBillableItems
 Description: Retrieves a list of up to 100 billable items, given the specified filtering, search expression, sorting, and cursor paging.  Learn more about [API query language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md).
 URL: https://www.wixapis.com/billable-items/v1/billable-items/search
 Method: POST
 Method parameters:
   param name: search | type: CursorSearch    
     - name: cursorPaging | type: CursorPaging | description: Cursor pointing to page of results. When requesting 'cursor_paging.cursor', no `filter`, `sort` or `search` can be provided.  
        - 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: A filter object. See documentation [here](https://bo.wix.com/wix-docs/rnd/platformization-guidelines/api-query-language#platformization-guidelines_api-query-language_defining-in-protobuf)  
        - name: sort | type: array<Sorting> | description: Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]  | validation: maxItems 10
           - 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: aggregations | type: array<Aggregation> | description: Aggregations | Faceted search: refers to a way to explore large amounts of data by displaying summaries about various partitions of the data and later allowing to narrow the navigation to a specific partition.  | validation: maxItems 10
           - ONE-OF: 
              - name: value | type: ValueAggregation | description: Value aggregation  
                 - ONE-OF: 
                    - name: includeOptions | type: IncludeMissingValuesOptions | description: Options for including missing values  
                       - name: addToBucket | type: string | description: Can specify custom bucket name. Defaults are [string -> "N/A"], [int -> "0"], [bool -> "false"] ...  | validation: maxLength 20
                 - name: sortType | type: SortType | description: Should sort by number of matches or value of the field  
                         - enum:
                         -     COUNT: Should sort by number of matches
                         -     VALUE: Should sort by value of the field alphabetically
                 - name: sortDirection | type: SortDirection | description: Should sort in ascending or descending order  
                         - enum:
                         -     DESC: Should sort in descending order
                         -     ASC: Should sort in ascending order
                 - name: limit | type: integer | description: How many aggregations would you like to return? Can be between 1 and 250. 10 is the default.  | validation: format int32
                 - name: missingValues | type: MissingValues | description: Should missing values be included or excluded from the aggregation results. Default is EXCLUDE  
                         - enum:
                         -     EXCLUDE: Should missing values be excluded from the aggregation results
                         -     INCLUDE: Should missing values be included in the aggregation results
              - name: range | type: RangeAggregation | description: Range aggregation  
                 - name: buckets | type: array<RangeBucket> | description: List of range buckets, where during aggregation each entity will be placed in the first bucket where its value falls into based on provided range bounds  | validation: maxItems 50
                    - name: from | type: number | description: Inclusive lower bound of the range. Required if to is not given  | validation: format double
                    - name: to | type: number | description: Exclusive upper bound of the range. Required if from is not given  | validation: format double
              - name: scalar | type: ScalarAggregation | description: Scalar aggregation  
                 - name: type | type: ScalarType | description: Define the operator for the scalar aggregation  
                         - enum:
                         -     COUNT_DISTINCT: Count of distinct values
                         -     MIN: Minimum value
                         -     MAX: Maximum value
              - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation  
                 - name: interval | type: Interval | description: Interval for date histogram aggregation  
                         - enum:
                         -     YEAR: Yearly interval
                         -     MONTH: Monthly interval
                         -     WEEK: Weekly interval
                         -     DAY: Daily interval
                         -     HOUR: Hourly interval
                         -     MINUTE: Minute interval
                         -     SECOND: Second interval
              - name: nested | type: NestedAggregation | description: Nested aggregation  
                 - name: nestedAggregations | type: array<NestedAggregationItem> | description: Flattened list of aggregations, where each next aggregation is nested within previous one  | validation: minItems 2, maxItems 3
                    - ONE-OF: 
                       - name: value | type: ValueAggregation | description: Value aggregation  
                       - name: range | type: RangeAggregation | description: Range aggregation  
                       - name: scalar | type: ScalarAggregation | description: Scalar aggregation  
                       - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation  
                    - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results  | validation: maxLength 100
                    - name: type | type: NestedAggregationType | description: Type of aggregation, client must provide matching aggregation field below  
                             - enum:
                             -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                             -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                             -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                             -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                    - name: fieldPath | type: string | description: Field to aggregate by, use dont notation to specify json path  | validation: maxLength 200
           - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results  | validation: maxLength 100
           - name: type | type: AggregationType | description: Type of aggregation, client must provide matching aggregation field below  
                 - enum:
                 -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                 -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                 -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                 -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                 -     NESTED: Multi-level aggregation, where each next aggregation is nested within previous one
           - name: fieldPath | type: string | description: Field to aggregate by, use dot notation to specify json path  | validation: maxLength 200
        - name: search | type: SearchDetails | description: Free text to match in searchable fields  
           - name: mode | type: Mode | description: Defines how separate search terms in `expression` are combined  
                 - enum:
                 -     OR: Any of the search terms must be present
                 -     AND: All search terms must be present
           - name: expression | type: string | description: Search term or expression  | validation: maxLength 100
           - name: fields | type: array<string> | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path  | validation: maxItems 20, maxLength 200
           - name: fuzzy | type: boolean | description: Flag if should use auto fuzzy search (allowing typos by a managed proximity algorithm)  
        - name: timeZone | type: string | description: UTC offset or IANA time zone. Valid values are ISO 8601 UTC offsets, such as +02:00 or -06:00, and IANA time zone GUIDs, such as Europe/Rome  Affects all filters and aggregations returned values. You may override this behavior in a specific filter by providing timestamps including time zone. e.g. `"2023-12-20T10:52:34.795Z"`  | validation: maxLength 50
 Searchable fields:
   - field: createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: description | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: true
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: true
   - field: price | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: taxGroupId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
 Return type: SearchBillableItemsResponse
  - name: billableItems | type: array<BillableItem> | description: Requested billable items.  
     - name: id | type: string | description: Billable item GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the billable item is updated. To prevent conflicting changes, the current revision must be passed when updating the billable item.  Ignored when creating a billable item.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the billable item was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the billable item was last updated.  | read-only: true | validation: format date-time
     - name: name | type: string | description: Billable item name, for display on invoices.  | validation: minLength 1, maxLength 200
     - name: description | type: string | description: Detailed description of the billable item. Provides additional information about the product or service.  | validation: minLength 1, maxLength 600
     - name: price | type: string | description: Price of the billable item in decimal format with up to 4 decimal places. Represents the base cost before taxes are applied. This is a required field when creating a new billable item.  | validation: format DECIMAL_VALUE, decimalValue {"gte":"-1000000000000000","lte":"1000000000000000","maxScale":4}
     - name: taxGroupId | type: string | description: Reference to a tax group that defines the tax rules applicable to this billable item. Use the Tax Groups API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/billing/tax-groups/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/tax/tax-groups/introduction.md)) to retrieve available tax groups for the business. The tax group determines how taxes are calculated when this item is added to an invoice. If not specified, the default tax rules for the business will apply.  | validation: format GUID
     - name: image | type: Image | description: Billable item image, stored in the Wix Media Manager. Upload an image with the Media Manager API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/introduction.md) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md)) or the site dashboard before associating it to a billable item.  
        - name: id | type: string | description: WixMedia image GUID.  
        - name: url | type: string | description: Image 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.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the billable item. Extended fields 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: tags | type: Tags | description: Tags.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
           - name: tagIds | type: array<string> | description: List of tag GUIDs  | validation: maxItems 100, maxLength 5
        - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
  - name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.  
     - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.  
        - 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: aggregationData | type: AggregationData | description: Response aggregation data.  
     - name: results | type: array<AggregationResults> | description: key = aggregation name (as derived from search request)  | validation: maxItems 10000
        - ONE-OF: 
           - name: values | type: ValueResults | description: Value aggregation results  
              - name: results | type: array<ValueAggregationResult> | description: List of value aggregations  | validation: maxItems 250
                 - name: value | type: string | description: Value of the field  | validation: maxLength 100
                 - name: count | type: integer | description: Count of entities with this value  
           - name: ranges | type: RangeResults | description: Range aggregation results  
              - name: results | type: array<RangeAggregationResult> | description: List of ranges returned in same order as requested  | validation: maxItems 50
                 - name: from | type: number | description: Inclusive lower bound of the range  | validation: format double
                 - name: to | type: number | description: Exclusive upper bound of the range  | validation: format double
                 - name: count | type: integer | description: Count of entities in this range  
           - name: scalar | type: ScalarResult | description: Scalar aggregation results  
              - name: type | type: ScalarType | description: Type of scalar aggregation  
                     - enum:
                     -     COUNT_DISTINCT: Count of distinct values
                     -     MIN: Minimum value
                     -     MAX: Maximum value
              - name: value | type: number | description: Value of the scalar aggregation  
           - name: groupedByValue | type: GroupByValueResults | description: Group by value aggregation results  
              - name: results | type: array<NestedValueAggregationResult> | description: List of value aggregations  | validation: maxItems 1000
                 - name: value | type: string | description: Value of the field  | validation: maxLength 1000
                 - name: nestedResults | type: NestedAggregationResults | description: Nested aggregations  
                    - ONE-OF: 
                       - name: values | type: ValueResults | description: Value aggregation results  
                       - name: ranges | type: RangeResults | description: Range aggregation results  
                       - name: scalar | type: ScalarResult | description: Scalar aggregation results  
                    - name: name | type: string | description: User-defined name of aggregation, matches the one provided in request  | validation: maxLength 100
                    - name: type | type: AggregationType | description: Type of aggregation that matches result  
                             - enum:
                             -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                             -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                             -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                             -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                             -     NESTED: Multi-level aggregation, where each next aggregation is nested within previous one
                    - name: fieldPath | type: string | description: Field to aggregate by, matches the one provided in request  | validation: maxLength 200
           - name: dateHistogram | type: DateHistogramResults | description: Date histogram aggregation results  
              - name: results | type: array<DateHistogramResult> | description: List of date histogram aggregations  | validation: maxItems 200
                 - name: value | type: string | description: Date in ISO 8601 format  | validation: maxLength 100
                 - name: count | type: integer | description: Count of documents in the bucket  
           - name: nested | type: NestedResults | description: Nested aggregation results  
              - name: results | type: array<Results> | description: List of nested aggregations  | validation: maxItems 1000
                 - name: results | type: Map<string,NestedResultValue> | description: List of nested aggregations  | validation: format map
                    - ONE-OF: 
                       - name: value | type: ValueResult | description: Value aggregation result  
                          - name: value | type: string | description: Value of the field  | validation: maxLength 1000
                          - name: count | type: integer | description: Count of entities with this value  | validation: format int32
                       - name: range | type: RangeResult | description: Range aggregation result  
                          - name: from | type: number | description: Inclusive lower bound of the range  | validation: format double
                          - name: to | type: number | description: Exclusive upper bound of the range  | validation: format double
                          - name: count | type: integer | description: Count of entities in this range  | validation: format int32
                       - name: scalar | type: ScalarResult | description: Scalar aggregation result  
                          - name: value | type: number | description: Value of the scalar aggregation  
                       - name: dateHistogram | type: ValueResult | description: Date histogram aggregation result  
        - name: name | type: string | description: User-defined name of aggregation as derived from search request  | validation: maxLength 100
        - name: type | type: AggregationType | description: Type of aggregation that must match provided kind as derived from search request  
        - name: fieldPath | type: string | description: Field to aggregate by as derived from search request  | validation: maxLength 200


```

### Examples

### Search BillableItems
Searches for BillableItems using advanced filtering and sorting

```curl
curl -X POST \
  'https://www.wixapis.com/billable-items/v1/billable-items/search' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
  "search": {
    "filter": {
      "price": {
        "$gte": "50.00"
      },
      "tags.tags.tagIds": {
        "$hasSome": ["premium"]
      }
    },
    "sort": [
      {
        "fieldName": "price",
        "order": "DESC"
      }
    ],
    "cursorPaging": {
      "limit": 10
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.getPaid.billableItems.searchBillableItems(search)
 Description: Retrieves a list of up to 100 billable items, given the specified filtering, search expression, sorting, and cursor paging.  Learn more about [API query language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  search
 Method parameters: 
   param name: search | type: CursorSearch   | required: true 
     - name: cursorPaging | type: CursorPaging | description: Cursor pointing to page of results. When requesting 'cursor_paging.cursor', no `filter`, `sort` or `search` can be provided.  
        - 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: A filter object. See documentation [here](https://bo.wix.com/wix-docs/rnd/platformization-guidelines/api-query-language#platformization-guidelines_api-query-language_defining-in-protobuf)  
        - name: sort | type: array<Sorting> | description: Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]  | validation: maxItems 10
           - 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: aggregations | type: array<Aggregation> | description: Aggregations | Faceted search: refers to a way to explore large amounts of data by displaying summaries about various partitions of the data and later allowing to narrow the navigation to a specific partition.  | validation: maxItems 10
           - ONE-OF: 
              - name: value | type: ValueAggregation | description: Value aggregation  
                 - ONE-OF: 
                    - name: includeOptions | type: IncludeMissingValuesOptions | description: Options for including missing values  
                       - name: addToBucket | type: string | description: Can specify custom bucket name. Defaults are [string -> "N/A"], [int -> "0"], [bool -> "false"] ...  | validation: maxLength 20
                 - name: sortType | type: SortType | description: Should sort by number of matches or value of the field  
                         - enum:
                         -     COUNT: Should sort by number of matches
                         -     VALUE: Should sort by value of the field alphabetically
                 - name: sortDirection | type: SortDirection | description: Should sort in ascending or descending order  
                         - enum:
                         -     DESC: Should sort in descending order
                         -     ASC: Should sort in ascending order
                 - name: limit | type: integer | description: How many aggregations would you like to return? Can be between 1 and 250. 10 is the default.  | validation: format int32
                 - name: missingValues | type: MissingValues | description: Should missing values be included or excluded from the aggregation results. Default is EXCLUDE  
                         - enum:
                         -     EXCLUDE: Should missing values be excluded from the aggregation results
                         -     INCLUDE: Should missing values be included in the aggregation results
              - name: range | type: RangeAggregation | description: Range aggregation  
                 - name: buckets | type: array<RangeBucket> | description: List of range buckets, where during aggregation each entity will be placed in the first bucket where its value falls into based on provided range bounds  | validation: maxItems 50
                    - name: from | type: number | description: Inclusive lower bound of the range. Required if to is not given  
                    - name: to | type: number | description: Exclusive upper bound of the range. Required if from is not given  
              - name: scalar | type: ScalarAggregation | description: Scalar aggregation  
                 - name: type | type: ScalarType | description: Define the operator for the scalar aggregation  
                         - enum:
                         -     COUNT_DISTINCT: Count of distinct values
                         -     MIN: Minimum value
                         -     MAX: Maximum value
              - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation  
                 - name: interval | type: Interval | description: Interval for date histogram aggregation  
                         - enum:
                         -     YEAR: Yearly interval
                         -     MONTH: Monthly interval
                         -     WEEK: Weekly interval
                         -     DAY: Daily interval
                         -     HOUR: Hourly interval
                         -     MINUTE: Minute interval
                         -     SECOND: Second interval
              - name: nested | type: NestedAggregation | description: Nested aggregation  
                 - name: nestedAggregations | type: array<NestedAggregationItem> | description: Flattened list of aggregations, where each next aggregation is nested within previous one  | validation: minItems 2, maxItems 3
                    - ONE-OF: 
                       - name: value | type: ValueAggregation | description: Value aggregation  
                       - name: range | type: RangeAggregation | description: Range aggregation  
                       - name: scalar | type: ScalarAggregation | description: Scalar aggregation  
                       - name: dateHistogram | type: DateHistogramAggregation | description: Date histogram aggregation  
                    - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results  | validation: maxLength 100
                    - name: type | type: NestedAggregationType | description: Type of aggregation, client must provide matching aggregation field below  
                             - enum:
                             -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                             -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                             -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                             -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                    - name: fieldPath | type: string | description: Field to aggregate by, use dont notation to specify json path  | validation: maxLength 200
           - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results  | validation: maxLength 100
           - name: type | type: AggregationType | description: Type of aggregation, client must provide matching aggregation field below  
                 - enum:
                 -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                 -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                 -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                 -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                 -     NESTED: Multi-level aggregation, where each next aggregation is nested within previous one
           - name: fieldPath | type: string | description: Field to aggregate by, use dot notation to specify json path  | validation: maxLength 200
        - name: search | type: SearchDetails | description: Free text to match in searchable fields  
           - name: mode | type: Mode | description: Defines how separate search terms in `expression` are combined  
                 - enum:
                 -     OR: Any of the search terms must be present
                 -     AND: All search terms must be present
           - name: expression | type: string | description: Search term or expression  | validation: maxLength 100
           - name: fields | type: array<string> | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path  | validation: maxItems 20, maxLength 200
           - name: fuzzy | type: boolean | description: Flag if should use auto fuzzy search (allowing typos by a managed proximity algorithm)  
        - name: timeZone | type: string | description: UTC offset or IANA time zone. Valid values are ISO 8601 UTC offsets, such as +02:00 or -06:00, and IANA time zone GUIDs, such as Europe/Rome  Affects all filters and aggregations returned values. You may override this behavior in a specific filter by providing timestamps including time zone. e.g. `"2023-12-20T10:52:34.795Z"`  | validation: maxLength 50
 Searchable fields:
   - field: _createdDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: _id | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: _updatedDate | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: description | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: true
   - field: name | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: true
   - field: price | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
   - field: taxGroupId | operators: $eq, $ne, $in, $exists, $gt, $gte, $lt, $lte, $startsWith | sort: ASC, DESC | aggregatable: true | searchable: false
 Return type: PROMISE<SearchBillableItemsResponse>
  - name: billableItems | type: array<BillableItem> | description: Requested billable items.  
     - name: _id | type: string | description: Billable item GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the billable item is updated. To prevent conflicting changes, the current revision must be passed when updating the billable item.  Ignored when creating a billable item.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the billable item was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the billable item was last updated.  | read-only: true 
     - name: name | type: string | description: Billable item name, for display on invoices.  | validation: minLength 1, maxLength 200
     - name: description | type: string | description: Detailed description of the billable item. Provides additional information about the product or service.  | validation: minLength 1, maxLength 600
     - name: price | type: string | description: Price of the billable item in decimal format with up to 4 decimal places. Represents the base cost before taxes are applied. This is a required field when creating a new billable item.  | validation: format DECIMAL_VALUE, decimalValue {"gte":"-1000000000000000","lte":"1000000000000000","maxScale":4}
     - name: taxGroupId | type: string | description: Reference to a tax group that defines the tax rules applicable to this billable item. Use the Tax Groups API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/billing/tax-groups/introduction.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/tax/tax-groups/introduction.md)) to retrieve available tax groups for the business. The tax group determines how taxes are calculated when this item is added to an invoice. If not specified, the default tax rules for the business will apply.  | validation: format GUID
     - name: image | type: string | description: Billable item image, stored in the Wix Media Manager. Upload an image with the Media Manager API ([SDK](https://dev.wix.com/docs/sdk/backend-modules/media/introduction.md) | [REST](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md)) or the site dashboard before associating it to a billable item.  
     - name: extendedFields | type: ExtendedFields | description: Custom field data for the billable item. Extended fields 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: tags | type: Tags | description: Tags.  
        - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
           - name: tagIds | type: array<string> | description: List of tag GUIDs  | validation: maxItems 100, maxLength 5
        - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
  - name: pagingMetadata | type: PagingMetadataV2 | description: Paging metadata.  
     - name: count | type: integer | description: Number of items returned in the response.  | validation: format int32
     - name: offset | type: integer | description: Offset that was requested.  | validation: format int32
     - name: total | type: integer | description: Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set.  | validation: format int32
     - name: tooManyToCount | type: boolean | description: Flag that indicates the server failed to calculate the `total` field.  
     - name: cursors | type: Cursors | description: Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used.  
        - 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: aggregationData | type: AggregationData | description: Response aggregation data.  
     - name: results | type: array<AggregationResults> | description: key = aggregation name (as derived from search request)  | validation: maxItems 10000
        - ONE-OF: 
           - name: values | type: ValueResults | description: Value aggregation results  
              - name: results | type: array<ValueAggregationResult> | description: List of value aggregations  | validation: maxItems 250
                 - name: value | type: string | description: Value of the field  | validation: maxLength 100
                 - name: count | type: integer | description: Count of entities with this value  
           - name: ranges | type: RangeResults | description: Range aggregation results  
              - name: results | type: array<RangeAggregationResult> | description: List of ranges returned in same order as requested  | validation: maxItems 50
                 - name: from | type: number | description: Inclusive lower bound of the range  
                 - name: to | type: number | description: Exclusive upper bound of the range  
                 - name: count | type: integer | description: Count of entities in this range  
           - name: scalar | type: ScalarResult | description: Scalar aggregation results  
              - name: type | type: ScalarType | description: Type of scalar aggregation  
                     - enum:
                     -     COUNT_DISTINCT: Count of distinct values
                     -     MIN: Minimum value
                     -     MAX: Maximum value
              - name: value | type: number | description: Value of the scalar aggregation  
           - name: groupedByValue | type: GroupByValueResults | description: Group by value aggregation results  
              - name: results | type: array<NestedValueAggregationResult> | description: List of value aggregations  | validation: maxItems 1000
                 - name: value | type: string | description: Value of the field  | validation: maxLength 1000
                 - name: nestedResults | type: NestedAggregationResults | description: Nested aggregations  
                    - ONE-OF: 
                       - name: values | type: ValueResults | description: Value aggregation results  
                       - name: ranges | type: RangeResults | description: Range aggregation results  
                       - name: scalar | type: ScalarResult | description: Scalar aggregation results  
                    - name: name | type: string | description: User-defined name of aggregation, matches the one provided in request  | validation: maxLength 100
                    - name: type | type: AggregationType | description: Type of aggregation that matches result  
                             - enum:
                             -     VALUE: An aggregation where result buckets are dynamically built - one per unique value
                             -     RANGE: An aggregation, where user can define set of ranges - each representing a bucket
                             -     SCALAR: A single-value metric aggregation - e.g. min, max, sum, avg
                             -     DATE_HISTOGRAM: An aggregation, where result buckets are dynamically built - one per time interval (hour, day, week, etc.)
                             -     NESTED: Multi-level aggregation, where each next aggregation is nested within previous one
                    - name: fieldPath | type: string | description: Field to aggregate by, matches the one provided in request  | validation: maxLength 200
           - name: dateHistogram | type: DateHistogramResults | description: Date histogram aggregation results  
              - name: results | type: array<DateHistogramResult> | description: List of date histogram aggregations  | validation: maxItems 200
                 - name: value | type: string | description: Date in ISO 8601 format  | validation: maxLength 100
                 - name: count | type: integer | description: Count of documents in the bucket  
           - name: nested | type: NestedResults | description: Nested aggregation results  
              - name: results | type: array<Results> | description: List of nested aggregations  | validation: maxItems 1000
                 - name: results | type: Map<string,NestedResultValue> | description: List of nested aggregations  | validation: format map
                    - ONE-OF: 
                       - name: value | type: ValueResult | description: Value aggregation result  
                          - name: value | type: string | description: Value of the field  | validation: maxLength 1000
                          - name: count | type: integer | description: Count of entities with this value  | validation: format int32
                       - name: range | type: RangeResult | description: Range aggregation result  
                          - name: from | type: number | description: Inclusive lower bound of the range  
                          - name: to | type: number | description: Exclusive upper bound of the range  
                          - name: count | type: integer | description: Count of entities in this range  | validation: format int32
                       - name: scalar | type: ScalarResult | description: Scalar aggregation result  
                          - name: value | type: number | description: Value of the scalar aggregation  
                       - name: dateHistogram | type: ValueResult | description: Date histogram aggregation result  
        - name: name | type: string | description: User-defined name of aggregation as derived from search request  | validation: maxLength 100
        - name: type | type: AggregationType | description: Type of aggregation that must match provided kind as derived from search request  
        - name: fieldPath | type: string | description: Field to aggregate by as derived from search request  | validation: maxLength 200


```

### Examples

### searchBillableItems
```javascript
import { billableItems } from '@wix/get-paid';

async function searchBillableItems(search) {
  const response = await billableItems.searchBillableItems(search);
};
```

### searchBillableItems (with elevated permissions)
```javascript
import { billableItems } from '@wix/get-paid';
import { auth } from '@wix/essentials';

async function mySearchBillableItemsMethod(search) {
  const elevatedSearchBillableItems = auth.elevate(billableItems.searchBillableItems);
  const response = await elevatedSearchBillableItems(search);
}
```

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

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


async function searchBillableItems(search) {
  const response = await myWixClient.billableItems.searchBillableItems(search);
};
```

---