Child pages
  • WHM API 0 Functions - modifyacct
Skip to end of metadata
Go to start of metadata

Description

This function modifies a cPanel account.

Warning:

We strongly recommend that you do not modify a single account's settings if the account has a hosting plan (package). If the hosting plan's settings change, the system will overwrite the account-specific values with the hosting plan's new settings. 


Note:

On servers that run CentOS 7, you may see a named warning about the absence of SPF resource records on DNS.

  • This warning is not relevant on CentOS 7 servers, because RFC 7208 deprecated SPF records. CentOS 7 servers use TXT records instead of SPF records.
  • Red Hat 7.1 and CentOS 7.1 both contain bind-9.9.4-23.el7, which is an updated version of BIND that complies with RFC 7208. To resolve this issue, update your operating system to a version that contains the updated version of BIND. For more information, read the Red Hat Bugzilla case about SPF record errors.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/modifyacct?user=username&quota=500
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/modifyacct?user=username&quota=500
 Command Line
whmapi0 modifyacct user=username quota=500


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi0 command:

    /usr/local/cpanel/bin/whmapi0

 Output (JSON)
{  
   "result":[  
      {  
         "warnings":[  

         ],
         "messages":[  

         ],
         "statusmsg":"Account Modified",
         "status":1,
         "newcfg":{  
            "domain":"example.com",
            "user":"username",
            "setshell":"unmodified",
            "cpuser":{  
               "MAXSUB":"unlimited",
               "MAXADDON":"unlimited",
               "HASSPF":"1",
               "DOMAINS":[  
                  "addondomain.com",
                  "seconddomain.com",
                  "seconddomain.example.com",
                  "subdomain.example.com",
               ],
               "MAX_DEFER_FAIL_PERCENTAGE":"unlimited",
               "DEMO":"0",
               "_PACKAGE_EXTENSIONS":"",
               "bogus_food":"y",
               "BACKUP":"0",
               "RS":"paper_lantern",
               "MAX_EMAIL_PER_HOUR":"unlimited",
               "USER":"username",
               "MAXMONGREL":"4",
               "LOCALE":"en",
               "HOMEDIRLINKS":[  

               ],
               "MAXLST":"unlimited",
               "MAXPARK":"unlimited",
               "bogus_appetite":"normal",
               "IP":"10.215.214.95",
               "MAXPOP":"unlimited",
               "MAXSQL":"unlimited",
               "OWNER":"root",
               "FEATURELIST":"default",
               "HASCGI":"1",
               "DEADDOMAINS":[  
                  "example.example.com",
               ],
               "MTIME":1416585658,
               "HASDKIM":"1",
               "MAXFTP":"unlimited",
               "LEGACY_BACKUP":"0",
               "CONTACTEMAIL2":"",
               "STARTDATE":"1369256589",
               "BWLIMIT":"unlimited",
               "CONTACTEMAIL":"username@example.com",
               "bogus_name":"Quarks",
               "__CACHE_DATA_VERSION":"0.4",
               "DOMAIN":"example.com",
               "PLAN":"extensions_username_username"
            }
         }
      }
   ]
}
 Output (XML)
<modifyacct>
    <result>
        <newcfg>
            <cpuser>
                <BACKUP>0</BACKUP>
                <BWLIMIT>unlimited</BWLIMIT>
                <CONTACTEMAIL>username@example.com</CONTACTEMAIL>
                <CONTACTEMAIL2/>
                <DEADDOMAINS>example.example.com</DEADDOMAINS>
                <DEADDOMAINS>subdomain.example.com.example.com</DEADDOMAINS>
                <DEMO>0</DEMO>
                <DOMAIN>example.com</DOMAIN>
                <DOMAINS>addondomain.com</DOMAINS>
                <DOMAINS>seconddomain.com</DOMAINS>
                <DOMAINS>seconddomain.example.com</DOMAINS>
                <DOMAINS>subdomain.example.com</DOMAINS>
                <FEATURELIST>default</FEATURELIST>
                <HASCGI>1</HASCGI>
                <HASDKIM>1</HASDKIM>
                <HASSPF>1</HASSPF>
                <IP>10.215.214.95</IP>
                <LEGACY_BACKUP>0</LEGACY_BACKUP>
                <LOCALE>en</LOCALE>
                <MAXADDON>unlimited</MAXADDON>
                <MAXFTP>unlimited</MAXFTP>
                <MAXLST>unlimited</MAXLST>
                <MAXMONGREL>4</MAXMONGREL>
                <MAXPARK>unlimited</MAXPARK>
                <MAXPOP>unlimited</MAXPOP>
                <MAXSQL>unlimited</MAXSQL>
                <MAXSUB>unlimited</MAXSUB>
                <MAX_DEFER_FAIL_PERCENTAGE>unlimited</MAX_DEFER_FAIL_PERCENTAGE>
                <MAX_EMAIL_PER_HOUR>unlimited</MAX_EMAIL_PER_HOUR>
                <MTIME>1416585731</MTIME>
                <OWNER>root</OWNER>
                <PLAN>extensions_username_username</PLAN>
                <RS>paper_lantern</RS>
                <STARTDATE>1369256589</STARTDATE>
                <USER>username</USER>
                <_PACKAGE_EXTENSIONS/>
                <__CACHE_DATA_VERSION>0.4</__CACHE_DATA_VERSION>
                <bogus_appetite>normal</bogus_appetite>
                <bogus_food>y</bogus_food>
                <bogus_name>Quarks</bogus_name>
            </cpuser>
            <domain>example.com</domain>
            <setshell>unmodified</setshell>
            <user>username</user>
        </newcfg>
        <status>1</status>
        <statusmsg>Account Modified</statusmsg>
    </result>
