We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - suspendacct
Skip to end of metadata
Go to start of metadata

Description

This function suspends an account.

Suspension denies the user access to the account. Unlike account deletion, you can reverse account suspension.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/suspendacct?api.version=1&user=username&reason=Nonpayment&leave-ftp-accts-enabled=0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/suspendacct?api.version=1&user=username&reason=Nonpayment&leave-ftp-accts-enabled=0
 Command Line
whmapi1 suspendacct user=username reason=Nonpayment leave-ftp-accts-enabled=0


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)
{  
   "metadata":{  
      "version":1,
      "reason":"OK",
      "output":{  
         "raw":"Changing Shell to /bin/false...Changing shell for username.\nWarning: \"/bin/false\" is not listed in /etc/shells.\nShell changed.\nDone\nLocking Password...Locking password for user username.\npasswd: Success\nDone\n1Suspending mysql users\nUsing Universal Quota Support (quota=0)\nSuspending websites...\nUsing Universal Quota Support (quota=0)\nSuspending FTP accounts...\nUpdating FTP passwords for username\nFTP password files updated.\nFTP vhost passwords synced\nusername's account has been suspended\n"
      },
      "result":1,
      "command":"suspendacct"
   }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <output>
            <raw>
                Changing Shell to /bin/false...Changing shell for username. Warning: "/bin/false" is not listed in /etc/shells. Shell changed. Done Locking Password...Locking password for user username. passwd: Success Done 1Suspending mysql users Using Universal Quota Support (quota=0) Suspending websites... Using Universal Quota Support (quota=0) Suspending FTP accounts... Updating FTP passwords for username FTP password files updated. FTP vhost passwords synced username's account has been suspended
            </raw>
        </output>
        <result>1</result>
        <command>suspendacct</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
userstring

Required

The account to suspend.

A valid cPanel or WHM username on the server.username
reasonstring

The reason for suspension.

Important:

We strongly recommend that you provide a reason for suspension whenever you suspend an account.

A string value.Nonpayment
disallowunBoolean

Whether to allow only the root user to unsuspend the account.

This parameter defaults to 0.

  • 1Only the root user can unsuspend the account.
  • 0 — The root user or the account's owner can unsuspend the account.
1
leave-ftp-accts-enabledBoolean

Whether to skip suspension of the account's FTP accounts.

Note:

We added this parameter in cPanel & WHM version 88.

This parameter defaults to 0.

  • 1 — Do not suspend the FTP accounts.
  • 0 — Suspend the FTP accounts.
0

Returns

This function only returns metadata.