Install SSL certificate

This function installs an SSL certificate.

Note:

Due to their inherent complexities, SSL-related functions often present problems for third-party developers. For the additional steps required to successfully call this function, read our Call UAPI's SSL::install_ssl Function in Custom Code documentation.

Important:

When you disable the Calendars and Contacts, Receive Mail, Web Disk, Webmail, and Web Server roles, the system disables this function.

Authorizations:
query Parameters
cert
required
string <pem-certificate>

The certificate to install.

Note:

  • You must URI-encode this value.

  • You can use a Perl command to URI-encode your SSL certificate for this parameter. For example, you can use the following string, where CERT.FILE is the SSL certificate file:

    $(perl -MURI::Escape -ne 'print uri_escape($_);' CERT.FILE)

Example: cert=-----BEGIN%20CERTIFICATE-----%0AMIIEEzCCAvugAwIBAgIJALF%2FjFpw6p1bMA0GCSqGSIb3DQEBBQUAMIGfMRYwFAYD%0AVQQDEw10ZXN0c2ltb24uY29tMRYwFAYDVQQLEw1Eb2N1bWVudGF0aW9uMQswCQYD%0AVQQGEwJVUzEoMCYGCSqGSIb3DQEJARYZbGF1cmVuY2Uuc2ltb25AY3BhbmVsLm5l%0AdDEUMBIGA1UEChMLY1BhbmVsIEluYy4xDjAMBgNVBAgTBVRleGFzMRAwDgYDVQQH%0AEwdIb3VzdG9uMB4XDTEzMDUxNzE2MTMwN1oXDTE0MDUxNzE2MTMwN1owgZ8xFjAU%0ABgNVBAMTDXRlc3RzaW1vbi5jb20xFjAUBgNVBAsTDURvY3VtZW50YXRpb24xCzAJ%0ABgNVBAYTAlVTMSgwJgYJKoZIhvcNAQkBFhlsYXVyZW5jZS5zaW1vbkBjcGFuZWwu%0AbmV0MRQwEgYDVQQKEwtjUGFuZWwgSW5jLjEOMAwGA1UECBMFVGV4YXMxEDAOBgNV%0ABAcTB0hvdXN0b24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDRO0AP%0AN5XtjDqkEyJ6ctfYqUtt9yUXyRuCETFjW6opNLSmZSHeF6L2aZka646lhj02CFyl%0AkzsNSxysN66tY%2BWZcTmvgPisJdQFpFvjroJZgDjYRV0QqokKdRy%2F5BU0%2BtHXoYpj%0A9JOQlbvEWxiGR3R80sL1ma4AfSE6Gv8M%2FPULTadan51eHaikXqjOXdPJQKuWP3g9%0AFnIuf38WRYwzGrre88qsZrpsMrADX5dotHWgqAf7Tap6xfA4CUAgQo9tldariuVi%0ABz%2BsRJ%2FSjgxnhw1HYWGttBuBZFhMpdHpPnTJ7DIFMd%2FFN5gG%2Ftah30SapWpo35Ux%0A3BpJcdUjtazy82K5AgMBAAGjUDBOMB0GA1UdDgQWBBQAlv7%2FtALOYb7zAXbYG2%2B9%0AAMI3xjAfBgNVHSMEGDAWgBQAlv7%2FtALOYb7zAXbYG2%2B9AMI3xjAMBgNVHRMEBTAD%0AAQH%2FMA0GCSqGSIb3DQEBBQUAA4IBAQCxzpe71Hc7Es0dqIN7bhIFYIIgcr6wxM6a%0Aa9d%2BQG%2BQPH0x0KAqV8EgUbZysvyxEF0bPxW3ZAr1Is1wk80PMuU3bToFFVbFFIIr%0AHRNfKLGvxiMXnZA1c6L4N0lowvXHgZxTTUXtDFLXyrcwrLsvUErEV7rbizuxqfPw%0AcaRtXn4uc%2Bt6HYuW7yWesBauCWnJNiKbjN%2FF%2BuCTurN3QMAeWf3ZJtsfkAgk8dyq%0AR%2F83a3kDtSPrpt%2BjX%2BqdjKEpRtQ5Qpm6XT2gCOQPgnfiUtOCH419pp922P%2FAAGc%2B%0AZUhYoWcRWKw%2Fy6gI7Ru%2B%2B9%2B8%2BwkadL9EbKMZxhVwD5qVm4ZlWK2a%5Cr%5Cn%0A-----END%20CERTIFICATE-----
domain
required
string <domain>