</modifyacct>

   

Parameters

Notes:

  • The user parameter is required
  • All other input parameters are optional, and indicate the new values to assign to the account. If you do not specify a value or specify the current value for one of these parameters, no change will occur. 


ParameterTypeDescriptionPossible valuesExample
userstring

Required

The account's current username.

An existing cPanel account's username.

username
DNSstring

The account's main domain.

If you do not specify a value, the function uses the parameter's current value.

A valid domain name.example.com
contactemailstring

The account's contact email address.

If you do not specify a value, the function uses the parameter's current value.

A valid email address.user%40example.com
newuserstring

The account's new username.

If you do not specify a value, the function uses the parameter's current value.

Note:

If you rename the account, and database prefixing is enabled, you may also use the rename_database_objects parameter. 

A valid cPanel username.


Notes:

  • Usernames cannot begin with a number, or the string test.
  • In cPanel & WHM version 11.38 and older, usernames must contain eight characters or fewer.
  • In cPanel & WHM version 11.40 and later, usernames may contain 16 characters or fewer if database prefixes are disabled.
  • In cPanel & WHM version 11.44 and later, the first eight characters of usernames must be unique. MySQL requires this due to potential conflicts with account transfers.
  • In cPanel & WHM version 11.56 and later, MySQL's unique character limit requirement does not exist on servers that use MariaDB.

newusername
ownerstring

The account's new owner, to change the ownership for the account.

If you do not specify a value, the account's ownership does not change.

  • A valid reseller username.
  • root
reseller
bwlimitstring

The account's maximum bandwidth use.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999 that represents the maximum bandwidth use, in Megabytes (MB).
  • 0, unlimited, or null — The account possesses unlimited bandwidth.
unlimited
hascgiBoolean

Whether CGI access is enabled for the account.

If you do not specify a value, the function uses the parameter's current value.

  • 1 — Enabled.
  • 0 — Disabled.
1
hasdkimBoolean

Whether DKIM is enabled for the account.

If you do not specify a value, the function uses the parameter's current value.

  • 1 — Enabled.
  • 0 — Disabled.
1
hasshellBoolean

Whether shell (SSH) access is enabled for the account.

If you do not specify a value, the function uses the parameter's current value.

  • 1 — Enabled.
  • 0 — Disabled.
1
hasspfBoolean

Whether SPF is enabled for the account.

If you do not specify a value, the function uses the parameter's current value.

  • 1 — Enabled.
  • 0 — Disabled.
1
localestring

The account's default locale.

If you do not specify a value, the function uses the parameter's current value.

A two-letter ISO-3166 code. en
maxftpstring

The account's maximum number of FTP accounts.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999.
  • 0, unlimited, or null — The account possesses unlimited FTP accounts.
unlimited
maxsqlstring

The account's maximum number of each available type of SQL database.

For example, if you set this value to 5 and the system administrator allows MySQL® and PostgreSQL® databases , users can create up to five MySQL databases and up to five PostgreSQL databases.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999.
  • 0, unlimited, or null — The account possesses unlimited databases.
unlimited
maxpopstring

The account's maximum number of email accounts.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999.
  • 0, unlimited, or null — The account possesses unlimited email accounts.
unlimited
maxlststring

The account's maximum number of mailing lists.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999.
  • 0, unlimited, or null — The account possesses unlimited mailing lists.
unlimited
MAXMONGRELstring

The maximum number of Mongrel instances that the user can run concurrently.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999.
  • 0, unlimited, or null — The account possesses unlimited Mongrel instances.
unlimited
maxsubstring

