< All Topics

tool/installssl

Description

Installs a free Let’s encrypt or a custom SSL certificate to any domain or sub-domain in a given SPanel user account.

Parameters

FieldTypeRequiredDescription
tokenstringYesAuthorizing API token – check API Basics for more information.
accountuserstringYesThe SPanel user account that is being managed or viewed.
actionstringYesThe category and function being executed.
domainstringYesThe domain the SSL certificate will be installed to.
customstringNoDefault: false (empty). Set to true if you want to install a custom SSL certificate instead of the free Let’s encrypt SSL certificate.
crtstringNoRequired if ‘custom’ is set to true. The certificate (CRT).
keystringNoRequired if ‘custom’ is set to true. The private key of the new certificate.
castringNoRequired if ‘custom’ is set to true. The CA bundle of the new certificate.

Example

$endpointUrl = 'https://123.123.123.123/spanel/api.php';

$postData = [
  'token' => 'provided_auth_token',
  'accountuser' => 'spanelio',
  'action' => 'tool/installssl',
//'custom' => true,
//'crt' => '-----BEGIN CERTIFICATE-----
MIICwzCCAaugAwIBAgIJAKJjAgjqoc3WMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV
BAMTCXNwYW5lbC5pbzAeFw0yMjAyMjUxMjE1MTRaFw0zMjAyMjMxMjE1MTRaMBQx
EjAQBgNVBAMTCXNwYW5lbC5pbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAM/H3GiqGNUfmoWbMrmhWYytzaY0HQUGDLP+t+fPf5fyA4HXnOhMe1NKVpPq
7c3QdrJABoQfdeSZxXLjdrp00YlqOnBBAJ/BGaG0BpM9v99/7juT1Uh4qCA3DcJQ
wrX4xt5QuN0RHFIgjcsPYDdaiNVNLvKbA0AzMzawzKDrQjmBtxzhc2rnZT1fS1Gl
yIIPSzDokrhWt/FWuoAdXEkLji8UXSKeyxX7uQM3Wt4dWAQqzgqYr9AJ5mZ/rvVO
WoH45uor+n00HMCE56xCzMQkgVNB9aO2zatlH79cI++d/9WHoV0u45IppmG0k6dn
BPTGaGBfsnJ+A4a5oDt9e7hs/8kCAwEAAaMYMBYwFAYDVR0RBA0wC4IJc3BhbmVs
LmlvMA0GCSqG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BwYDVQQLEwAwBwYDVQQKEwAwBwYDVQQJEwAwBwYDVQQHEwAwBwYDVQQIEwAwBwYD
VQQREwAwBwYDVQQGEwAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCi
XfzmQg26ol7vTIkFtIhXQi3SA3YSZxD2oD9g0hn27ho2jXPqSSUpMEM/KqBnINba
ZLdhgkcoZtCvuXNXga4OnNx2eAtyeQv9JuUssiHSdpvBcALuckUuaL4NAq52q5ZP
YJj7N8zkGfzOAkLDwe2QFzU+besC7vxwHwv19yM5aspnuCIU5ZrZIBQ8db9cdh1k
fRoCcxnMRlngZjRRzZ7f5lJmDA6RD7ngw/leabOZbE4E4QG2ZmYdk2Up9jlUTa2k
SNMQXa3ckD0BhXuo4AQ9mXOLRIkFDf7d2yLbdWI3VX2DzgwUA8fVCLQsWSKVhmxS
tL0xl2yKxBk4RX7fvFr1AgMBAAGgMDAuBgkqhkiG9w0BCQ4xITAfMB0GA1UdDgQW
BBRjSvolSh7H7IF6lab4rws6IZcebDALBgkqhkiG9w0BAQsDggEBAHrJ+QuWVpnA
UimMAyNMQfPQVI5XHqB+aawlPqAmT0rZQHtnJmaBCN4/2Z4KM7w/Kbg4B82mfxdL
p9E12JzqBSkCG09Pbq8bq2H4p/lYpuXIsoT5J0mpVX1VcYRGeyP9UkNLWlGLzJ9g
44zw8mILYyBeBhxza+fLm34T9iKN6KaPlledIAROzZM0v6pAhGjTB8j2qyb0oxNj
kcnWufdwF8xErZOGYSJ45RDOyqb3LsSrnydMRBKgBrFjrAvrNnBrKnMcULgxEAj5
z19Jf2vAS0tDOZB+mfQqHt3UBtAIcDu4uq6cJjHgwBmfPorG4IsHSPhh6WM4gerK
7/4pgsg/gXM=
-----END CERTIFICATE-----
'
];

$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $endpointUrl);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_POST, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false);
$jsonOutput = curl_exec( $ch );

You can find more information about the Endpoint URL in our API Basics article.

Output

{
    "result": "success",
    "message": [
        "The certificate has been installed successfully"
    ]
}
Previous tool/listssldomains
Next tool/listcsrdomains
Table of Contents