The domain name.

Example: domain=example.com
key
required
string <pem-private-key>

The certificate's key.

Note:

  • You must URI-encode this value.

  • You can use a Perl command to URI-encode your SSL certificate for this parameter. For example, you can use the following string, where KEY.FILE is the SSL certificate file:

    $(perl -MURI::Escape -ne 'print uri_escape($_);' KEY.FILE)

Example: key=-----BEGIN%20RSA%20PRIVATE%20KEY-----%0AMIIEpAIBAAKCAQEA4AVM6J4Qg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k1D3RpQPNR7wVzi46KR081AU41uMpqIGVOwHtyVnW%2FZfLr%0Ac1DLIK8Cx8aHfoxffwzoMO5SEQSooeZfOLhsfDN1AoGBAKQTUEINsj%2B75psgbAr6%0AELGgItJ9yPBLVRr%2BcUzEpx9LDWVvjMihpP4NX1gq8EOPWT%2BewLHVmmsjCyV6xw8J%0AXXF8e2xif3in0m3D%2FwCzE7u2T06rKM3B017hKnrZmGoHnrqPU2osM4sOUpshWX6d%0Av1Q4EF1%2BfbK3YCW%2BVpCBsB9NAoGAQo%2BuhNLODee56iKkzpjXWCsFTq6ar3hD5F3P%0A63buKdNwhd2GlSPhXFbf%2B7M5GWW6BZk6rMvv7EOAVice2uvyFm8%2F4%2F1WbmF8R%2BT7%0ALX1rPLO5p%2Fm701QpvP11TabiwqRkqtSEQhSRF0AKTojSW%2FyyHCZFAawUhV%2FZ9EKi%0AHmKb97kCgYAyzmFc2it0HqnsOnRybop603nqMtWGTQO4cxa93HUDpYajuK2K3Dfr%0AxUj6lG3z%2FoKJGGE2JqgZ6LBAhNJtJWJu2ox3pKGE63QjLJnVwb8y1NFYpe%2FcrbLe%0APuBwIR0L7drXxfv7O5btY7h6QI2d1%2FUIAQPAWbxLoTM%2BndQ%2FuPEdfA%3D%3D%0A-----END%20RSA%20PRIVATE%20KEY-----
cabundle
string <pem-certificate>

The Certificate Authority (CA) bundle data, if the certificate requires it.

Note:

  • You must URI-encode this value.

  • You can use a Perl command to URI-encode your SSL certificate for this parameter. For example, you can use the following string, where CABUNDLE.FILE is the SSL certificate file:

    $(perl -MURI::Escape -ne 'print uri_escape($_);' CABUNDLE.FILE)

