DirectAdmin API

Integrate your product with DirectAdmin

More custom CMD_API_ commands can be added upon request.

DirectAdmin Uses port 2222 which may or may not be secure (SSL). The default is not, so if you need to chose one, chose non SSL. Authentication is basic web authentication using base64 encryption of "username:password"

The values "ON or OFF" generally indicate a checkbox, so if the checkbox is not checked, the name will not be passed and OFF is assumed. If a checkbox value is to be OFF, then the variable should not be passed at all.

A return value of Text means that a website will be returned with text showing the result. If the return value is Location, then a Location header will be returned as a redirect to send the client to a new page. If return value is url encoded, a url encoded string is returned after the DirectAdmin Headers. If its a list, it'll be in the list[] array. Use "unhtmlentities()" then "parse_str()" with PHP to get the values. This is the code I use for decoding with all API testing: http://help.directadmin.com/item.php?id=204

You MUST have the proper permissions with your account in order use the API. For example, a User cannot get the list of all the Users on the server, only an Admin can.


Command naming format for API calls:

For APIs, they're always the same name as in DA (when logged in witha browser), just with API added, eg:


CMD_POP


becomes:


CMD_API_POP


which is all you'd need to search the Versions System with CMD_API_POP.
Also both CMD_POP and CMD_API_POP use the exact same code internally. If CMD_POP can do it, CMD_API_POP can do it. The only difference is the ouput. The API version will generate pareseable output.


"Login-as" with the API:

Note that you can use the "login-as" feature with the API if you want to make User Level API calls for your clients, but don't know their passwords. The way you do that is setup your API to make the User Level API call normally, but instead of using $username = "clientuser"; (since you don't know their password) you'd instead use: $username = "admin|clientuser"; and specify the admin password. This can be used for any Admin or Reseller who controls the client they're logging into. Note that an Admin can control everyone, so they can login to anyone's account with this method. A Reseller can obviously only log into their own client's accounts. You can also test this feature out at the standard DA login page.. enter the "admin|user" username instead of "admin", along with the admin password, and you'll be logged in as "user" with your browser.


Login Keys

As of DirectAdmin 1.41.0, the Login Keys feature is fully functional and integrated into the User skins and packages. They are recommended if you are providing a password to an external system for use with your server's API. Login Keys allow you to provide a separate password to the external script, and to greatly restrict their functionality, as needed. You can limit the IP that can connect, the commands it's allowed to run (allow or deny), the number of calls it can make, and an expiry date for that Login Key.


Quick Links


Navigation menu

Creating Accounts

Create Admin:
Function To create a new admin account
Command CMD_ACCOUNT_ADMIN
Method GET or POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
action create
username The Admin's username. 4-8 characters, alphanumeric
email A valid email address
passwd The admins password. 5+ characters, ascii
passwd2 Password double check. 5+ characters, ascii
notify yes or no. If yes, an email will be sent to email

Create Admin:
Function To create a new admin account. Exactly the same as CMD_ACCOUNT_ADMIN except return value
Command CMD_API_ACCOUNT_ADMIN
Method GET or POST
Success Returns error=0&text=text&details=details
Failure Returns error=1&text=text&details=details

Create Reseller:
Function To create a new reseller account using a pre-made package
Command CMD_ACCOUNT_RESELLER
Method GET or POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
action create
add Submit
username The Reseller's username. 4-8 characters, alphanumeric
email A valid email address
passwd The admins password. 5+ characters, ascii
passwd2 Password double check. 5+ characters, ascii
domain A valid domain name in the form: domain.com
package One of the Reseller packages created by an admin
ip shared, sharedreseller or assign. If shared, domain will use the server's main ip. assign will use one of the reseller's ips. sharedreseller will set the resellers ip to shared and assign the reseller to it.
notify yes or no. If yes, an email will be sent to email

