Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function lists the server's domains with installed SSL certificates.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/listcrts?api.version=1&registered=1&user=username
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/listcrts?api.version=1&registered=1&user=username
 Command Line
whmapi1 listcrts registered=1 user=username

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
  "data": {
    "crt": [
      {
        "is_self_signed": 1,
        "validation_type":"dv",
        "signature_algorithm":"sha256WithRSAEncryption",
        "registered": 1,
        "issuer.organizationName": "Acme, Inc.",
        "modulus_length": "2048",
        "not_after": "1400343187",
        "domain": "example.com",
        "domains": [
          "example.com"
        ],
        "domain_owners": [
          "example"
        ],
        "id": "example._com_d13b4_362b9_1400343187_b05e5c3e443dda9a8869c4cf7457829e",
        "friendly_name": "TestCertificate"
      }
    ]
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": 1,
    "command": "listcrts"
  }
}
 Output (XML)
<result>
    <data>
        <crt>
            <is_self_signed>1</is_self_signed>
            <validation_type>dv</validation_type>
            <signature_algorithm>sha256WithRSAEncryption</signature_algorithm>
            <registered>1</registered>
            <issuer.organizationName>Acme, Inc.</issuer.organizationName>
            <modulus_length>2048</modulus_length>
            <not_after>1400343187</not_after>
            <domain>example.com</domain>
            <domains>example.com</domains>
            <domain_owners>example</domain_owners>
            <id>
                example._com_d13b4_362b9_1400343187_b05e5c3e443dda9a8869c4cf7457829e
            </id>
            <friendly_name>TestCertificate</friendly_name>
        </crt>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>listcrts</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
registeredBoolean

Whether to limit the results to certificates registered with a certificate authority (CA).

This parameter defaults to 0.

  • 1 — Registered certificates only.
  • 0 — All certificates.
1
userstring

The user's username.

If you do not use this parameter, the function returns certificates for all accounts on the server.

A valid username.username

Returns

ReturnTypeDescriptionPossible valuesExample
crthash

A hash of each certificate's information.

The hash includes the domain, is_self_signed, registered, issuer.organizationName, modulus_lengthnot_after, idsignature_algorithm, validation_type, and friendly_name returns, and the domains and domain_owners arrays.
 

is_self_signed

Boolean

Whether the certificate is self-signed.

The function returns this value in the crt hash.

  • 1 — Self-signed.
  • 0Not self-signed.
 1

validation_type

string

The certificate's validation type.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the crt hash.

  • ev — Extended Validation.
  • ov — Organization Validation.
  • dv — Domain Validation.
  • undef — The system could not parse and determine the certificate's validation type.
dv

signature_algorithm

 
string

The signature algorithm of the certificate.

Note:

We introduced this return in cPanel & WHM version 56.

The function returns this value in the crt hash.

A valid OID hash algorithm name.
sha256WithRSAEncryption

registered

BooleanWhether the certificate is registered with a CA.

The function returns this value in the crt hash.

  • 1 — Registered.
  • 0Not registered
 1

issuer.organizationName

stringThe organization name of the certificate's issuer.

The function returns this value in the crt hash.

A valid string.Acme, Inc.

modulus_length

integerThe certificate's modulus length in bits.

The function returns this value in the crt hash.

A positive integer that measures the length in bits.2048

not_after

integerWhen the certificate expires.

The function returns this value in the crt hash.

A date in Unix time format.

1400343187

domain

string

The certificate's primary domain.

The function returns this value in the crt hash.

A valid domain name.
example.com

domains

arrayThe domain or domains that the certificate covers.

The function returns this array in the crt hash.

An array of valid domains.example.com

domain_owners

arrayThe owners of the domain or domains that the certificate covers.

The function returns this array in the crt hash.

An array of valid usernames.
example

id

stringThe certificate's ID.

The function returns this value in the crt hash.

A valid string.
 Click to view...
 example._com_d13b4_362b9_1400343187_b05e5c3e443dda9a8869c4cf7457829e

friendly_name

stringThe certificate's friendly name.

The function returns this value in the crt hash.

A valid string.
TestCertificate