Child pages
  • cPanel API 2 Functions - CustInfo::savecontactinfo
Skip to end of metadata
Go to start of metadata

Description

This function modifies an account's contact and notification settings.


Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

Note:

If you do not include a parameter, this function performs the following actions:

  • cPanel & WHM version 11.52 and later preserves the current setting.
  • cPanel & WHM version 11.50 and earlier applies the default value, which is blank for strings and false for Booleans.

Examples


 WHM API (JSON)
https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=CustInfo&cpanel_jsonapi_func=savecontactinfo&email=bert%40example.com&second_email=ernie%40example.com&notify_account_authn_link=1&notify_account_authn_link_notification_disabled=1&notify_account_login=1&notify_account_login_for_known_netblock=1&notify_account_login_notification_disabled=1&notify_autossl_renewal_coverage_reduced=1&notify_bandwidth_limit=1&notify_contact_address_change=1&notify_contact_address_change_notification_disabled=1&notify_disk_limit=1&notify_email_quota_limit=1&notify_password_change=1&notify_password_change_notification_disabled=1&notify_twofactorauth_change=1&notify_twofactorauth_change_notification_disabled=1&pushbullet_access_token=a1b2c3d4e5f6g7h8i9j0&username=example1@example.com&notify_autossl_expiry=1&notify_autossl_expiry_coverage=1&notify_autossl_renewal=1&notify_autossl_renewal_coverage=1&notify_ssl_expiry=1


