> 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

# CountPrograms

# Package: onlinePrograms

# Namespace: ProgramsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/online-programs/programs/count-programs.md

## Permission Scopes:
Wix Multilingual - Nile Wrapper Domain Events Read: SCOPE.MULTILINGUAL.NILE_WRAPPER_DOMAIN_EVENTS_READ

## Introduction

Counts programs that match a filter.

Results use the same visibility rules as `QueryPrograms`.

---

## REST API

### Schema

```
 Method: countPrograms
 Description: Counts programs that match a filter.  Results use the same visibility rules as `QueryPrograms`.
 URL: https://www.wixapis.com/online-programs/v3/programs/count
 Method: POST
 Method parameters:
   param name: filter | type: filter | description: WQL filter for the programs to count.  
 Return type: CountProgramsResponse
  - name: count | type: integer | description: Number of programs matching the filter and caller visibility.  


```

### Examples

### Count programs
Counts programs matching a filter.

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/v3/programs/count' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "filter": {
    "status": {
      "$eq": "PUBLISHED"
    }
  }
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.ProgramsService.countPrograms(options)
 Description: Counts programs that match a filter.  Results use the same visibility rules as `QueryPrograms`.
 Method parameters:
   param name: options | type: CountProgramsOptions  none  
        - name: filter | type: object | description: WQL filter for the programs to count.  
 Return type: PROMISE<CountProgramsResponse>
  - name: count | type: integer | description: Number of programs matching the filter and caller visibility.  


```

### Examples

### countPrograms
```javascript
import { programs } from '@wix/online-programs';

async function countPrograms(options) {
  const response = await programs.countPrograms(options);
};
```

### countPrograms (with elevated permissions)
```javascript
import { programs } from '@wix/online-programs';
import { auth } from '@wix/essentials';

async function myCountProgramsMethod(options) {
  const elevatedCountPrograms = auth.elevate(programs.countPrograms);
  const response = await elevatedCountPrograms(options);
}
```

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

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


async function countPrograms(options) {
  const response = await myWixClient.programs.countPrograms(options);
};
```

---