> 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

# GetParticipationStats

# Package: onlinePrograms

# Namespace: ParticipantsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/online-programs/participants/get-participation-stats.md

## Permission Scopes:
Manage Online Programs: SCOPE.CHALLENGES.MANAGE

## Introduction

Retrieves site-wide participant statistics for the requested programs.

The statistics aren't limited to the caller's own participation records.

---

## REST API

### Schema

```
 Method: getParticipationStats
 Description: Retrieves site-wide participant statistics for the requested programs.  The statistics aren't limited to the caller's own participation records.
 URL: https://www.wixapis.com/online-programs/v3/participants/stats
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  programIds
 Method parameters: 
   param name: programIds | type: array<programIds> | description: IDs of the programs to retrieve participant statistics for. | required: true | validation: minItems 1, maxItems 100, format GUID
 Return type: GetParticipationStatsResponse
  - name: participationStats | type: array<ProgramParticipationStats> | description: Participant statistics for each distinct requested program GUID.  | validation: maxItems 100
     - name: programId | type: string | description: Program GUID.  | validation: format GUID
     - name: participantsCount | type: integer | description: Number of participants with a joined or suspended enrollment, including participants who completed or failed the program.  
     - name: autoRemovedCount | type: integer | description: Number of participants automatically removed when the program duration ended.  


```

### Examples

### Get program participation statistics
Retrieves site-wide participant and automatic-removal counts for up to 100 programs.

```curl
curl -X POST \
'https://www.wixapis.com/online-programs/participants/v3/participants/stats' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "programIds": [
    "1a87c246-5c3a-4eea-a7c8-e5e2cf5d61c0",
    "2c38d357-6d4b-5ffb-b8d9-f6f3d5e7a2b1"
  ]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.participants.getParticipationStats(programIds)
 Description: Retrieves site-wide participant statistics for the requested programs.  The statistics aren't limited to the caller's own participation records.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  programIds
 Method parameters: 
   param name: programIds | type: array<array> | description: IDs of the programs to retrieve participant statistics for. | required: true | validation: minItems 1, maxItems 100, format GUID
 Return type: PROMISE<GetParticipationStatsResponse>
  - name: participationStats | type: array<ProgramParticipationStats> | description: Participant statistics for each distinct requested program GUID.  | validation: maxItems 100
     - name: programId | type: string | description: Program GUID.  | validation: format GUID
     - name: participantsCount | type: integer | description: Number of participants with a joined or suspended enrollment, including participants who completed or failed the program.  
     - name: autoRemovedCount | type: integer | description: Number of participants automatically removed when the program duration ended.  


```

### Examples

### Get program participation statistics
Retrieves site-wide participant and automatic-removal counts for specified programs.

```javascript
import { participants } from "@wix/online-programs";

async function getParticipationStats() {
  const response = await participants.getParticipationStats([
    "1a87c246-5c3a-4eea-a7c8-e5e2cf5d61c0",
    "2c38d357-6d4b-5ffb-b8d9-f6f3d5e7a2b1",
  ]);

  return response;
}

/* Promise resolves to:
 * {
 *   "participationStats": [
 *     {
 *       "programId": "1a87c246-5c3a-4eea-a7c8-e5e2cf5d61c0",
 *       "participantsCount": 42,
 *       "autoRemovedCount": 3
 *     },
 *     {
 *       "programId": "2c38d357-6d4b-5ffb-b8d9-f6f3d5e7a2b1",
 *       "participantsCount": 7,
 *       "autoRemovedCount": 0
 *     }
 *   ]
 * }
 */

```

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

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


async function getParticipationStats(programIds) {
  const response = await myWixClient.participants.getParticipationStats(programIds);
};
```

---