Get Virtualizor

LetsEncrypt Renew CRT

You can manually renew already issued certificate for your domain by using the LetsEncrypt Renew CRT API. If the certificate renew day has not arrived, the renew request will be skipped if you have not set "force" option in configuration during installation of the certificate. The API response will contain "done" as the "actid" on successful start of the renewal process. This "actid" can used to monitor the process using the Show Tasks API, or you can check the progress the at Task module in the admin panel.

For more information, you can refer this Let's Encrypt Renewal Guide.

HTTP Request

https://hostname:4085/index.php?act=letsencrypt

Parameters

NameMethodValueDescriptionRequired
actGETletsencryptThe action will renew the existing certificateYes
optPOSTrenew_crtThis will renew the certificateYes

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['opt'] = 'renew_crt';

    $output = $admin->letsencrypt($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "LetsEncrypt",
    "done": "3414",
    "crt_config_options": {
        "crt_save_cfg_frm": {
            "inputs": {
                "primary_domain": {
                    "type": "text",
                    "value": "hostname"
                },
                "contact_email": {
                    "type": "text",
                    "value": "test@test.com"
                },
                "key_size": {
                    "type": "select",
                    "value": "2048"
                },
                "renew_days": {
                    "type": "text",
                    "value": "80"
                },
                "staging": {
                    "type": "checkbox",
                    "value": "0"
                },
                "enable_force": {
                    "type": "checkbox",
                    "value": "1"
                }
            }
        }
    },
    "crt_details": {
        "crt_domain": "hostname",
        "crt_san": "DNS:hostname",
        "crt_issuer": "Let's Encrypt Authority X3",
        "crt_serialno": "326128822251502160074971581300458219650517",
        "crt_valid_from_time": "Fri, 11 Nov 2016 06:39:00 GMT",
        "crt_valid_to_time": "Thu, 09 Feb 2017 06:39:00 GMT",
        "next_renew": "Sun, 29 Jan 2017 01:59:25 GMT",
        "crt_installed": "Yes"
    },
    "actid": "3414",
    "logs": "null",
    "timenow": "1478743574",
    "time_taken": "1.634"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list