> 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

# AddCertificate

# Package: siteManagement

# Namespace: SslCertificateService

# Method link: https://dev.wix.com/docs/api-reference/account-level/enterprise/site-management/ssl-certificate-v1/add-certificate.md

## Permission Scopes:
Manage Site SSL & Publish State: SCOPE.ENTERPRISE.MANAGE-SITE-PROXY

## Introduction

Installs a custom SSL certificate for 1 or more domains connected to a site.

The bundle in `certificatePem` must hold, in this order, the private key, the site certificate, and the intermediate certificates. The root certificate is optional. The private key must be a 2048-bit RSA key that matches the certificate.

`domainNames` must list exactly the domains in the certificate's subject alternative names. Issue the certificate for both the apex domain and its `www` name, and pass both. Every domain must be connected to the site. The certificate must stay valid for at least 2 more months from the day you install it.

After a successful call, the domains serve the new certificate. To check which certificate a domain serves, call [Get Active Certificate](https://dev.wix.com/docs/api-reference/account-level/enterprise/site-management/ssl-certificate-v1/get-active-certificate.md).

---

## REST API

### Schema

```
 Method: addCertificate
 Description: Installs a custom SSL certificate for 1 or more domains connected to a site.  The bundle in `certificatePem` must hold, in this order, the private key, the site certificate, and the intermediate certificates. The root certificate is optional. The private key must be a 2048-bit RSA key that matches the certificate.  `domainNames` must list exactly the domains in the certificate's subject alternative names. Issue the certificate for both the apex domain and its `www` name, and pass both. Every domain must be connected to the site. The certificate must stay valid for at least 2 more months from the day you install it.  After a successful call, the domains serve the new certificate. To check which certificate a domain serves, call [Get Active Certificate](https://dev.wix.com/docs/api-reference/account-level/enterprise/site-management/ssl-certificate-v1/get-active-certificate.md).
 URL: https://www.wixapis.com/enterprise-public-proxy/v1/ssl-certificates
 Method: POST
 Method parameters:
   param name: certificatePem | type: certificatePem | description: PEM bundle holding, in this order, the private key, the site certificate, and the intermediate certificates. The root certificate is optional.  | validation: maxLength 65536
   param name: domainNames | type: array<domainNames> | description: Domains the certificate covers. For example, `example.com` and `www.example.com`. Must list exactly the domains in the certificate's subject alternative names.  | validation: minItems 1, maxItems 10, format HOSTNAME
   param name: metaSiteId | type: metaSiteId | description: GUID of the site the domains are connected to.  | validation: format GUID
 Return type: AddCertificateResponse
  - name: certificate | type: SslCertificate | description: Installed certificate.  
     - name: id | type: string | description: Certificate GUID. Derived from the certificate's common name.  | validation: maxLength 253
     - name: metaSiteId | type: string | description: GUID of the site the certificate is installed for.  | validation: format GUID
     - name: commonName | type: string | description: Common name in the certificate's subject.  | validation: maxLength 253
     - name: dnsNames | type: array<string> | description: Domains the certificate covers, as listed in its subject alternative names.  | validation: maxItems 100, maxLength 253
     - name: issuer | type: string | description: Certificate authority that issued the certificate.  | validation: maxLength 512
     - name: notBefore | type: string | description: Date and time the certificate becomes valid.  | validation: format date-time
     - name: notAfter | type: string | description: Date and time the certificate expires.  | validation: format date-time
     - name: serialNumber | type: string | description: Certificate serial number, hex-encoded.  | validation: maxLength 128


```

### Examples

### Install a custom certificate
Installs a certificate that covers the apex domain and its www name. The PEM bundle is shortened for readability.

```curl
curl -X POST \
'https://www.wixapis.com/enterprise-public-proxy/v1/ssl-certificates' \
-H 'Authorization: <AUTH>' \
-H 'wix-account-id: <ACCOUNT_ID>' \
-H 'Content-Type: application/json' \
-d '{
  "metaSiteId": "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd",
  "domainNames": ["example.com", "www.example.com"],
  "certificatePem": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7...\n-----END PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\nMIIFXTCCBEWgAwIBAgISBbp2R8IX3FCuDs09P6iA0DUfMA0GCSqGSIb3...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\nMIIFBjCCAu6gAwIBAgIRAIp9PhPWLzDbI9y2ttq7jqMwDQYJKoZIhvcN...\n-----END CERTIFICATE-----\n"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.enterpriseSiteManagement.sslCertificates.addCertificate(options)
 Description: Installs a custom SSL certificate for 1 or more domains connected to a site.  The bundle in `certificatePem` must hold, in this order, the private key, the site certificate, and the intermediate certificates. The root certificate is optional. The private key must be a 2048-bit RSA key that matches the certificate.  `domainNames` must list exactly the domains in the certificate's subject alternative names. Issue the certificate for both the apex domain and its `www` name, and pass both. Every domain must be connected to the site. The certificate must stay valid for at least 2 more months from the day you install it.  After a successful call, the domains serve the new certificate. To check which certificate a domain serves, call [Get Active Certificate](https://dev.wix.com/docs/api-reference/account-level/enterprise/site-management/ssl-certificate-v1/get-active-certificate.md).
 Method parameters:
   param name: options | type: AddCertificateOptions  none  
        - name: metaSiteId | type: string | description: GUID of the site the domains are connected to.  | validation: format GUID
        - name: domainNames | type: array<string> | description: Domains the certificate covers. For example, `example.com` and `www.example.com`. Must list exactly the domains in the certificate's subject alternative names.  | validation: minItems 1, maxItems 10, format HOSTNAME
        - name: certificatePem | type: string | description: PEM bundle holding, in this order, the private key, the site certificate, and the intermediate certificates. The root certificate is optional.  | validation: maxLength 65536
 Return type: PROMISE<AddCertificateResponse>
  - name: certificate | type: SslCertificate | description: Installed certificate.  
     - name: _id | type: string | description: Certificate GUID. Derived from the certificate's common name.  | validation: maxLength 253
     - name: metaSiteId | type: string | description: GUID of the site the certificate is installed for.  | validation: format GUID
     - name: commonName | type: string | description: Common name in the certificate's subject.  | validation: maxLength 253
     - name: dnsNames | type: array<string> | description: Domains the certificate covers, as listed in its subject alternative names.  | validation: maxItems 100, maxLength 253
     - name: issuer | type: string | description: Certificate authority that issued the certificate.  | validation: maxLength 512
     - name: notBefore | type: Date | description: Date and time the certificate becomes valid.  
     - name: notAfter | type: Date | description: Date and time the certificate expires.  
     - name: serialNumber | type: string | description: Certificate serial number, hex-encoded.  | validation: maxLength 128


```

### Examples

### Install a custom certificate
Installs a certificate that covers the apex domain and its www name. The PEM bundle is shortened for readability.

```javascript
import { sslCertificates } from "@wix/enterprise-site-management";

async function addCertificate() {
  const response = await sslCertificates.addCertificate({
    metaSiteId: "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd",
    domainNames: ["example.com", "www.example.com"],
    certificatePem:
      "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7...\n-----END PRIVATE KEY-----\n" +
      "-----BEGIN CERTIFICATE-----\nMIIFXTCCBEWgAwIBAgISBbp2R8IX3FCuDs09P6iA0DUfMA0GCSqGSIb3...\n-----END CERTIFICATE-----\n" +
      "-----BEGIN CERTIFICATE-----\nMIIFBjCCAu6gAwIBAgIRAIp9PhPWLzDbI9y2ttq7jqMwDQYJKoZIhvcN...\n-----END CERTIFICATE-----\n",
  });
}

/* Promise resolves to:
 * {
 *   "certificate": {
 *     "_id": "example.com",
 *     "metaSiteId": "e53fb2f8-c5c5-4595-ab5d-47a1e8cbe3fd",
 *     "commonName": "example.com",
 *     "dnsNames": ["example.com", "www.example.com"],
 *     "issuer": "C=US, O=Example CA, CN=Example CA Intermediate R3",
 *     "notBefore": "2026-09-15T08:06:46.000Z",
 *     "notAfter": "2026-12-14T08:06:45.000Z",
 *     "serialNumber": "05ba7647c217dc50ae0ecd3d3fa880d0351f"
 *   }
 * }
 */

```

### addCertificate (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 { sslCertificates } from '@wix/enterprise-site-management';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function addCertificate(options) {
  const response = await myWixClient.sslCertificates.addCertificate(options);
};
```

---