Create Custom Reseller:
Function To create a new reseller account without the need for a reseller package
Command CMD_ACCOUNT_RESELLER
Method GET or POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
action create
add Submit
username The Reseller's username. 4-8 characters, alphanumeric
email A valid email address
passwd The admins password. 5+ characters, ascii
passwd2 Password double check. 5+ characters, ascii
domain A valid domain name in the form: domain.com
bandwidth Amount of bandwidth Reseller will be allowed to use. Number, in Megabytes
ubandwidth ON or OFF. If ON, bandwidth is ignored and no limit is set
quota Amount of disk space Reseller will be allowed to use. Number, in Megabytes
uquota ON or OFF. If ON, quota is ignored and no limit is set
vdomains Number of domains the reseller and his/her User's are allowed to create
uvdomains ON or OFF. If ON, vdomains is ignored and no limit is set
nsubdomains Number of subdomains the reseller and his/her User's are allowed to create
unsubdomains ON or OFF. If ON, nsubdomains is ignored and no limit is set
ips Number of ips that will be allocated to the Reseller upon account during account
nemails Number of pop accounts the reseller and his/her User's are allowed to create
unemails ON or OFF Unlimited option for nemails
nemailf Number of forwarders the reseller and his/her User's are allowed to create
unemailf ON or OFF Unlimited option for nemailf
nemailml Number of mailing lists the reseller and his/her User's are allowed to create
unemailml ON or OFF Unlimited option for nemailml
nemailr Number of autoresponders the reseller and his/her User's are allowed to create
unemailr ON or OFF Unlimited option for nemailr
mysql Number of MySQL databases the reseller and his/her User's are allowed to create
umysql ON or OFF Unlimited option for mysql
domainptr Number of domain pointers the reseller and his/her User's are allowed to create
udomainptr ON or OFF Unlimited option for domainptr
ftp Number of ftp accounts the reseller and his/her User's are allowed to create
uftp ON or OFF Unlimited option for ftp
aftp ON or OFF If ON, the reseller and his/her users will be able to have anonymous ftp accounts.
php ON or OFF If ON, the reseller and his/her users will have the ability to run php scripts.
cgi ON or OFF If ON, the reseller and his/her users will have the ability to run cgi scripts in their cgi-bins.
ssl ON or OFF If ON, the reseller and his/her users will have the ability to access their websites through secure https://.
ssh ON or OFF If ON, the reseller will be have an ssh account.
userssh ON or OFF If ON, the reseller will be allowed to create ssh accounts for his/her users.
dnscontrol ON or OFF If ON, the reseller will be able to modify his/her dns records and to create users with or without this option.
dns OFF or TWO or THREE. If OFF, no dns's will be created. TWO: domain ip for ns1 and another ip for ns2. THREE: domain has own ip. ns1 and ns2 have their own ips
serverip ON or OFF If ON, the reseller will have the ability to create users using the servers main ip.
ip shared or assign. If shared, domain will use the server's main ip. assign will use one of the reseller's ips
notify yes or no. If yes, an email will be sent to email

Create Reseller:
Function To create a new reseller account. Exactly the same as CMD_ACCOUNT_RESELLER except return value
Command CMD_API_ACCOUNT_RESELLER
Method GET or POST
Success Returns error=0&text=text&details=details
Failure Returns error=1&text=text&details=details

Create User:
Function To create a new user account using a pre-made package
Command CMD_API_ACCOUNT_USER
Method GET or POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
action create
add Submit
username The User's username. 4-8 characters, alphanumeric
email A valid email address
passwd The User's password. 5+ characters, ascii
passwd2 Password double check. 5+ characters, ascii
domain A valid domain name in the form: domain.com
package One of the User packages created by the Reseller
ip One of the ips which is available for user creation. Only free or shared ips are allowed.
notify yes or no. If yes, an email will be sent to email