Example: cabundle=-----BEGIN%20CERTIFICATE-----%0AMIIB%2BjCCAWMCAgGjMA0GCSqGSIb3DQEBBAUAMEUxCzAJBgNVBAYTAlVTMRgwFgYD%0AVQQKEw9HVEUgQ29ycG9yYXRpb24xHDAaBgNVBAMTE0dURSBDeWJlclRydXN0IFJv%0Ab3QwHhcNOTYwMjIzMjMwMTAwWhcNMDYwMjIzMjM1OTAwWjBFMQswCQYDVQQGEwJV%0AUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMRwwGgYDVQQDExNHVEUgQ3liZXJU%0AcnVzdCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC45k%2B625h8cXyv%0ARLfTD0bZZOWTwUKOx7pJjTUteueLveUFMVnGsS8KDPufpz%2BiCWaEVh43KRuH6X4M%0AypqfpX%2F1FZSj1aJGgthoTNE3FQZor734sLPwKfWVWgkWYXcKIiXUT0Wqx73llt%2F5%0A1KiOQswkwB6RJ0q1bQaAYznEol44AwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABKz%0AdcZfHeFhVYAA1IFLezEPI2PnPfMD%2BfQ2qLvZ46WXTeorKeDWanOB5sCJo9Px4KWl%0AIjeaY8JIILTbcuPI9tl8vrGvU9oUtCG41tWW4%2F5ODFlitppK%2BULdjG%2BBqXH%2F9Apy%0AbW1EDp3zdHSo1TRJ6V6e6bR64eVaH4QwnNOfpSXY%0A-----END%20CERTIFICATE-----

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty --user=username SSL install_ssl domain='example.com' cert='-----BEGIN%20CERTIFICATE-----%0AMIIEEzCCAvugAwIBAgIJALF%2FjFpw6p1bMA0GCSqGSIb3DQEBBQUAMIGfMRYwFAYD%0AVQQDEw10ZXN0c2ltb24uY29tMRYwFAYDVQQLEw1Eb2N1bWVudGF0aW9uMQswCQYD%0AVQQGEwJVUzEoMCYGCSqGSIb3DQEJARYZbGF1cmVuY2Uuc2ltb25AY3BhbmVsLm5l%0AdDEUMBIGA1UEChMLY1BhbmVsIEluYy4xDjAMBgNVBAgTBVRleGFzMRAwDgYDVQQH%0AEwdIb3VzdG9uMB4XDTEzMDUxNzE2MTMwN1oXDTE0MDUxNzE2MTMwN1owgZ8xFjAU%0ABgNVBAMTDXRlc3RzaW1vbi5j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Mqss%2Fu11tnva5wzu1cC%0AL6H85A5%2BHMOBvP3sm6CObKcVw92h7kxynVIUJJWhjfeZMN8gBFFpKIVFAoGBAO1p%0AtXBmXLC%2FYKKvtHI3M16%2FZopvM8ZqU2HcAHaw214Refw9JJ%2Fe3%2FxTNfSerVTyCAQO%0A1AdWTzJKBN8jmSYv1Mk1D3RpQPNR7wVzi46KR081AU41uMpqIGVOwHtyVnW%2FZfLr%0Ac1DLIK8Cx8aHfoxffwzoMO5SEQSooeZfOLhsfDN1AoGBAKQTUEINsj%2B75psgbAr6%0AELGgItJ9yPBLVRr%2BcUzEpx9LDWVvjMihpP4NX1gq8EOPWT%2BewLHVmmsjCyV6xw8J%0AXXF8e2xif3in0m3D%2FwCzE7u2T06rKM3B017hKnrZmGoHnrqPU2osM4sOUpshWX6d%0Av1Q4EF1%2BfbK3YCW%2BVpCBsB9NAoGAQo%2BuhNLODee56iKkzpjXWCsFTq6ar3hD5F3P%0A63buKdNwhd2GlSPhXFbf%2B7M5GWW6BZk6rMvv7EOAVice2uvyFm8%2F4%2F1WbmF8R%2BT7%0ALX1rPLO5p%2Fm701QpvP11TabiwqRkqtSEQhSRF0AKTojSW%2FyyHCZFAawUhV%2FZ9EKi%0AHmKb97kCgYAyzmFc2it0HqnsOnRybop603nqMtWGTQO4cxa93HUDpYajuK2K3Dfr%0AxUj6lG3z%2FoKJGGE2JqgZ6LBAhNJtJWJu2ox3pKGE63QjLJnVwb8y1NFYpe%2FcrbLe%0APuBwIR0L7drXxfv7O5btY7h6QI2d1%2FUIAQPAWbxLoTM%2BndQ%2FuPEdfA%3D%3D%0A-----END%20RSA%20PRIVATE%20KEY-----'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "install_ssl",
  • "module": "SSL",
  • "result": {
    • "data": {
      • "action": "update",
      • "cert_id": "example_com_bbe7e_16e2d_1369007999_1d87a0cdb540f5aae607b10e9a1a82fb",
      • "domain": "example.com",
      • "extra_certificate_domains": [
        • "ssl.example.com"
        ],
      • "html": "The SSL certificate is now installed onto the domain \"example.com\" using the IP address \"192.168.0.1\".\nThe existing virtual host was updated with the new certificate. Apache is restarting in the background.",
      • "ip": "192.168.0.1",
      • "key_id": "bbe7e_16e2d_df7539f280eb1ecf6c1096190e41ada7",
      • "message": "The SSL certificate is now installed onto the domain \"example.com\" using the IP address \"192.168.0.1\".\nThe existing virtual host was updated with the new certificate.\nApache is restarting in the background.",
      • "statusmsg": "The SSL certificate is now installed onto the domain \"example.com\" using the IP address \"192.168.0.1\".\nThe existing virtual host was updated with the new certificate.\nApache is restarting in the background.\nThe SSL certificate is now installed onto the domain \"example.com\" using the IP address \"192.168.0.1\".\nThe existing virtual host was updated with the new certificate.\nApache is restarting in the background",
      • "user": "example",
      • "warning_domains": [
        • "warning.com"
        ],
      • "working_domains": [
        • "example.com"
        ]
      },
    • "errors": null,
    • "messages": null,
    • "metadata": {
      • "transformed": 1
      },
    • "status": 1,
    • "warnings": null
    }
}