cPanel/Ftp
cPanel module

Ftp

20 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="Ftp", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

add_ftp GET#

Create FTP account

This function creates an FTP account.

Important:

When you disable the FTP role, the system disables this function.

userstringRequired
The new FTP account username.
disallowdotintegerOptional
Whether to strip dots (.) from the username. 1 — Strip dots. 0 — Do not strip dots.
domainstringOptional
The FTP user's associated domain. This must be a domain that the cPanel account owns. Note: This parameter defaults to the cPanel account's primary domain.
homedirstringOptional
The path to the FTP account's root directory, relative to the cPanel account's home directory. If you don't set this, it defaults to a directory with the same name as the FTP account.
passstringOptional
The new FTP account password. Note: You can use the pass_hash parameter in place of this parameter. However, you cannot use both the pass and pass_hash parameters in the same request.
pass_hashstringOptional
The account's password hash. Note: You can use this parameter in place of the pass parameter. However, you cannot use both the pass and pass_hash parameters in the same request. You can find your server's password hash type in the /etc/sysconfig/authconfig file.
quotaintegerOptional
The FTP account's maximum disk usage quota, in megabytes (MB). Note: A value of 0 grants the FTP account unlimited disk space.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

allows_anonymous_ftp GET#

Return if anonymous FTP connections allowed

This function checks whether the account allows anonymous FTP connections.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

allowsinteger
Whether the cPanel account allows anonymous FTP connections. 1 - Allowed. 0 - Not allowed.
One of: 0 1

allows_anonymous_ftp_incoming GET#

Return if anonymous FTP transfers allowed

This function checks whether the account allows inbound anonymous FTP transfers.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

allowsinteger
Whether the cPanel account allows inbound anonymous FTP transfers. 1 - Allowed. 0 - Not allowed.
One of: 0 1

delete_ftp GET#

Delete FTP account

This function deletes an FTP account.

Important:

When you disable the FTP role, the system disables this function.

userstringRequired
The FTP account's username.
destroyintegerOptional
Whether to delete the FTP account's home directory. 1 — Delete the home directory. 0 — Do not delete the home directory.
domainstringOptional
The user's associated domain. Note: This parameter defaults to the cPanel account's primary domain.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

ftp_exists GET#

Return whether an FTP account exists

This function checks whether an FTP account exists.

Note:

This function returns only metadata if the FTP account exists, or an error if the FTP account does not exist.

userstringRequired
The FTP account's username.
domainstringOptional
The user's associated domain. Note: This parameter defaults to the cPanel account's primary domain.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

get_ftp_daemon_info GET#

Return FTP server's information

This function retrieves the extended information about the server's FTP daemon.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

enabledinteger
Whether the server's FTP daemon is enabled. 1 – Enabled. 0 – Disabled.
One of: 0 1
namestring
The FTP server's name. pure-ftpd proftpd * An empty string.
One of: pure-ftpd proftpd
supportsobject
This object contains the features that the FTP daemon supports.
login_without_domaininteger
Whether the FTP daemon supports username authentication without the user's domain. 1 – Supported. 0Not supported.
One of: 0 1
quotainteger
Whether the FTP daemon supports disk quotas. 1 – Supported. 0Not supported.
One of: 0 1

get_port GET#

Return FTP server's port

This function returns the FTP port.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

portinteger
The FTP port.

get_quota GET#

Return FTP account's quota

This function checks an FTP account's quota.

Important:

When you disable the _FTP role_, the system disables this function.

accountstringRequired
The FTP account's username.
domainstringOptional
The user's associated domain. Note: This parameter defaults to the cPanel account's primary domain.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

The FTP account's quota. unlimited A positive integer that represents the maximum amount of disk space that the FTP account can use, in megabytes (MB).

get_welcome_message GET#

Return FTP account's welcome message

This function retrieves the cPanel account's FTP welcome message.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

The cPanel account's FTP welcome message.

kill_session GET#

Stop FTP session

This function kills FTP sessions.

Important:

When you disable the FTP Role, the system disables this function.

loginstringOptional
The username for the session's FTP account. Note: To stop all FTP sessions for the cPanel account, set this parameter to the all value.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

list_ftp GET#

Return FTP accounts

This function lists FTP account information.

Important:

When you disable the FTP role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

include_acct_typesstringOptional
A list of the FTP account types to include in the function's results. anonymous logaccess main sub If you do not specify this parameter, this function returns all FTP account types. Note: Separate multiple types with the pipe character (|). In browser-based calls, use %7C.
skip_acct_typesstringOptional
A list of the FTP account types to exclude from the function's results. anonymous logaccess main sub If you do not specify this parameter, this function does not exclude any account types. Note: Separate multiple types with the pipe character (|). In browser-based calls, use %7C.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

homedirstring
The absolute path to the FTP account's document root.
typestring
The type of FTP account. anonymous logaccess main sub
One of: anonymous logaccess main sub
userstring
The username for an FTP account on the cPanel account.

list_ftp_with_disk GET#

Return FTP accounts and disk usage

This function lists FTP account and disk usage information.

Important:

When you disable the FTP role, the system disables this function.