Create Custom User:
Function To create a new user account without the need for a user package
Command CMD_API_ACCOUNT_USER
Method GET or POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
action create
add Submit
username The Users's username. 4-8 characters, alphanumeric
email A valid email address
passwd The User's password. 5+ characters, ascii
passwd2 Password double check. 5+ characters, ascii
domain A valid domain name in the form: domain.com
bandwidth Amount of bandwidth User will be allowed to use. Number, in Megabytes
ubandwidth ON or OFF. If ON, bandwidth is ignored and no limit is set
quota Amount of disk space User will be allowed to use. Number, in Megabytes
uquota ON or OFF. If ON, quota is ignored and no limit is set
vdomains Number of domains the User will be allowed to create
uvdomains ON or OFF. If ON, vdomains is ignored and no limit is set
nsubdomains Number of subdomains the User will be allowed to create
unsubdomains ON or OFF. If ON, nsubdomains is ignored and no limit is set
nemails Number of pop accounts the User will be allowed to create
unemails ON or OFF Unlimited option for nemails
nemailf Number of forwarders the User will be allowed to create
unemailf ON or OFF Unlimited option for nemailf
nemailml Number of mailing lists the User will be allowed to create
unemailml ON or OFF Unlimited option for nemailml
nemailr Number of autoresponders the User will be allowed to create
unemailr ON or OFF Unlimited option for nemailr
mysql Number of MySQL databases the User will be allowed to create
umysql ON or OFF Unlimited option for mysql
domainptr Number of domain pointers the User will be allowed to create
udomainptr ON or OFF Unlimited option for domainptr
ftp Number of ftp accounts the User will be allowed to create
uftp ON or OFF Unlimited option for ftp
aftp ON or OFF If ON, the User will be able to have anonymous ftp accounts.
cgi ON or OFF If ON, the User will have the ability to run cgi scripts in their cgi-bin.
php ON or OFF If ON, the User will have the ability to run php scripts.
spam ON or OFF If ON, the User will have the ability to run scan email with SpamAssassin.
cron ON or OFF If ON, the User will have the ability to creat cronjobs.
catchall ON or OFF If ON, the User will have the ability to enable and customize a catch-all email (*@domain.com).
ssl ON or OFF If ON, the User will have the ability to access their websites through secure https://.
ssh ON or OFF If ON, the User will have an ssh account.
sysinfo ON or OFF If ON, the User will have access to a page that shows the system information.
dnscontrol ON or OFF If ON, the User will be able to modify his/her dns records.
ip One of the ips which is available for user creation. Only free or shared ips are allowed. See "Getting List of IPs and IP info" for the list of ips allowed here
notify yes or no. If yes, an email will be sent to email

Create User:
Function To create a new User account. Exactly the same as CMD_ACCOUNT_USER except return value
Command CMD_API_ACCOUNT_USER
Method GET or POST
Success Returns error=0&text=text&details=details
Failure Returns error=1&text=text&details=details

Get Reseller's List of IP and IP information

