Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
UAPI Functions - EmailAuth::ensure_dkim_keys_exist - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - EmailAuth::ensure_dkim_keys_exist
Skip to end of metadata
Go to start of metadata

Description

This function confirms the validity of a Domain Keys Identified Mail (DKIM) key for one or more domains.

Notes:

  • If an existing DKIM key does not meet the server's security requirements, the system replaces the existing DKIM key.
  • If no DKIM key exists, the system creates a new key for the domain.

Important:

When you disable the MailSend role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/EmailAuth/ensure_dkim_keys_exist?domain=example.com&domain=anotherexample.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Check the validity of a DKIM record for a domain.
$poll = $cpanel->uapi(
    'EmailAuth', 'ensure_dkim_keys_exist',
    array(
        'domain' => 'example.com',
		'domain' => 'anotherexample.com'
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Check the validity of a DKIM record for a domain.
my $poll = $cpliveapi->uapi(
    'EmailAuth', 'ensure_dkim_keys_exist',
    {
        'domain' => 'example.com'
		'domain' => 'anotherexample.com'
  }
);


Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
uapi --user=username EmailAuth ensure_dkim_keys_exist domain=example.com domain=anotherexample.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
   "apiversion": 3,
   "module": "EmailAuth",
   "func": "ensure_dkim_keys_exist",
   "result": {
      "data": [
        {
            "domain": "example.com",
            "msg": "created new key",
            "status": 1
        },
		{
			"domain": "anotherexample.com",
			"msg": "key is acceptable",
			"status": 1
		}
    ],
  "errors": null,
  "messages": null,
  "metadata": {
      "transformed": 1
          },
  "status": 1,
  "warnings": null
  }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to confirm a valid DKIM key exists.

Note:

To check the DKIM key validity for multiple domains, duplicate the parameter name. For example, use the domain=example.com, domain=example2.com, and domain=example3.com parameters.

A valid domain.example.com

Returns

ReturnTypeDescriptionPossible valuesExample
dataarray of hashes

An array that contains information about the domain's DKIM key validity.

Each hash contains the domain, msg, and status values.

                

domain

string

The domain for which the system confirmed that a valid DKIM key exists.

This function returns this value in the data array.

A valid domain.

example.com

msg

string

The domain's DKIM key status message.

This function returns this value in the data array.

A valid string.created new key

status

Boolean

Whether the system verified that the domain's DKIM key exists.

This function returns this value in the data array.

  • 0 — The system did not verify the existence of the domain's DKIM key.
  • 1 — The system verified the existence of the domain's DKIM key.
1