include_acct_typesstringOptional
A pipe-delimited list of the FTP account types to include in the function's results. If you do not specify this parameter, the function returns all FTP account types. Valid types for this list are: anonymous logaccess main sub
skip_acct_typesstringOptional
A pipe-delimited list of the FTP account types to exclude from the function's results. If you do not specify this parameter, the function does not exclude any account types. Valid types for this list are: anonymous logaccess main sub

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

_diskquotastring
The FTP account's quota in megabytes, with two digits of fractional precision, encoded as a string. 0.00 means that the quota is unlimited. Note: This value is different from the value for diskquota.
_diskusedstring
The amount of disk space in megabytes that the account currently uses, with two digits of fractional precision, encoded as a string. Note: This value is the same as the value for diskused.
accttypestring
The type of FTP account. anonymous logaccess main sub
One of: anonymous logaccess main sub
deleteableinteger
Whether the function's caller can delete the account. 1 – The caller can delete the account. 0 – The caller cannot delete the account.
One of: 0 1
dirstring
The absolute path to the FTP account's document root.
diskquotaany
The FTP account's quota. unlimited The disk quota in megabytes, with two digits of fractional precision, encoded as a string. Note: This value is different from the value for _diskquota.
diskusedstring
The amount of disk space in megabytes that the account currently uses, with two digits of fractional precision, encoded as a string. Note: This value is the same as the value for _diskused.
diskusedpercentinteger
The percentage of the disk space quota that the account currently uses.
diskusedpercent20integer
The percentage of disk space that the account currently uses, rounded in 20 percent increments.
htmldirstring
The path to the FTP account's HTML directory.
humandiskquotastring
The FTP account's quota, in human-readable format. None — The function returns this value if the account has an unlimited quota. The quota in megabytes (MB), a space, and the characters MB.
humandiskusedstring
The amount of disk space that the account currently uses, in human-readable format. The function formats this value as the quota's size, a space, and the characters MB.
loginstring
The FTP account username.
reldirstring
The path to the FTP account's document root, relative to the cPanel account's home directory.
serverloginstring
The full FTP login username.

list_sessions GET#

Return FTP server's active sessions

This function lists the FTP server's active sessions.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

cmdlinestring
Information about the FTP process, from the ps (process status) command.
filestring
The file that the session is processing. Note: The function returns a blank value if the session is idle.
hostany
The IP address or hostname that connected to the FTP server.
loginstring
The FTP session login time.
pidinteger
The session's PID.
statusstring
The session's status. - IDLE - The session is connected, but idle. - DL - A download is in progress. - UL - An upload is in progress.
One of: IDLE DL UL
userstring
The FTP account username.

passwd GET#

Update FTP account's password

This function changes an FTP account's password.

Important:

When you disable the FTP role, the system disables this function.

passstringRequired
The FTP account's new password.
userstringRequired
The FTP account username.
domainstringOptional
The user's associated domain. Note: This parameter defaults to the cPanel account's primary domain

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

server_name GET#

Return whether server uses ProFTPD or Pure-FTPd

This function checks whether the server uses ProFTPD or Pure-FTPd.

Important:

When you disable the FTP role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

The FTP server. pure-ftpd - The Pure-FTPD server. proftpd - The ProFTPD FTP server. * disabled - FTP has been disabled on this server.

set_anonymous_ftp GET#

Enable or disable anonymous FTP logins

This function enables or disables anonymous FTP logins.

Important:

When you disable the FTP role, the system disables this function.

setintegerOptional
Whether to enable or disable anonymous FTP logins. 1 - Enable. 0 - Disable.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

set_anonymous_ftp_incoming GET#

Enable or disable anonymous incoming FTP transfers

This function enables or disables inbound anonymous FTP transfers.

Important:

When you disable the FTP role, the system disables this function.

setintegerOptional
Whether to enable or disable inbound anonymous FTP transfers. 1 - Enable. 0 - Disable.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

set_homedir GET#

Update FTP account's home directory

This function changes the home directory for FTP accounts.

Important:

When you disable the FTP role, the system disables this function.

userstringRequired
The FTP account username.
domainstringOptional
The user's associated domain. Note: The default value is the cPanel account's primary domain.
homedirstringOptional
The FTP account's home directory Note: This parameter defaults to the user@domain subdirectory in the cPanel account's home directory with the name, where user and domain represent the user and domain parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

set_quota GET#

Update FTP account's quota

This function changes an FTP account's quota.

Important:

When you disable the FTP role, the system disables this function.

userstringRequired
The FTP account username.
domainstringOptional
The user's associated domain. Note: The default value is the cPanel account's primary domain.
killintegerOptional
Whether to disable quotas for the FTP account. 1 - Disable quotas. 0 - Enable quotas. Note: If you disable quotas for an FTP account, you grant that account unlimited disk space.
quotaintegerOptional
The new quota, in megabytes. Note: Setting this parameter to 0 grants the account unlimited disk space.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

set_welcome_message GET#

Update FTP welcome message

This function sets the FTP welcome message.

Important:

When you disable the FTP role, the system disables this function.

messagestringRequired
The cPanel account's new FTP welcome message.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.