Note:

 For more information, read our Calls from the WHM API documentation.

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Modify contact information.
$save_contact = $cpanel->api2(
    'CustInfo', 'savecontactinfo', 
    array(
          email => 'bert@example.com',
		  notify_account_authn_link => '0'
		  notify_account_authn_link_notification_disabled => '0',
		  notify_account_login => '0',
		  notify_account_login_for_known_netblock => '0',
		  notify_autossl_expiry => 1,
		  notify_autossl_expiry_coverage => 1,
		  notify_autossl_renewal_coverage_reduced => 1,
		  notify_autossl_renewal => 1,
		  notify_autossl_renewal_coverage => 1,
		  notify_account_login_notification_disabled => '0',
          notify_bandwidth_limit => '0',
		  notify_contact_address_change => '0',
          notify_contact_address_change_notification_disabled => '0',
		  notify_disk_limit => '0',
          notify_email_quota_limit => '0',
          notify_password_change => '0',
          notify_password_change_notification_disabled => '0',
		  notify_ssl_expiry => '1',
		  notify_twofactorauth_change => '0',
		  notify_twofactorauth_change_notification_disabled => '0',
          pushbullet_access_token => 'a1b2c3d4e5f6g7h8i9j10',
          second_email => 'ernie@example.com',
		  username => 'example1@example.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.
 
#  Modify contact information.
my $save_contact = $cpliveapi->api2(
    'CustInfo', 'savecontactinfo',
    { 
          email => 'bert@example.com',
		  notify_account_authn_link => '0'
		  notify_account_authn_link_notification_disabled => '0',
		  notify_account_login => '0',
		  notify_account_login_for_known_netblock => '0',
		  notify_account_login_notification_disabled => '0',
		  notify_autossl_expiry => 1,
		  notify_autossl_expiry_coverage => 1,
		  notify_autossl_renewal_coverage_reduced => 1,
		  notify_autossl_renewal => 1,
		  notify_autossl_renewal_coverage => 1,
          notify_bandwidth_limit => '0',
		  notify_contact_address_change => '0',
          notify_contact_address_change_notification_disabled => '0',
		  notify_disk_limit => '0',
          notify_email_quota_limit => '0',
          notify_password_change => '0',
          notify_password_change_notification_disabled => '0',
		  notify_ssl_expiry => '1',
		  notify_twofactorauth_change => '0',
		  notify_twofactorauth_change_notification_disabled => '0',
          pushbullet_access_token => 'a1b2c3d4e5f6g7h8i9j10',
          second_email => 'ernie@example.com',
		  username => 'example1@example.com'
     }
);


Note:

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

 

 cPanel Tag System (deprecated)


Warnings:

  • In cPanel & WHM version 11.30 and later, cPanel tags are deprecated. We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.
  • cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.
  • For more information, read our Deprecated cPanel Tag Usage documentation.

 Command Line
cpapi2 --user=username CustInfo savecontactinfo email=bert@example.com second_email=ernie@example.com notify_account_authn_link=1 notify_account_authn_link_notification_disabled=1 notify_account_login=1 notify_account_login_for_known_netblock=1 notify_account_login_notification_disabled=1 notify_autossl_renewal_coverage_reduced=1 notify_bandwidth_limit=1 notify_contact_address_change=1 notify_contact_address_change_notification_disabled=1 notify_disk_limit=1 notify_email_quota_limit=1 notify_password_change=1 notify_password_change_notification_disabled=1 notify_twofactorauth_change=1 notify_twofactorauth_change_notification_disabled=1 pushbullet_access_token=a1b2c3d4e5f6g7h8i9j0 username=example1@example.com notify_autossl_expiry=1 notify_autossl_expiry_coverage=1 notify_autossl_renewal=1 notify_autossl_renewal_coverage=1 notify_ssl_expiry=1


Notes:

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

    /usr/local/cpanel/bin/cpapi2

 Output (JSON)
{
	"cpanelresult": {
		"apiversion": 2,
		"func": "savecontactinfo",
		"event": {
			"result": 1
		},
		"module": "CustInfo",
		"data": [{
			"display_value": "bert@example.com",
			"value": "bert@example.com",
			"name": "email",
			"descp": "Enter an email address to receive account notifications and password reset confirmations. Do not use an email address that your cPanel account owns."
		}, {
			"descp": "Enter a second email address to receive account notifications and password reset confirmations.",
			"value": "ernie@example.com",
			"name": "second_email",
			"display_value": "ernie@example.com"
		}, {
			"descp": "An access token for Pushbullet.",
			"value": "a1b2c3d4e5f6g7h8i9j0",
			"name": "pushbullet_access_token",
			"display_value": "a1b2c3d4e5f6g7h8i9j0"
		}, {
			"display_value": "on",
			"name": "notify_contact_address_change",
			"value": 1,
			"descp": "My contact email address changes."
		}, {
			"name": "notify_contact_address_change_notification_disabled",
			"value": 1,
			"descp": "My preference for contact email address change notifications is disabled.",
			"display_value": "on"
		}, {
			"display_value": "on",
			"descp": "My account approaches its disk quota.",
			"value": 1,
			"name": "notify_disk_limit"
		}, {
			"display_value": "on",
			"name": "notify_bandwidth_limit",
			"value": 1,
			"descp": "My account approaches its bandwidth usage limit."
		}, {
			"display_value": "on",
			"descp": "Any of my account's email accounts approaches or is over quota.",
			"value": 1,
			"name": "notify_email_quota_limit"
		}, {
			"value": 1,
			"name": "notify_password_change",
			"descp": "My account's password changes.",
			"display_value": "on"
		}, {
			"display_value": "on",
			"descp": "My preference for account password change notifications is disabled.",
			"value": 1,
			"name": "notify_password_change_notification_disabled"
		}, {
			"display_value": "on",
			"value": 1,
			"descp": "Someone logs in to my account.",
			"name": "notify_account_login"
		}, {
			"descp": "Send login notifications, even when the user logs in from an IP address range or netblock that contains an IP address from which a user successfully logged in previously.",
			"value": 1,
			"name": "notify_account_login_for_known_netblock",
			"display_value": "on"
		}, {
			"value": 1,
			"descp": "My preference for successful login notifications is disabled.",
			"name": "notify_account_login_notification_disabled",
			"display_value": "on"
		}, {
			"name": "notify_account_authn_link",
			"value": 1,
			"descp": "An external account links to my account for authentication.",
			"display_value": "on"
		}, {
			"value": 1,
			"descp": "My preference for external account link notifications is disabled.",
			"name": "notify_account_authn_link_notification_disabled",
			"display_value": "on"
      	}, {
			"descp": "AutoSSL has renewed a certificate.",
			"display_value": "off",
			"name": "notify_autossl_renewal",
			"value": 1
		}, {
			"descp": "AutoSSL cannot add any additional domains because domains that fail Domain Control Validation exist on the current certificate.",
			"display_value": "off",
			"name": "notify_autossl_renewal_coverage",
			"value": 1
		}, {
			"descp": "AutoSSL cannot renew a certificate because domains that fail Domain Control Validation exist on the current certificate.",
			"display_value": "off",
			"name": "notify_autossl_expiry_coverage",
			"value": 1
		}, {
			"descp": "AutoSSL certificate expiry.",
			"display_value": "off",
			"name": "notify_autossl_expiry",
			"value": 1
		}, {
			"descp": "SSL certificate expiry.",
			"display_value": "off",
			"name": "notify_ssl_expiry",
			"value": 1
	  	},  {
			"descp": "AutoSSL has renewed a certificate, but the new certificate lacks at least one domain that the previous certificate secured.",
			"display_value": "off",
			"name": "notify_autossl_renewal_coverage_reduced",
			"value": 1
		}]
	}
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
email string

The primary contact email address.

This parameter defaults to an empty string.

A valid email address.bert@example.com
second_emailstring

A secondary contact email address.

This parameter defaults to an empty string.

A valid email address.ernie@example.com
notify_account_authn_linkBoolean

Whether to send a notification when the user enables External Authentication.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1

notify_account_authn_link_notification_disabled

Boolean

Whether to send a notification when the notify_account_authn_link parameter is 0.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_account_loginBoolean

Whether to send a notification when the user logs in to their account.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_account_login_for_known_netblockBoolean

Whether to send a notification when the user logs in to their account, regardless of the user's previously known IP address history.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_account_login_notification_disabledBoolean

Whether to send a notification when the notify_account_login parameter is 0.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_autossl_expiry
Boolean

Whether to send a notification upon AutoSSL certificate expiry.

Note:

We added this parameter in cPanel & WHM version 68.

This parameter defaults to  1 .

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_autossl_expiry_coverage
Boolean

Whether to send a notification when AutoSSL cannot renew a certificate because domains that fail Domain Control Validation (DCV) exist on the current certificate.

Note:

We added this parameter in cPanel & WHM version 68.

This parameter defaults to  1 .

  • 1 — Send notification
  • 0 — Do not send notification.
1
notify_autossl_renewal_coverage_reducedBoolean

Whether to send a notification when AutoSSL renews a certificate, but the new certificate lacks at least one domain that the previous certificate secured.

This parameter defaults to  1 .

  • 1 — Send notification
  • 0 — Do not send notification.
1
notify_autossl_renewal
Boolean

Whether to send a notification when AutoSSL renews a certificate.

Note:

We added this parameter in cPanel & WHM version 68.

This parameter defaults to  1 .

  • 1 — Send notification.
  • 0 — Do not send notification
1
notify_autossl_renewal_coverage
Boolean

Whether to send a notification when AutoSSL cannot add any additional domains because domains that fail DCV exist on the current certificate.

Note:

We added this parameter in cPanel & WHM version 68.

This parameter defaults to  1 .

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_bandwidth_limitBoolean

Whether to send a notification when the user approaches their bandwidth limit.

Notes:

  • The function ignores this parameter if you have not configured the account to receive any bandwidth limit notification.
  • The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_contact_address_change Boolean

Whether to send a notification when the contact address changes.

Notes:

  • We introduced this parameter in cPanel & WHM version 11.48.
  • The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to 1.

  •  1 — Send notification.
  • 0 — Do not send notification.
1
notify_contact_address_change_notification_disabledBoolean

Whether to send a notification when the notify_contact_address_change parameter is 0.

Notes:

  • We introduced this parameter in cPanel & WHM version 11.48.
  • The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_disk_limitBoolean

Whether to send a notification when the user approaches their disk quota.

Note:

The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_email_quota_limitBoolean

Whether to send a notification when an email user approaches or exceeds their quota.

Note:

The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to 1 .

  • 1 — Send notification.
  • 0 — Do not send notification.
0
notify_password_changeBoolean

Whether to send a notification when the user changes their password.

Note:

The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.

This parameter defaults to  1 .
  • 1 — Send notification.
  • 0 — Do not send notification.
0
notify_password_change_notification_disabledBoolean

Whether to send a notification when the notify_password_change_notification_disabled parameter is 0.

Notes:

  • We introduced this parameter in cPanel & WHM version 11.48.
  • The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.
This parameter defaults to 1 .
  • 1 — Send notification.
  • 0 — Do not send notification.
0
notify_ssl_expiry
Boolean

Whether to send a notification about SSL certificate expiry.

Note:

We added this parameter in cPanel & WHM version 68.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_twofactorauth_changeBoolean

Whether to send a notification when the user's Two-Factor Authentication for WHM configuration changes.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
notify_twofactorauth_change_notification_disabledBoolean

Whether to send a notification when the notify_twofactorauth_change parameter is 0.

This parameter defaults to 1.

  • 1 — Send notification.
  • 0 — Do not send notification.
1
pushbullet_access_tokenstring

An access token for Pushbullet notifications.

Notes:

  • We introduced this parameter in cPanel & WHM version 11.52.
  • The function ignores this parameter when you authenticate as a Subaccount or use the username parameter with a Subaccount.
This parameter defaults to an empty string.
A valid string. a1b2c3d4e5f6g7h8i9j0
usernamestring

The cPanel account or Subaccount in which to save the contact information.

Note:

We introduced this parameter in cPanel & WHM version 11.56.

This parameter defaults to any empty string.
  • A valid Subaccount username.
  • A valid cPanel account username.
example1@example.com

Returns

ReturnTypeDescriptionPossible valuesExample
display_value string The notification setting's display value.A valid string.
user@example.com
descstringA notification setting's description.A valid string.
 Click to view...
This is an email address at which the system can contact you. This should be an email address that is not on your account.
namestringThe notification setting's name.
  • email
  • second_email
  • notify_account_authn_link
  • notify_account_authn_link_notification_disabled
  • notify_account_login
  • notify_account_login_for_known_netblock
  • notify_account_login_notification_disabled
  • notify_autossl_expiry
  • notify_autossl_expiry_coverage
  • notify_autossl_renewal_coverage_reduced
  • notify_autossl_renewal
  • notify_autossl_renewal_coverage
  • notify_bandwidth_limit
  • notify_contact_address_change
  • notify_contact_address_change_notification_disabled
  • notify_disk_limit
  • notify_email_quota_limit
  • notify_password_change
  • notify_password_change_notification_disabled
  • notify_ssl_expiry
  • notify_twofactorauth_change
  • notify_twofactorauth_change_notification_disabled
  • pushbullet_access_token
email
valuestringThe notification setting's value.A valid string or Boolean value.user@example.com
reasonstring

A reason for failure.

Note:

This function only returns a reason value if it failed.

A string that describes the error.

This is an error message.
resultBoolean

Whether the function succeeded.

  • 1 — The function succeeded.
  • 0 — The function failed.
1