> 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

# GetCertificateDownloadUrl

# Package: onlinePrograms

# Namespace: ParticipantsService

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

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

## Introduction

Retrieves a download URL for the participant's latest issued certificate.

The URL is returned only after the certificate document finishes rendering.

---

## REST API

### Schema

```
 Method: getCertificateDownloadUrl
 Description: Retrieves a download URL for the participant's latest issued certificate.  The URL is returned only after the certificate document finishes rendering.
 URL: https://www.wixapis.com/online-programs/v3/participants/{participantId}/certificate-download-url
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  participantId
 Method parameters: 
   param name: participantId | type:   none | required: true 
 Return type: GetCertificateDownloadUrlResponse
  - name: downloadUrl | type: string | description: URL for downloading the participant's certificate.  | validation: format WEB_URL
  - name: expirationDate | type: string | description: Time when the download URL token expires. The underlying certificate document may expire earlier.  | validation: format date-time

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CERTIFICATE_DOCUMENT_NOT_FOUND | Description: No certificate document exists for the participant.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CERTIFICATE_NOT_ISSUED | Description: The participant doesn't have an issued certificate.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_EXPIRED | Description: The certificate document expired and is no longer available.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_RENDER_FAILED | Description: The certificate document failed to render.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_NOT_READY | Description: The certificate document hasn't finished rendering.


```

### Examples

### Get a certificate download URL
Retrieves the download URL for a participant's most recently issued certificate

```curl
curl -X GET \
'https://www.wixapis.com/online-programs/participants/v3/participants/4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4/certificate-download-url' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.onlinePrograms.participants.getCertificateDownloadUrl(participantId)
 Description: Retrieves a download URL for the participant's latest issued certificate.  The URL is returned only after the certificate document finishes rendering.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  participantId
 Method parameters: 
   param name: participantId | type: string | description: GUID of the participant whose certificate download URL to retrieve. | required: true | validation: format GUID
 Return type: PROMISE<GetCertificateDownloadUrlResponse>
  - name: downloadUrl | type: string | description: URL for downloading the participant's certificate.  | validation: format WEB_URL
  - name: expirationDate | type: Date | description: Time when the download URL token expires. The underlying certificate document may expire earlier.  

 Possible Errors:
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CERTIFICATE_DOCUMENT_NOT_FOUND | Description: No certificate document exists for the participant.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CERTIFICATE_NOT_ISSUED | Description: The participant doesn't have an issued certificate.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_EXPIRED | Description: The certificate document expired and is no longer available.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_RENDER_FAILED | Description: The certificate document failed to render.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CERTIFICATE_NOT_READY | Description: The certificate document hasn't finished rendering.


```

### Examples

### Get a certificate download URL
Retrieves the download URL for a participant's most recently issued certificate.

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

async function getCertificateDownloadUrl() {
  const response = await participants.getCertificateDownloadUrl(
    "4f87b2e3-2a0d-4b9f-9a1c-2d8e71b7e5c4",
  );

  return response;
}

/* Promise resolves to:
 * {
 *   "downloadUrl": "https://papyrus.wixapps.net/view?file=JWS.eyJraWQiOiJleGFtcGxlIn0.eyJkb2N1bWVudElkIjoiY2Y2Y2UxY2QtYTUyNC00NTZlLWEzOWMtZDU5ZjNmOGU5Y2E0In0.signature",
 *   "expirationDate": new Date("2026-12-31T00:00:00.000Z")
 * }
 */

```

### getCertificateDownloadUrl (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 getCertificateDownloadUrl(participantId) {
  const response = await myWixClient.participants.getCertificateDownloadUrl(participantId);
};
```

---