The account's maximum number of subdomains.

If you do not specify a value, the function uses the parameter's current value.

  • An integer between zero and 999,999.
  • unlimited or null — The account possesses unlimited subdomains.
unlimited
maxparkstring

The account's maximum number of parked domains (aliases).

If you do not specify a value, the function uses the parameter's current value.

  • An integer between zero and 999,999.
  • unlimited or null — The account possesses unlimited parked domains.
unlimited
maxaddonstring

The account's maximum number of addon domains.

If you do not specify a value, the function uses the parameter's current value.

  • An integer between zero and 999,999.
  • unlimited or null — The account possesses unlimited addon domains.
unlimited
MAX_EMAIL_PER_HOURinteger

The maximum number of emails that the account can send in one hour.

If you do not specify a value, the function uses the parameter's current value.

Note:

This parameter is only available in cPanel & WHM version 11.32+. 

  • A positive integer.
  • 0 or unlimited — The account can send an unlimited number of emails.
unlimited
MAX_DEFER_FAIL_PERCENTAGEinteger

The percentage of failed or deferred email messages that the account can send per hour before outgoing mail is rate-limited.

If you do not specify a value, the function uses the parameter's current value.

Note:

This parameter is only available in cPanel & WHM version 11.32+. 

  • A positive integer.
  • 0 or unlimited — The account can send an unlimited number of failed or deferred messages.
unlimited
rsstring

The account's cPanel theme.

If you do not specify a value, the function uses the parameter's current value.

  • paper_lantern
  • A valid theme on the server.
paper_lantern
rename_database_objectsBoolean

Whether to rename the account's database objects to use a new username's database prefix.

This parameter defaults to 0.

Warning:

  • The account owner must update any applications to use the new database object names.
  • Use this parameter carefully, as it may cause confusion for system administrators. 
  • For a full description of how cPanel & WHM renames databases, read the rename_database_objects parameter section below.

Notes:

  • This parameter only applies to servers that use database prefixing.
  • This parameter is only available in cPanel & WHM version 11.44+. 
  • 1 — Rename the account's database objects.
  • 0 — Do not rename the account's database objects.
0
quotainteger

The account's disk space quota.

If you do not specify a value, the function uses the parameter's current value.

  • A positive integer between one and 999,999 that represents the maximum disk space that the account may use, in Megabytes (MB).
  • 0 — The account's disk space is unlimited.
500
spamassassinBoolean

Whether Apache SpamAssassin™ is enabled for the account.

This parameter defaults to 1.

Note:

We added this parameter in cPanel & WHM version 70. 

  • 1 — Enabled.
  • 0 — Disabled.
0

The rename_database_objects parameter

MySQL does not allow you to rename a database. When cPanel & WHM "renames" a database, the system performs the following steps:
  1. The system creates a new database.
  2. The system moves data from the old database to the new database.
  3. The system recreates grants and stored code in the new database.
  4. The system deletes the old database and its grants.

Warning:

  • If any of the first three steps fail, the system returns an error and attempts to restore the database's original state. If the restoration process fails, the API function's error response describes these additional failures.
  • In rare cases, the system creates the second database successfully, but fails to delete the old database or grants. The system treats the rename action as a success; however, the API function returns warnings that describe the failure to delete the old database or grants.

Returns

ReturnTypeDescriptionPossible valuesExample
newcfghashA hash of account data.This hash includes the cpuser hash and the domain, user, and setshell returns. 

domain

string

The account's main domain.

The function returns this value in the newcfg hash.

A valid domain name on the account.example.com

user

string

The account username.

The function returns this value in the newcfg hash.

The cPanel account's username.

Note:

If you changed the account's username, the function returns the new value. 

username

setshell

string

The account's shell.

The function returns this value in the newcfg hash.

The absolute path to a shell location on the server./bin/bash

cpuser

hash

A hash of account information.

The function returns this hash in the newcfg hash.

This hash includes the MAXSUB, MAXADDON, HASSPF, DOMAINS, MAX_DEFER_FAIL_PERCENTAGE, DEMO, PACKAGEEXTENSIONS, BACKUP, RS, MAX_EMAIL_PER_HOUR, USER, MAXMONGREL, LOCALE, HOMEDIRLINKS, MAXLST, MAXPARK, MAXSQL, OWNER, FEATURELIST, HASCGI, DEADDOMAINS, MTIME, HASDKIM, MAXFTP, LEGACY_BACKUP, CONTACTEMAIL2, STARTDATE, BWLIMIT, CONTACTEMAIL, CACHEDATA_VERSION, DOMAIN, and PLAN returns.

Note:

If the account or its hosting plan use package extensions, the cpuser hash will also include the extension's variables. 

 

MAXSUB

string

The account's maximum number of subdomains.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of subdomains.
unlimited  

MAXADDON

string

The account's maximum number of addon domains.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of addon domains.
unlimited

 HASSPF

Boolean

Whether SPF is enabled for the account.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

DOMAINS

array

A list of the account's domains and subdomains.

The function returns this array in the cpuser hash.

An array of one or more valid domains or subdomains.example.com

MAX_DEFER_FAIL_PERCENTAGE

string

The percentage of failed or deferred email messages that the account can send per hour before the system rate-limits outgoing mail.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a percentage of messages.
unlimited

 DEMO

Boolean

Whether demo mode is enabled for the account.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
0

_PACKAGE_EXTENSIONS

string

The account's package extensions.

The function returns this value in the cpuser hash.

A space-separated list of one or more package extension names.ext1 ext2 ext3

BACKUP

Boolean

Whether backups are enabled.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
0

RS

string

The account's cPanel interface theme.

The function returns this value in the cpuser hash.

  • paper_lantern
  • A valid theme on the server.
paper_lantern

MAX_EMAIL_PER_HOUR

string

The maximum number of emails that the account can send in one hour.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of sent emails.
unlimited

USER

string

The account username.

The function returns this value in the cpuser hash.

The cPanel account's username.

Note:

If you changed the account's username, the function returns the new value. 

username

 MAXMONGREL

integer

The maximum number of Mongrel instances.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of Mongrel instances.
4

LOCALE

string

The account's locale.

The function returns this value in the cpuser hash.

The ISO code for any locale on the server.en

HOMEDIRLINKS

array

Any symlinks to the account's home directory.

The function returns this value in the cpuser hash.

An array of one or more home directory symlinks.symlink

MAXLST

string

The account's maximum number of mailing lists.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of mailing lists.
unlimited

MAXPARK

string

The account's maximum number of parked domains.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of parked domains.
unlimited  

MAXSQL

string

The account's maximum number of SQL databases.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of SQL databases.
unlimited  

OWNER

string

The account's owner.

The function returns this value in the cpuser hash.

  • root
  • A reseller account's username.
  • The cPanel account username.
root

 FEATURELIST

string

The account's featurelist.

The function returns this value in the cpuser hash.

A valid feature list name.default

HASCGI

Boolean

Whether CGI is enabled for the account.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

DEADDOMAINS

array

The account's inactive domains.

The function returns this array in the cpuser hash.

An array of one or more domains or subdomains.example.example.com

MTIME

integer

The time of the function call.

The function returns this value in the cpuser hash.

A time, in Unix time format.1416586493

HASDKIM

Boolean

Whether DKIM is enabled for the account.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

MAXFTP

string

The account's maximum number of FTP accounts.

The function returns this value in the cpuser hash.

  • unlimited
  • An integer that represents a number of FTP accounts.
unlimited

LEGACY_BACKUP

Boolean

Whether legacy backups are enabled.

The function returns this value in the cpuser hash.

  • 1 — Enabled.
  • 0 — Disabled.
0

 CONTACTEMAIL2

string

The account's secondary contact email address, if one exists.

The function returns this value in the cpuser hash.

A valid email address.email2@example.com

STARTDATE

string

The account creation date.

The function returns this value in the cpuser hash.

The date in DD MM YY HH-mm human-readable format, where:

  • YY represents the year.
  • MM represents the month.
  • DD represents the date.
  • HH represents the hour.
  • mm represents the minute.
13 May 22 16:03

 BWLIMIT

string

The account's bandwidth limit.

The function returns this value in the cpuser hash.

  • unlimited
  • A maximum amount of bandwidth, in Megabytes (MB).
unlimited

CONTACTEMAIL

string

The account's contact email address.

The function returns this value in the cpuser hash.

A valid email address.username@example.com

__CACHE_DATA_VERSION

string

The account's cache data's version.

The function returns this value in the cpuser hash.

A numeric value that indicates a version of the cache data.0.4

DOMAIN

string

The account's main domain.

The function returns this value in the cpuser hash.

A valid domain on the cPanel account.example.com

PLAN

string

The account's hosting package.

The function returns this value in the cpuser hash.

The name of a package on the server.packagename
warningsarrayThe function's warnings, if any exist.An array of one or more warning messages.This is a warning.
messagesarrayThe function's messages, if any exist.An array of one or more messages.This is a message.

status

BooleanWhether the system successfully called the function.
  • 1 — Success.
  • 0 — Failure.

 

1
statusmsgstringA message of success or a reason for failure.
  • Account Modified
  • An error message.
Account Modified