Introduction
The recommended method to transfer an account is to use "Transfer Tool" or "Transfer or Restore a cPanel Account" in WHM. However, the API can be used to transfer an account as a last resort.
Procedure
Please note that the examples provided use 203.0.113.2 for the remote server IP address along with cpusername and cpuserpassword for the username and password of the account to be transferred. You should replace these with the IP address of the server from which the account is to be transferred from as well as the username, and password of the account to be transferred.
- Access the command line on the destination server as the 'root' user via SSH or the "Terminal" application in WHM.
- Use the create_remote_user_transfer_session API call to create the transfer session.
[root@server ~]cPs# whmapi1 create_remote_user_transfer_session host=203.0.113.2 password=cpuserpassword unrestricted_restore=1
---
data:
transfer_session_id: 10232216noroo202008261343593rYxE7bWu
metadata:
command: create_remote_user_transfer_session
reason: OK
result: 1
version: 1 - Copy the Transfer session ID from the transfer_session_id line of the create_remote_user_transfer_session output.
- Use the enqueue_transfer_item API call to set the transfer options, including the username of the account to transfer.
[root@server ~]cPs# whmapi1 enqueue_transfer_item module=AccountRemoteUser user=cpusername localuser=cpusername transfer_session_id=10232216noroo202008261343593rYxE7bWu localuser=cpusername
---
metadata:
command: enqueue_transfer_item
reason: OK
result: 1
version: 1 - Initiate the transfer process with the start_transfer_session API call.
[root@server ~]cPs# whmapi1 start_transfer_session transfer_session_id=10232216noroo202008261343593rYxE7bWu
---
data:
pid: 44380
metadata:
command: start_transfer_session
reason: OK
result: 1
version: 1