You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - listcrts
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:

  • Unless otherwise noted, 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.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "crt": [
      {
        "is_self_signed": 1,
        "validation_type": "dv",
        "signature_algorithm": "sha256WithRSAEncryption",
        "registered": 1,
        "issuer.organizationName": "Acme, Inc.",
        "modulus_length": "2048",
		"key_algorithm": "rsaEncryption",
		"ecdsa_curve_name": null,
        "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>
			<key_algorithm>rsaEncryption</key_algorithm>
			<ecdsa_curve_name>ecdsa-prime256v1</ecdsa_curve_name>
            <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, idfriendly_name , key_algorithm, and ecdsa_curve_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

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.

The function returns this value in the crt hash.

  • An integer value.
  • null — The certificate's key is not an RSA key.

Note:

We added the null value in cPanel & WHM version 92.

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

key_algorithm

string

The certificate's key's algorithm.

Note:

We added this return in cPanel & WHM version 92.

The function returns this value in the crt hash.

  • rsaEncryption — RSA.
  • id-ecPublicKey — ECDSA.
rsaEncryption

ecdsa_curve_name

string

The ECDSA curve that the certificate's key uses.

Note:

We added this return in cPanel & WHM version 92.

The function returns this value in the crt hash.

  • A valid string.
  • null — The certificate's key is not an ECDSA key.
prime256v1