> 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 # 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. - 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. - 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 | description: Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}] - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC - name: aggregations | type: array | 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. - 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"] ... - 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. - 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 | 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 - 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 | description: Flattened list of aggregations, where each next aggregation is nested within previous one - 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 - 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 - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - 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 - 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 - name: fields | type: array | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path - 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"` Return type: SearchBillableItemsResponse - name: billableItems | type: array | description: Requested billable items. - name: id | type: string | description: Billable item 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. - name: createdDate | type: string | description: Date and time the billable item was created. - name: updatedDate | type: string | description: Date and time the billable item was last updated. - name: name | type: string | description: Billable item name, for display on invoices. - name: description | type: string | description: Detailed description of the billable item. Provides additional information about the product or service. - 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. - 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. - 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. - name: width | type: integer | description: Original image width. - 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). - 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 | description: List of tag GUIDs - 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. - name: offset | type: integer | description: Offset that was requested. - 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. - 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. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: aggregationData | type: AggregationData | description: Response aggregation data. - name: results | type: array | description: key = aggregation name (as derived from search request) - ONE-OF: - name: values | type: ValueResults | description: Value aggregation results - name: results | type: array | description: List of value aggregations - name: value | type: string | description: Value of the field - name: count | type: integer | description: Count of entities with this value - name: ranges | type: RangeResults | description: Range aggregation results - name: results | type: array | description: List of ranges returned in same order as requested - 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 | description: List of value aggregations - name: value | type: string | description: Value of the field - 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 - 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 - name: dateHistogram | type: DateHistogramResults | description: Date histogram aggregation results - name: results | type: array | description: List of date histogram aggregations - name: value | type: string | description: Date in ISO 8601 format - name: count | type: integer | description: Count of documents in the bucket - name: nested | type: NestedResults | description: Nested aggregation results - name: results | type: array | description: List of nested aggregations - name: results | type: Map | description: List of nested aggregations - ONE-OF: - name: value | type: ValueResult | description: Value aggregation result - name: value | type: string | description: Value of the field - name: count | type: integer | description: Count of entities with this value - 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 - 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 - 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 ``` ### 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: ' \ -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. - 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. - 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 | description: Sort object in the form [{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}] - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC - name: aggregations | type: array | 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. - 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"] ... - 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. - 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 | 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 - 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 | description: Flattened list of aggregations, where each next aggregation is nested within previous one - 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 - 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 - name: name | type: string | description: User-defined name of aggregation, should be unique, will appear in aggregation results - 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 - 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 - name: fields | type: array | description: Fields to search in. If empty - will search in all searchable fields. Use dot notation to specify json path - 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"` Return type: PROMISE - name: billableItems | type: array | description: Requested billable items. - name: _id | type: string | description: Billable item 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. - name: _createdDate | type: Date | description: Date and time the billable item was created. - name: _updatedDate | type: Date | description: Date and time the billable item was last updated. - name: name | type: string | description: Billable item name, for display on invoices. - name: description | type: string | description: Detailed description of the billable item. Provides additional information about the product or service. - 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. - 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. - 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). - 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 | description: List of tag GUIDs - 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. - name: offset | type: integer | description: Offset that was requested. - 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. - 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. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: aggregationData | type: AggregationData | description: Response aggregation data. - name: results | type: array | description: key = aggregation name (as derived from search request) - ONE-OF: - name: values | type: ValueResults | description: Value aggregation results - name: results | type: array | description: List of value aggregations - name: value | type: string | description: Value of the field - name: count | type: integer | description: Count of entities with this value - name: ranges | type: RangeResults | description: Range aggregation results - name: results | type: array | description: List of ranges returned in same order as requested - 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 | description: List of value aggregations - name: value | type: string | description: Value of the field - 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 - 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 - name: dateHistogram | type: DateHistogramResults | description: Date histogram aggregation results - name: results | type: array | description: List of date histogram aggregations - name: value | type: string | description: Date in ISO 8601 format - name: count | type: integer | description: Count of documents in the bucket - name: nested | type: NestedResults | description: Nested aggregation results - name: results | type: array | description: List of nested aggregations - name: results | type: Map | description: List of nested aggregations - ONE-OF: - name: value | type: ValueResult | description: Value aggregation result - name: value | type: string | description: Value of the field - name: count | type: integer | description: Count of entities with this value - 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 - 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 - 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 ``` ### 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-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 { 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); }; ``` ---