> 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 # CountPlans # Package: pricingPlans # Namespace: PlanService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/count-plans.md ## Permission Scopes: Read Pricing Plans: SCOPE.DC-PAIDPLANS.READ-PLANS ## Introduction Counts plans by the provided filter. To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). --- ## REST API ### Schema ``` Method: countPlans Description: Counts plans by the provided filter. To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). URL: https://www.wixapis.com/pricing-plans/v3/plans/count Method: POST Method parameters: param name: filter | type: filter | 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` param name: search | type: SearchDetails - 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) Return type: CountPlansResponse - name: count | type: integer | description: The number of plans. ``` ### Examples ### Count plans ```curl curl -X POST \ 'https://www.wixapis.com/pricing-plans/v3/plans/count' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "filter": { "visibility": "PUBLIC" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricingPlans.PlanService.countPlans(options) Description: Counts plans by the provided filter. To learn about working with queries, see [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language). Method parameters: param name: options | type: CountPlansOptions none - 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: search | type: SearchDetails | description: Free text to match in searchable fields. When specified, the method uses search instead of filter, and may be less consistent. - 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) Return type: PROMISE - name: count | type: integer | description: The number of plans. ``` ### Examples ### countPlans ```javascript import { plansV3 } from '@wix/pricing-plans'; async function countPlans(options) { const response = await plansV3.countPlans(options); }; ``` ### countPlans (with elevated permissions) ```javascript import { plansV3 } from '@wix/pricing-plans'; import { auth } from '@wix/essentials'; async function myCountPlansMethod(options) { const elevatedCountPlans = auth.elevate(plansV3.countPlans); const response = await elevatedCountPlans(options); } ``` ### countPlans (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 { plansV3 } from '@wix/pricing-plans'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { plansV3 }, // Include the auth strategy and host as relevant }); async function countPlans(options) { const response = await myWixClient.plansV3.countPlans(options); }; ``` ---