cPanel API 2 Functions - CustInfo::savecontactinfo

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_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

 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',
          second_email => 'ernie@example.com',
          notify_contact_address_change => '1',
          notify_contact_address_change_notification_disabled => '1',
          notify_disk_limit => '1',
          notify_bandwidth_limit => '1',
          notify_email_quota_limit => '1',
          notify_password_change => '1',
          notify_password_change_notification_disabled => '1',
          pushbullet_access_token => 'a1b2c3d4e5f6g7h8i9j10',
  
);

 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',
          second_email => 'ernie@example.com',
          notify_contact_address_change => '1',
          notify_contact_address_change_notification_disabled => '1',
          notify_disk_limit => '1',
          notify_bandwidth_limit => '1',
          notify_email_quota_limit => '1',
          notify_password_change => '1',
          notify_password_change_notification_disabled => '1',
          pushbullet_access_token => 'a1b2c3d4e5f6g7h8i9j10',
     }
);

 cPanel Tag System (deprecated)

Warning:

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.

cPanel API 2 calls that use cPanel tags vary widely in code syntax and in their output. For more information, read our Deprecated cPanel Tag Usage documentation. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI.

 

 Command Line

cpapi2 --user=username CustInfo savecontactinfo

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 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"
        }]
    }
}

Note:

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

 

Parameters

Parameter

Type

Description

Possible values

Example

 email

 string

 The primary contact email address.

 A valid email address.

 bert@example.com

 second_email

 string

 A secondary contact email address.

 A valid email address.

 ernie@example.com

 notify_account_authn_link

 Boolean

 Whether to send a notification when the user enablesExternal Authentication.

 This parameter defaults to 0.

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

 1

 notify_account_authn_link_notification_disabled

 Boolean

 Whether to send a notification when thenotify_account_authn_link parameter is 0.

 This parameter defaults to 0.

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

 1

 notify_account_login

 Boolean

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

 This parameter defaults to 0.

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

 1

 notify_account_login_for_known_netblock

 Boolean

 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 0.

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

 1

 notify_account_login_notification_disabled

 Boolean

 Whether to send a notification when thenotify_account_login parameter is 0.

 This parameter defaults to 0.

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

 1

 notify_bandwidth_limit

 Boolean

 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  0 .

  • 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  0 .

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

 1

 notify_contact_address_change_notification_disabled

 Boolean 

 Whether to send a notification when thenotify_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  0 .

 

 

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

 1

 notify_disk_limit

 Boolean

 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 theusername parameter with a Subaccount.

 This parameter defaults to  0 .

 

 

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

 1

 notify_email_quota_limit

 Boolean

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

 Note:

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

 This parameter defaults to  0 .

 

 

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

 1

 notify_password_change

 Boolean

 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 theusername parameter with a Subaccount.

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

 1

 notify_password_change_notification_disabled

 Boolean

 Whether to send a notification when thenotify_password_change_notification_disabledparameter 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.
  • 1 — Send notification.
  • 0 — Do not send notification.
 

 1

 notify_twofactorauth_change

 Boolean

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

 This parameter defaults to  0 .

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

 1

 notify_twofactorauth_change_notification_disabled

 Boolean

 Whether to send a notification when thenotify_twofactorauth_change parameter is 0.

 This parameter defaults to  0 .

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

 1

 pushbullet_access_token

 string

 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.

 A valid string.

 a1b2c3d4e5f6g7h8i9j0

 username

 string

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

 Note:

 We introduced this parameter in cPanel & WHM version 11.56.

  • A valid Subaccount username.
  • A valid cPanel account username.

 example1@example.com 

 

Returns

Return

Type

Description

Possible values

Example

 display_value 

 string

 The notification setting's display value.

 A valid string.

 user@example.com

 desc

 string

 A notification setting's description.

 A valid string.

 Click to view...

 name

 string

 The 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_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_twofactorauth_change
  • notify_twofactorauth_change_notification_disabled
  • pushbullet_access_token

 email

 value

 string

 The notification setting's value.

 A valid string or boolean value.

 user@example.com

 reason

 string

 A reason for failure.

 Note:

 This function only returns areasonvalue if it failed. 

 A string that describes the error.

 This is an error message. 

 result

 Boolean 

 Whether the function succeeded.

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

 1

 

  • 7 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....