> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.go54.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Register domain

The register action is used to send a Register command to the registrar.

## Endpoint

**POST** - `/order/domains/register`

## Request Parameters

| Name         | Type  | Required? | Description                                                                            |
| ------------ | ----- | --------- | -------------------------------------------------------------------------------------- |
| domain       | text  | Yes       | Registration period                                                                    |
| domainfields | text  | No        | Additional domain fields. This can be left empty                                       |
| addons       | array | No        | Enables DNS management, email forwarding, and/or ID protection for this domain         |
| nameservers  | array | Yes       | Nameserver information. `ns1` and `ns2` are required. `ns3`, `ns4`, `ns5` are optional |
| contacts     | array | Yes       | Contact information for registrant, tech, billing, admin                               |

### Nameservers Structure

* **ns1**: text, # nameserver1
* **ns2**: text, # nameserver2
* **ns3**: text, # nameserver3
* **ns4**: text, # nameserver4
* **ns5**: text, # nameserver5

### Contacts Structure

#### Registrant

* **firstname**: text
* **lastname**: text
* **fullname**: text
* **companyname**: text
* **email**: text
* **address1**: text
* **address2**: text
* **city**: text
* **state**: text
* **zipcode**: text
* **country**: text
* **phonenumber**: text

#### Tech

* **firstname**: text
* **lastname**: text
* **fullname**: text
* **companyname**: text
* **email**: text
* **address1**: text
* **address2**: text
* **city**: text
* **state**: text
* **zipcode**: text
* **country**: text
* **phonenumber**: text

#### Billing

* **firstname**: text
* **lastname**: text
* **fullname**: text
* **companyname**: text
* **email**: text
* **address1**: text
* **address2**: text
* **city**: text
* **state**: text
* **zipcode**: text
* **country**: text
* **phonenumber**: text

#### Admin

* **firstname**: text
* **lastname**: text
* **fullname**: text
* **companyname**: text
* **email**: text
* **address1**: text
* **address2**: text
* **city**: text
* **state**: text
* **zipcode**: text
* **country**: text
* **phonenumber**: text

## Sample Register Domain Request

```php theme={null}
$endpoint = "https://www.whogohost.com/host/modules/addons/DomainsReseller/api/index.php";
$action = "/order/domains/register";
$params = [
    "domain" => "example.com",
    "regperiod" => "1",
    "nameservers" => [
        "ns1" => "nsa.whogohost.com",
        "ns2" => "nsb.whogohost.com",
    ],
    "contacts" => [
        "registrant" => [
            "firstname" => "example",
            "lastname" => "testing",
            "fullname" => "example testing",
            "companyname" => "textmachine",
            "email" => "exam@gmail.com",
            "address1" => "4 office",
            "address2" => "",
            "city" => "Lag",
            "state" => "Lagos",
            "zipcode" => "110001",
            "country" => "Nigeria",
            "phonenumber" => "+234.812345678"
        ],
        "tech" => [
            "firstname" => "example",
            "lastname" => "testing",
            "fullname" => "example testing",
            "companyname" => "textmachine",
            "email" => "exam@gmail.com",
            "address1" => "4 office",
            "address2" => "",
            "city" => "Lag",
            "state" => "Lagos",
            "zipcode" => "110001",
            "country" => "Nigeria",
            "phonenumber" => "+234.87546898"
        ],
        "billing" => [
            "firstname" => "example",
            "lastname" => "testing",
            "fullname" => "example testing",
            "companyname" => "textmachine",
            "email" => "exam@gmail.com",
            "address1" => "4 office",
            "address2" => "",
            "city" => "Lag",
            "state" => "Lagos",
            "zipcode" => "110001",
            "country" => "Nigeria",
            "phonenumber" => "+234.812345678"
        ],
        "admin" => [
            "firstname" => "example",
            "lastname" => "testing",
            "fullname" => "example testing",
            "companyname" => "textmachine",
            "email" => "exam@gmail.com",
            "address1" => "4 office",
            "address2" => "",
            "city" => "Lag",
            "state" => "Lagos",
            "zipcode" => "110001",
            "country" => "Nigeria",
            "phonenumber" => "+234.812345678"
        ],
    ]
];
$headers = [
    "username: email@example.com",
    "token: " . base64_encode(hash_hmac("sha256", "1234567890QWERTYUIOPASDFGHJKLZXCVBNM", "email@example.com:" . gmdate("y-m-d H")))
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "{$endpoint}{$action}");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
curl_close($curl);
```
