WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function creates a transfer session as the root user.
Important:
For information about the ports that cPanel & WHM uses, read our How to Configure Your Firewall for cPanel Services documentation.
Note:
For more information about how this function works with other functions in the transfer and restore process, read our Guide to Transfer and Restore API Functions documentation.
There are several methods that you can use to authenticate a transfer session with the remote server:
If you use SSH to authenticate as the root user, the remote server's SSH must accept root logins. For more information read OpenSSH's sshd_config documentation.
The following table displays the correct parameters and values for this authentication method:
| Parameter | Value |
|---|---|
user | root |
password | root's password |
You can also use an SSH public key to authenticate the root user. If the SSH public key is encrypted, include the SSH key's passphrase.
The following table displays the correct parameters and values for this authentication method:
| Parameter | Value if the SSH Key is not encrypted | Value if the SSH Key is encrypted |
|---|---|---|
user | root | root |
sshkey_name | The root user's SSH key. | The root user's SSH key. |
sshkey_passphrase | (none) | The root user's SSH key passphrase. |
Many server administrators do not permit direct root logins via SSH on their servers.
- If the remote server forbids root logins, you must use another user and their password on the remote server, and then escalate to the
rootuser. For more information read OpenSSH'ssshd_configdocumentation. - If the system administrator used WHM's Manage Wheel Group Users interface (WHM >> Home >> Security Center >> Manage Wheel Group Users) to grant the user
suaccess, then you will need to specifysuand therootpassword. - If the user has
sudoaccess, you do not need therootpassword.
The following table displays the correct parameters and values for this authentication method:
| Parameter | Value if the user has sudo access | Value if the user has su access |
|---|---|---|
user | The username. | The username. |
password | The user's password. | The user's password. |
root_escalation_method | sudo | su |
root_password | (none) | The root user's password. |
You can also use an SSH public key instead of a password to authenticate that user. If the SSH public key is encrypted, include the SSH key's passphrase.
The following table displays the correct parameters and values for this authentication method:
| Parameter | sudo | su |
|---|---|---|
user | The username. | The username. |
sshkey_name | The user's SSH key. | The user's SSH key. |
sshkey_passphrase (If encrypted) | The user's SSH key passphrase. | The user's SSH key passphrase. |
root_escalation_method | sudo | su |
root_password | (none) | The root user's password. |
The method by which the transfer system will execute commands on the remote system.
ssh— Use SSH. The function uses the remote server's indicated SSHportvalue.whostmgr— Use the remote server's secure WHM port. This will reject invalid TLS handshakes.whostmgr_insecure— Use the remote server's secure WHM port, but ignores any TLS verification failures.
Whether to compress data before transfer.
1— Compress.0— Do not compress.
Whether to transfer reseller privileges.
1— Transfer.0— Do not transfer.
Whether to use a custom pkgacct scripts on the remote server for the transfer session.
1— Use a custompkgacctscript.0— Do not use a custom script.
The remote server's hostname or IP address.
A valid IP address.
A valid IP address.
Whether to run the remote server processes at low priority in order to reduce impact on server performance.
1— Run at low priority.0— Run at high priority.
The number of CPU threads to use for restore sessions.
The number of CPU threads to use for transfer sessions.
Whether to not use SSL to encrypt data.
1— Do not use SSL.0— Use SSL.
Whether to skip the Restricted Restore system.
1— Skip.0— Do not skip.
Note:
If you want to pass the force parameter in the WHM API 1 enqueue_transfer_item function, you must set this parameter to a value of 0.
Whether to use an existing backup instead of packaging the data again if the backup is less than 24 hours old.
1— Use an existing backup.0— Package the data.
The username's password.
Note:
Use this parameter if you will authenticate to the remote server with a password. Do not use this parameter if you will authenticate to the remote server with an SSH key.
The escalation method to use to connect to the remote server.
susudo
Note:
Use this parameter if the sshd_config file's PermitRootLogin value is No.
root's password on the remote server.
Note:
Use this parameter if the sshd_config file's PermitRootLogin value is No and you will use the root user's password to escalate access.
The SSH key's name.
Note:
- Use this parameter if you will authenticate to the remote server with an SSH key. Do not use this parameter if you will authenticate to the remote server with a password.
- SSH keys are available in WHM's Manage root's SSH Keys interface (WHM >> Home >> Security Center >> Manage root’s SSH Keys).
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_remote_root_transfer_session
- A server running WHM.
https://whm-server.tld:2087/json-api/create_remote_root_transfer_session
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_remote_root_transfer_session?comm_transport=ssh&compressed=1©_reseller_privs=1&enable_custom_pkgacct=1&host=192.168.0.0&low_priority=1&restore_threads=1&transfer_threads=1&unencrypted=0&unrestricted_restore=1&use_backups=1&user=root&password=123456luggage&port=22&root_escalation_method=sudo&root_password=123456luggage&sshkey_name=FrancisScott&sshkey_passphrase=kkwtoowoygidsa'{ "data": { "analyze_rawout": "Fetching information from remote host: \\u201c10.1.100.35\\u201d \\u2026 \\u2026\\nDone\\nFetching information from remote host: \\u201c10.1.100.35\\u201d \\u2026 \\u2026\\nDone\\n\",", "create_rawout": "Basic credential check \\u2026 \\u2026\\nDone\\nFetching information from remote host: \\u201c10.1.100.35\\u201d \\u2026 \\u2026\\nDone\\nFetching WHM Version \\u2026\\nDone\\nTesting \\u201cvm5.docs.cpanel.net\\u201d for transfer streaming support with password authentication....<strong>Streaming Supported</strong>\\nRemote Server Type: \\u201cWHM1130\\u201d\\n\",", "transfer_session_id": "vm5docscpanelcopya20140430200606V06z" }, "metadata": { "command": "create_remote_root_transfer_session", "reason": "OK", "result": 1, "version": 1 } }
Request
This function creates a transfer session with a non-root user to a remote server.
Important:
- The source and target servers must be able to communicate over port
2087to use this feature. - The source and target servers must also be able to communicate over the port that your servers use for SSH connections.
- For more information about the ports that cPanel & WHM uses, read our How to Configure Your Firewall for cPanel & WHM Services documentation.
Note:
For more information about how this function works with other functions in the transfer and restore process, read our Guide to Transfer and Restore API Functions documentation.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_remote_user_transfer_session
- A server running WHM.
https://whm-server.tld:2087/json-api/create_remote_user_transfer_session
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_remote_user_transfer_session?host=hostname.example.com&password=12345luggage&unrestricted_restore=1'{ "data": { "transfer_session_id": "vm5docscpanelnoroo201402251939519hmy" }, "metadata": { "command": "create_remote_user_transfer_session", "reason": "OK", "result": 1, "version": 1 } }
Request
This function adds a transfer session to a queue. For more information about how this function works with other functions in the transfer and restore process, read our Guide to Transfer and Restore API Functions documentation.
Important:
The module parameter determines which additional parameters to use with the function.
An enqueue transfer item.
The transfer system module.
LegacyAccountBackup— This module restores legacy-account backup files.FeatureListRemoteRoot— This module transfers the feature list from the remote server.PackageRemoteRoot— This module transfers the package settings.AccountLocal— This module restores backup files.AccountRemoteRoot— This module uses therootcredentials to transfer account settings that are not a part of a package.AccountRemoteUser— This module uses the account's user credentials to transfer account settings that are not a part of a package.
Note:
- The
moduleparameter determines which additional parameters to use with the function. - You must perform each module action as a separate step.
When you call this function, you must include the additional parameters for the desired transfer system module. Select a module from the menu to view its required additional parameters:
- AccountLocal
- AccountRemoteRoot
- AccountRemoteUser
- FeatureListRemoteRoot
- LegacyAccountBackup
- PackageRemoteRoot
The size of the content to transfer, in bytes. The restore system uses this value to determine the best filesystem partition for the restored account’s home directory. For best results, give as accurate of a value as possible.
The transfer session's ID.
The custom IP address to assign to the transferred account.
Note:
This parameter requires that the ip parameter has a value of 1.
The user account name that the remote server returns when you query the user account.
Whether to assign a dedicated IP address to the transferred account.
1— Assign a dedicated IP address.0— Do not assign a dedicated IP address.
Note:
If no dedicated IP address exists, the system assigns the account to a shared IP address.
The server on which the account's email will reside after it completes the transfer.
.local— The local server..existing— Use the location defined in the account's backup data.- The alias (friendly name) of a remote cPanel & WHM linked server node.. For example, the
example-aliasfor theservernode.example.comdomain.
Note:
The system will use the .local option if:
- The system cannot use the cPanel & WHM linked server node when you call the
.existingoption. - The cPanel & WHM linked server node's alias (friendly name) is invalid.
The server on which the account's email will reside after it completes the transfer.
.local— The local server..existing— Use the location defined in the account's backup data.- The alias (friendly name) of a remote cPanel & WHM linked server node.. For example, the
example-aliasfor theservernode.example.comdomain.
Note:
The system will use the .local option if:
- The system cannot use the cPanel & WHM linked server node when you call the
.existingoption. - The cPanel & WHM linked server node's alias (friendly name) is invalid.
The server on which the account's email will reside after it completes the transfer.
.local— The local server..existing— Use the location defined in the account's backup data.- The alias (friendly name) of a remote cPanel & WHM linked server node.. For example, the
example-aliasfor theservernode.example.comdomain.
Note:
The system will use the .local option if:
- The system cannot use the cPanel & WHM linked server node when you call the
.existingoption. - The cPanel & WHM linked server node's alias (friendly name) is invalid.
Whether to allow the system to overwrite the account's existing databases with the databases in the backup file.
1— Overwrite.0— Do not overwrite.
Whether to allow the system to overwrite the account's existing database users with the database users in the backup file.
1— Overwrite.0— Do not overwrite.
Whether to replace and delete all directories and files on the destination server.
1— Overwrite.0— Do not overwrite.
Warning:
If you use this parameter, the system deletes every directory and file on the destination server. The system does not delete the directories and files from the source server.
The lines in the domain's zonefile to replace with the new IP address.
all— Replace all of the matchingArecord addresses in the zone file with the new IP address, including customArecords.basic— Replace only the cPanel-managedArecords for this IP address. This includes the main domain and any service subdomains.
Whether to make the account a reseller.
1— Make the account a reseller account.0— Do not make the account a reseller account.
Whether one of the following conditions is true:
- The target and remote servers share the same remote MySQL server.
- The target server is the remote MySQL server for the remote server.
- The remote server is the remote MySQL server for the target server.
Value:
1— One is true.0— None are true.
Whether to skip the recreation of the account.
1— Skip.0— Restore.
Note:
- The values you enter for the
userandlocaluserparameters must match. - This parameter is similar to the
forceparameter, but performs none of the account creation steps.
Whether to skip the transfer of the account's databases.
1— Skip.0— Restore.
Whether to skip the transfer of the account's bandwidth data.
1— Skip.0— Restore.
Whether to skip the contents of the home directory.
1— Skip.0— Restore.
Whether to skip restoration of the account's reseller permissions.
1— Skip.0— Restore.
Whether to overwrite an account with an identical username.
1— Overwrite the account.0— Do not overwrite the account.
This parameter performs the following actions:
- Restores the cPanel account on the destination server.
- Overwrites all account settings, data, and databases.
- Ignores errors and warnings for naming conflicts.
Note:
- The values you enter for the
userandlocaluserparameters must match. - You cannot use this parameter if you called the WHM API 1
create_remote_root_transfer_sessionfunction with theunrestricted_restoreparameter set to1.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/enqueue_transfer_item
- A server running WHM.
https://whm-server.tld:2087/json-api/enqueue_transfer_item
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/enqueue_transfer_item \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d module=AccountLocal \
-d size=133698 \
-d transfer_session_id=vm5docscpanelcopya20140211211719FxjU \
-d customip=192.168.0.1 \
-d detected_remote_user=user \
-d domain=example.com \
-d ip=1 \
-d localuser=localuser \
-d mail_location=.local \
-d overwrite_sameowner_dbs=1 \
-d overwrite_sameowner_dbusers=1 \
-d overwrite_with_delete=1 \
-d replaceip=all \
-d reseller=1 \
-d shared_mysql_server=1 \
-d skipaccount=1 \
-d skipacctdb=1 \
-d skipbwdata=1 \
-d skiphomedir=1 \
-d skipres=1 \
-d user=user \
-d force=1{ "metadata": { "command": "enqueue_transfer_item", "reason": "OK", "result": 1, "version": 1 } }