Get List of IPs and get IP info:
Function To get the list of IPs currently owned by this reseller. If value ip is passed, information about that IP is returned instead
Command CMD_API_SHOW_RESELLER_IPS
Method GET or POST
Success Returns url encoded array in list[] OR url encoded string
Failure Returns error=1
Form Values:
Name Value
( ip ) Optional. If passed, info about the ip is generated. If not, the list of IPs is generated in the list[]. Information includes: ns: if a nameserver is on this ip, it will be listed here, reseller: if allocated to a reseller, their username will be here , status: "server" (server's ip) "owned" or "free", value:if owned, the user who owns it, else the # of users using it

Deleting Accounts

Deleting *ANY* usertype:
Function To delete an Admin, a Reseller, or a User
Command CMD_API_SELECT_USERS
Method POST
Success Returns Text
Failure Returns Text
Form Values:
Name Value
confirmed Confirm
delete yes
select0 The name of the admin/reseller/user
( select1 ...) The name of the admin/reseller/user. Not required, but you can keep adding more users by increasing the number (select2, select3, etc..)

Suspending/Activating Accounts

Suspending/Activating *ANY* usertype:
Function To suspend an Admin, a Reseller, or a User, or activate if they are already suspended
New API set for this: http://www.directadmin.com/features.php?id=807
Command CMD_API_SELECT_USERS
Method POST
Success Returns Location of location
Failure Returns Text
Form Values:
Name Value
location CMD_ADMIN_SHOW or CMD_RESELLER_SHOW or CMD_SELECT_USERS. Tells DirectAdmin where to return to after its done
suspend Suspend/Unsuspend
select0 The name of the admin/reseller/user
( select1 ...) The name of the admin/reseller/user. Not required, but you can keep adding more users by increasing the number (select2, select3, etc..)

Listing User Accounts

Get List of Users owned by Reseller:
Function To get the list of Users currently owned by this reseller. If value reseller is passed, the list of Users created by that Reseller will be shown instead
Command CMD_API_SHOW_USERS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1
Form Values:
Name Value
( reseller ) Optional. If passed, the list of Users created by the Reseller identified by reseller will be given. Else, the list of Users created by the Reseller calling the function will be produced

Listing Reseller accounts

Get List of Resellers on server:
Function To get the list of Resellers currently on the server.
Command CMD_API_SHOW_RESELLERS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1

Listing Admin accounts

Get List of Admins on server:
Function To get the list of Admins currently on the server.
Command CMD_API_SHOW_ADMINS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1

Get List of all Users on server

Get List of Users owned by Reseller:
Function To get the list of all the Users currently on the server.
Command CMD_API_SHOW_ALL_USERS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1

Modifying Accounts

Save User Email:
Function To allow a user to change his/her email for their account. This is their account email and does not modify their ticket/messaging system email
Command CMD_API_CHANGE_INFO
Method POST
Success Returns Location with the users stats screen: CMD_USER_STATS
Form Values:
Name Value
evalue A valid email address
domain Any domain in the users account. Its only purpose it to provide a return link to that domain's stats page
email Save. Used to determine what value is being saved. With email being passed, DirectAdmin will know its supposed to be saving an email

Save User Email for Ticket/Messaging system:
Function To allow a user to change his/her email for the message/ticket system. This email address is the one that will be used when tickets or messages are sent back and forth
Command CMD_API_TICKET
Method POST
Success Returns Location of the messaging system: CMD_TICKET
Failure Returns Text
Form Values:
Name Value
email A valid email address
ON yes or no this is a checkbox to tell the ticket system if it should send an email out for each message.
save Save. Button for the form (not actually required)

Modify User Settings:
Function To allow a reseller to update the settings of one of his/her users
Command CMD_API_MODIFY_USER
Method POST
Success Returns Location: CMD_USER_SHOW
Failure Returns Text
Form Values:
Name Value
action customize
user the username of the User to be modified
bandwidth Amount of bandwidth User will be allowed to use. Number, in Megabytes
ubandwidth ON or OFF. If ON, bandwidth is ignored and no limit is set
quota Amount of disk space User will be allowed to use. Number, in Megabytes
uquota ON or OFF. If ON, quota is ignored and no limit is set
vdomains Number of domains the User will be allowed to create
uvdomains ON or OFF. If ON, vdomains is ignored and no limit is set
nsubdomains Number of subdomains the User will be allowed to create
unsubdomains ON or OFF. If ON, nsubdomains is ignored and no limit is set
nemails Number of pop accounts the User will be allowed to create
unemails ON or OFF Unlimited option for nemails
nemailf Number of forwarders the User will be allowed to create
unemailf ON or OFF Unlimited option for nemailf
nemailml Number of mailing lists the User will be allowed to create
unemailml ON or OFF Unlimited option for nemailml
nemailr Number of autoresponders the User will be allowed to create
unemailr ON or OFF Unlimited option for nemailr
mysql Number of MySQL databases the User will be allowed to create
umysql ON or OFF Unlimited option for mysql
domainptr Number of domain pointers the User will be allowed to create
udomainptr ON or OFF Unlimited option for domainptr
ftp Number of ftp accounts the User will be allowed to create
uftp ON or OFF Unlimited option for ftp
aftp ON or OFF If ON, the User will be able to have anonymous ftp accounts.
cgi ON or OFF If ON, the User will have the ability to run cgi scripts in their cgi-bin.
php ON or OFF If ON, the User will have the ability to run php scripts.
spam ON or OFF If ON, the User will have the ability to turn on spamassassin.
cron ON or OFF If ON, the User will have the ability to run cron jobs
ssl ON or OFF If ON, the User will have the ability to access their websites through secure https://.
sysinfo ON or OFF If ON, the User will have the ability to view the system information page.
ssh ON or OFF If ON, the User will have an ssh account.
dnscontrol ON or OFF If ON, the User will be able to modify his/her dns records.
skin Skin name that the user will use. Selected from the Resellers list of skins. If the skin doesn't exist or is invalid, it will not be changed
ns1 Name server 1 that the user will use. Will remove the old one and replace it with this one
ns2 Name server 2 that the user will use. Will remove the old one and replace it with this one

Server Information

Get Server Statistics:
Function Get all server statistics and usages
Command CMD_API_ADMIN_STATS
Method GET
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
RX Number of megabytes currently received through the adaptor with units, as returned by 'ifconfig'. eg. 1045.4 Mb
TX Number of megabytes currently sent through the adaptor with units, as returned by 'ifconfig'. eg. 5345.4 Mb
bandwidth Number of megabytes sent and recorded by DirectAdmin
quota Number of megabytes of disk space used by users as recorded by DirectAdmin
disk1 Disk Usage as returned by 'df'. Stored in a colon separated list. eg: /dev/hda6:381139:276138:85323:77%:/ Where data is: Filesystem:1k-blocks:Used:Available:Use%:Mounted on
( disk2 ... ) Repeat of disk1, with one disk# for each partition.
domainptr Number of domain pointers on the server
ftp Number of ftp accounts on the server
mysql Number of databases on the server
nemailf Number of email forwarders on the server
nemailml Number of mailing lists on the server
nemailr Number of autoresponders on the server
nemails Number of pop accounts on the server
nresellers Number of resellers on the server
nsubdomains Number of subdomains on the server
nusers Number of users on the server
vdomains Number of virtual domains on the server

Get User Usage:
Function Retrieve the user's usages
Command CMD_API_SHOW_USER_USAGE
Method GET
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
user Username of the user for which you wish to view the stats
Array Returns Values
Name Value
bandwidth Number of megabytes sent by the user
quota Number of megabytes of disk space used by the user
domainptr Number of domain pointers used
ftp Number of ftp accounts used
mysql Number of databases used
nemailf Number of email forwarders used
nemailml Number of mailing lists used
nemailr Number of autoresponders used
nemails Number of pop accounts used
nsubdomains Number of subdomains used
vdomains Number of virtual domains used

Get User Limits and Configurations:
Function Retrieve the user's upper limits and settings that defines their account
Command CMD_API_SHOW_USER_CONFIG
Method GET
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
user Username of the user for which you wish to view the stats
Array Returns Values
Name Value
account One of ON or OFF. Used to determine the state of an account. Manually suspendig a user will set this to off. Automatic suspensions will not.
additional_bandwidth Number of extra meg User is allowed to use this month.
aftp One of ON or OFF. Used to determine if the user can have an anonymous ftp account
catchall One of ON or OFF. Used to determine if the user can have a catch-all address
cgi One of ON or OFF. Used to determine if the user can have a cgi-bin
creator name of the account used to create this user
cron One of ON or OFF. Used to determine if the user can have cronjobs
date_created Date the User was created. May not exist on older accounts.
dnscontrol One of ON or OFF. Used to determine if the user is allowed to modify their dns records
docsroot local path (relative to /usr/local/directadmin) to the user's current selected skin
domain The main domain for the user. Will be the domain included when the account was created
email The current email account, as set by the user. Note that this may differ from the email set in their messaging system
ip Current ip assigned to the user
language Current language assigned to the user
lastquotaupdate Unix timestamp of when the User click the Update button for their disk usage
login_keys One of ON or OFF. Used to determine if the user can create Login Keys
ns1 and ns2 Current nameservers assigned to the user
package Package used to create the user. Will be custom if their settings were modified.
sentwarning To determine if the usage warning email has already been sent out
skin Name of the user's current skin
spam One of ON or OFF. Does the user have access to enable SpamAssassin
ssh One of ON or OFF. Does the user have ssh
ssl One of ON or OFF. Does the user have ssl
suspend_at_limit One of ON or OFF. Will the user be suspended at his bandwidth limit
suspended One of yes or no. Is the user currently suspended.
sysinfo One of ON or OFF. Does the user have access to view the System Information page
username The username of the username.
usertype One of user, reseller or admin. Type of user account
zoom Depreciated setting where you can set the permanent ZOOM token. Will set the webpage to be zoomed at this level
bandwidth Maximum number of megabytes allowed by the user
quota Maximum megabytes of disk space allowed by the user
domainptr Number of domain pointers allowed
ftp Number of ftp accounts allowed
mysql Number of databases allowed
nemailf Number of email forwarders allowed
nemailml Number of mailing lists allowed
nemailr Number of autoresponders allowed
nemails Number of pop accounts allowed
nsubdomains Number of subdomains allowed
vdomains Number of virtual domains allowed

Get User Domains:
Function Retrieve the list of domains owned by the user, and some basic stats
Command CMD_API_SHOW_USER_DOMAINS
Method GET
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
user Username of the user for which you wish to view the stats
Array Returns Values
Name Value
domain.com Colon speparated list with domain information: eg. 6757.4:unlimited:0.000356674:93.5:2:no:unlimited:ON:ON:ON where the data is bandwidth used:bandwidth limit:disk usage for the domain:log usage for the domain:# of subdomains:suspended:quota:ssl:cgi:php
( domain2.com ... ) Same as domain.com, one entry for each domain

Reseller and User Packages

Show Reseller Packages:
Function Shows the list of available Reseller Packages
Command CMD_API_PACKAGES_RESELLER
Method GET
Success Returns url encoded array
Failure Returns empty array (nothing)

Show a Reseller Package:
Function Shows a specific Reseller Package
Command CMD_API_PACKAGES_RESELLER
Method GET
Success Returns url encoded array
Failure Returns empty array (nothing)
Form Values:
Name Value
package name of the package to be viewed
Array Returns Values
Name Value
aftp OFF or ON, Allowed to give out anonymous ftp
cgi OFF or ON, Allowed to give out cgi-bin's
dns OFF,TWO or THREE, Method of setting up dns for the reseller. Off, two ips, or three ips, with ns1 and 2 on the last 2 ips.
dnscontrol OFF or ON, Allowed to give Users Access to their dns panel
bandwidth unlimited or number in megabytes
domainptr unlimited or quantity
ftp unlimited or quantity
ips 0 and up
mysql unlimited or quantity
ftp unlimited or quantity
nemailf unlimited or quantity
nemailml unlimited or quantity
nemailr unlimited or quantity
nemails unlimited or quantity
nsubdomains unlimited or quantity
quota unlimited or number in megabytes
serverip OFF or ON, Allowed to use the server ip for his users
ssh OFF or ON, Allowed to have ssh access
userssh OFF or ON, Allowed to give out ssh access to his users
ssl OFF or ON, Allowed to give out https ssl
vdomains unlimited or quantity of domains

Show User Packages:
Function Shows the list of available User Packages
Command CMD_API_PACKAGES_USER
Method GET
Success Returns url encoded array
Failure Returns empty array (nothing)

Show a User Package:
Function Shows a specific User Package
Command CMD_API_PACKAGES_USER
Method GET
Success Returns url encoded array
Failure Returns empty array (nothing)
Form Values:
Name Value
package name of the package to be viewed
Array Returns Values
Name Value
aftp OFF or ON, Allowed to use anonymous ftp
cgi OFF or ON, Allowed to use cgi-bin's
dnscontrol OFF or ON, Allowed to use their dns panel
bandwidth unlimited or number in megabytes
domainptr unlimited or quantity
ftp unlimited or quantity
mysql unlimited or quantity
name full name of the user
nemailf unlimited or quantity
nemailml unlimited or quantity
nemailr unlimited or quantity
nemails unlimited or quantity
nsubdomains unlimited or quantity
quota unlimited or number in megabytes
skin Skin to be assigned
ssh OFF or ON, Allowed to have ssh access
ssl OFF or ON, Allowed to give out https ssl
vdomains unlimited or quantity of domains
suspend_at_limit OFF or ON, To determine if the users account will be suspended when the bandwidth is used up

Sessions and Passwords

Get Session Information:
Function To get session information including usertype and base64 encoded password
Command CMD_API_GET_SESSION
Method GET or POST
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
ip The IP address of the connected user. Must match the value in the session identified by session_id
session_id Users session ID. Can be obtained via the "session" cookie, or the |SESSION_ID| token.
Array Returns Values
error 0 or 1, To determine if it was successful or not
password Base64 encoded password, as stored in the session
username Username of the user in that session
usertype user or reseller or admin, Type of the account the user has.

User APIs

List Domains:
Function To list all of the domains for the current User account
Command CMD_API_SHOW_DOMAINS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns Nothing to break here. No domains returns empty list

Create Domain:
Function To create a domain under an existing User account
Command CMD_API_DOMAIN
Method POST
Success Returns url encoded array
Failure Returns error=1
Form Values:
Name Value
action create
domain domain.com
bandwidth integer, in meg, eg 12345
ubandwidth unlimited If ubandwidth is passed, the bandwidth will be shared with the main account
quota integer, in meg, eg 12345
uquota unlimited If uquota is passed, the quota will be shared with the main account
ssl ON|OFF
cgi ON|OFF
php ON|OFF

List Subdomains:
Function Used to list all of the subdomains for a given domain
Command CMD_API_SUBDOMAINS
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1 and url encoded String
Form Values:
Name Value
domain the domain to be shown eg: domain.com

Create Subdomain:
Function Used to create a subdomain for a given domain
Command CMD_API_SUBDOMAINS
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
domain the domain to be shown eg: domain.com
action create
subdomain the name of the subdomain to be created

Delete Subdomain:
Function Used to delete a list of subdomains for a given domain
Command CMD_API_SUBDOMAINS
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
domain the domain to be shown eg: domain.com
action delete
select0 (select1, ...) the name of the subdomain to be deleted
contents yes or no: if you want to remove the directory and contents.

Databases

List Databases:
Function Used to list all of the databases
Command CMD_API_DATABASES
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1 and url encoded String

Create Database:
Function Used to create a database
Command CMD_API_DATABASES
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
action create
name the name of the database to be created (username_ will be added)
user the name of the database user to be added (username_ will be added)
passwd password for username_user
passwd2 password for username_user

Delete Databases:
Function Used to delete a list of databases
Command CMD_API_DATABASES
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
action delete
select0 (select1, ...) the name of the database to be deleted

Email accounts and password changing

Set Virtual Email Password:
Function Used to change an email password without requiring a DirectAdmin account (will not change system email account password)
Command CMD_CHANGE_EMAIL_PASSWORD
Method GET or POST
Success Returns url encoded array if api is passed. Else if redirect is passed, browser will be redirected there. Else a dynamic "success" page is shown.
Failure Returns url encoded array if api is passed. Else a dynamic "error" page is shown.
Form Values:
Name Value
email virtual pop account to be changed. This will not change the main system acccount email
oldpassword Previous password used for the email account
password1 New password to be used
password2 Re-type the new password to be used
( redirect ) Optional redirect. Upon successful password change, the user will be forwarded here eg."/" or "http://redirect.com/site".
This value has no effect if api is passed
( api ) yes (any value will work, only the inclusion of "api=" is checked)
Array Returns Values
Name Value
error 0 or 1, To determine if it was successful or not
text some text decribing the result

List Virtual POP Account:
Function Used to list all of the pop accounts for a domain
Command CMD_API_POP
Method GET or POST
Success Returns url encoded array in list[]
Failure Returns error=1 and url encoded String
Form Values:
Name Value
action list
domain the domain to be shown eg: domain.com

Create a Virtual POP Account:
Function Used to create a pop account for a domain
Command CMD_API_POP
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
action create
domain the domain to be shown eg: domain.com
user email user eg: bob
passwd the password for the account
passwd2 password confirmation
quota Integer in Megabytes. Zero for unlimited, 1+ for number of Megabytes.
limit Send Limit. Zero for unlimited. Blank defaults to the system's default.

Delete a Virtual POP Account:
Function Used to delete a pop account for a domain
Command CMD_API_POP
Method GET or POST
Success Returns error=0 and url encoded String
Failure Returns error=1 and url encoded String
Form Values:
Name Value
action delete
domain the domain to be shown eg: domain.com
user email user eg: bob

Interested to try DirectAdmin? Get a 30-day Free Trial!