2.4.1 Domain Reselling: HTTP API

Interaction with the HTTP API for automated domain management within the reselling program is carried out via the HTTPS protocol, while all data from the API is transmitted to clients in JSON format.

List of main variables:

  • $API_URL - HTTP API URL, which is available at the static address my.thehost.com.ua/manager/billmgr
  • $LOGIN - Reseller login from your personal account
  • $PASSWORD - Reseller password from your personal account

Getting an up-to-date list of domain names

HTTP Request:
https:// $API_URL ?func=domain&authinfo= $LOGIN : $PASSWORD &out=json
HTTP Response:
{
"elem": [
    {
        "id": "200",
        "name": "thedomain.com.ua",
        "account": "account (account name)",
        "account_id": "100",
        "expire": "2027-02-16",
        "autoperiod": "-",
        "domainstatus": "2"
    },
    {
        "id": "220",
        "name": "thedomain2.com.ua",
        "account": "account (account name)",
        "account_id": "100",
        "expire": "2022-02-16",
        "autoperiod": "-",
        "domainstatus": "2"
    }]
}

The domain status is encoded by the domainstatus field:

  • 0 - No data
  • 1 - Not paid
  • 2 - Delegated (Active)
  • 3 - Registered (Not delegated)
  • 4 - Removed
  • 5 - Processing (On registration)
  • 6 - Processed (Transfer)
  • 7 - Processing (On renewal)

Changing domain nameservers (NS)

HTTP Request:
https:// $API_URL ?func=domain.edit&elid= $DOMAIN_ID &ns0= $NS0 &ns1= $NS1 &ns2=$ NS2 &ns3= $NS3 &changens=on&sok=ok&authinfo= $LOGIN : $PASSWORD &out=json

Query Variables:

  • $DOMAIN_ID - Domain identifier (id)
  • $NS0 - First nameserver
  • $NS1 - Second nameserver
  • $NS2 - Third nameserver
  • $NS3- Fourth nameserver
HTTP Response:
{
	"result" : "OK",
	"text": "\n    ",
	"text": "\n",
	"ok": ""
}

Create a domain name contact

Consists of two stages:

HTTP Request - first stage:
https:// $API_URL ?func=contcat.create.1
&ctype=generic
&cname= $CONTACT_NAME 
&sok=ok
&authinfo= $LOGIN : $PASSWORD 
&out=json

Query Variables:

  • $CONTACT_NAME - Contact name HTTP Response containing $CONTACT_ID for the second stage:
{[](https://)
	"result" : "OK",
	"domaincontact.id": $CONTACT_ID,
	"ok": "",
	"redirect": "location='billmgr?func=contcat.create.2
        &authinfo= $LOGIN : $PASSWORD &cname=CONTACT%5FNAME
        &contactid= $CONTACT_ID &ctype=generic';"
}

The second stage updates the contact data:

HTTP Request - second stage:
https:// $API_URL ?func=domaincontact.edit
&ctype=generic
&name= $CONTACT_NAME 
&company= $COMPANY 
&firstname= $FIRSTNAME 
&lastname= $LASTNAME 
&email= $EMAIL 
&phone= $PHONE 
&fax= $PHONE 
&la_country= $ID_COUNTRY 
&la_state= $LA_STATE 
&la_postcode= $LA_POSTCODE 
&la_city= $LA_CITY 
&la_address= $LA_ADDRESS 
&elid= $CONTACT_ID 
&sok=ok
&authinfo= $LOGIN : $PASSWORD 
&out=json

Query Variables:

  • $CONTACT_NAME - Contact name
  • $COMPANY - Contact company name. For individuals, you must indicate “Private Person”
  • $FIRSTNAME - Name of the contact person in Latin (example “Ivan”)
  • $LASTNAME - Last name of the contact person in Latin (example “Ivanov”)
  • $EMAIL - Contact email (example “test@test.com”)
  • $PHONE - Phone number of the contact person in the required format - the number must contain + and 2 spaces, while “+” is encoded as %2B (example “%2B380 67 1234567”)
  • $ID_COUNTRY - Country code. A complete list of country codes is available at link.
  • $LA_STATE - Name of the region in Latin (example “Kyiv region”)
  • $LA_POSTCODE - Postal code (example “01001”)
  • $LA_CITY - City name in Latin (example “Kyiv”)
  • $LA_ADDRESS - Address in Latin (example “Kreschatik 1”)

Register a new domain

HTTP Request:
https:// $API_URL ?func=domain.order.4
&contact= $CONTACT_ID 
&ctype=person
&owner= $CONTACT_ID 
&domain= $DOMAIN_NAME_WITHOUT_TLD 
&domainname_0= $DOMAIN_NAME_WITHOUT_TLD 
&tld= $TLD 
&nslist_0= $NSLIST 
&operation=register
&period_0= $PRICE_PERIOD_ID 
&price= $PRICE_ID 
&pricelist_0= $PRICE_ID 
&registrar= $REGISTRAR_ID 
&paynow=on
&payfrom=account $ACCOUNT_ID 
&sok=ok
&authinfo= $LOGIN : $PASSWORD 
&countdomain=1
&out=json

Query Variables:

  • $CONTACT_ID - Domain contact ID
  • $DOMAIN_NAME_WITHOUT_TLD - Domain name, without domain zone (example “thehost” for the domain “thehost.ua”
  • $NSLIST - List of name servers, separated by a space (example &nslist_0=ns1.thehost.ua ns2.thehost.net)
  • $PRICE_PERIOD_ID and $PRICE_ID - Tariff period and tariff plan for the registered domain. A complete list of tariff plan identifiers is available at link.
  • $TLD - Domain zone name (example “com.ua”, “com”)
  • $REGISTRAR_ID - Handler code for the corresponding domain zone. A complete list of processing codes for domain zones is available at link.
  • $ACCOUNT_ID - Your payer’s code in your personal account for generating debits for paid operations with domain names. You can view it in your TheHost personal account or via API:
https:// $API_URL /manager/billmgr?func=accountinfo&authinfo= $LOGIN : $PASSWORD &out=json

Domain name renewal operation

HTTP Request:
https:// $API_URL ?func=domain.renew
&autoperiod= $PRICE_PERIOD 
&payfrom=account $ACCOUNT_ID 
&paynow=on
&elid= $DOMAIN_ID 
&sok=ok
&authinfo= $LOGIN : $PASSWORD
&out=json