Get contact details
Return the current contact set for a domain.GET /domains/{domain}/contact
Parameters
text
required
The domain to read, for example
example.com.Request
API_KEY="your-api-key"
EMAIL="[email protected]"
ENDPOINT="https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
TS=$(date -u +"%y-%m-%d %H")
TOKEN=$(printf '%s' "$API_KEY" \
| openssl dgst -sha256 -hmac "$EMAIL:$TS" -hex \
| sed 's/^.*= //' | tr -d '\n' | base64 -w0)
curl -s "$ENDPOINT/domains/example.com/contact" \
-H "username: $EMAIL" \
-H "token: $TOKEN"
<?php
$apiKey = "your-api-key";
$email = "[email protected]";
$endpoint = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php";
$token = base64_encode(hash_hmac("sha256", $apiKey, "{$email}:" . gmdate("y-m-d H")));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "{$endpoint}/domains/example.com/contact");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
"username: {$email}",
"token: {$token}",
]);
echo curl_exec($curl);
curl_close($curl);
import base64, hashlib, hmac
from datetime import datetime, timezone
import requests
API_KEY = "your-api-key"
EMAIL = "[email protected]"
ENDPOINT = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
def token() -> str:
ts = datetime.now(timezone.utc).strftime("%y-%m-%d %H")
digest = hmac.new(f"{EMAIL}:{ts}".encode(), API_KEY.encode(), hashlib.sha256).hexdigest()
return base64.b64encode(digest.encode()).decode()
resp = requests.get(f"{ENDPOINT}/domains/example.com/contact",
headers={"username": EMAIL, "token": token()})
print(resp.json())
import crypto from "node:crypto";
const API_KEY = "your-api-key";
const EMAIL = "[email protected]";
const ENDPOINT = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php";
function token() {
const ts = new Date().toISOString().slice(2, 13).replace("T", " "); // "yy-mm-dd HH" UTC
const digest = crypto.createHmac("sha256", `${EMAIL}:${ts}`).update(API_KEY).digest("hex");
return Buffer.from(digest, "utf8").toString("base64");
}
const res = await fetch(`${ENDPOINT}/domains/example.com/contact`, {
headers: { username: EMAIL, token: token() },
});
console.log(await res.json());
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"net/http"
"time"
)
const (
apiKey = "your-api-key"
email = "[email protected]"
endpoint = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
)
func token() string {
ts := time.Now().UTC().Format("06-01-02 15") // yy-mm-dd HH
mac := hmac.New(sha256.New, []byte(email+":"+ts))
mac.Write([]byte(apiKey))
return base64.StdEncoding.EncodeToString([]byte(hex.EncodeToString(mac.Sum(nil))))
}
func main() {
req, _ := http.NewRequest("GET", endpoint+"/domains/example.com/contact", nil)
req.Header.Set("username", email)
req.Header.Set("token", token())
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Response
Once the domain is active, this returns the stored contact set. Before the domain is provisioned to your account, it returns an empty array:[]
Save contact details
Replace the contact set on a domain.POST /domains/{domain}/contact
Parameters
text
required
The domain to update, for example
example.com.object
required
The full contact set, keyed by role:
Registrant, Technical, Billing, and Admin. Each value is a Contact object.The save keys are capitalized (
Registrant, Technical, Billing, Admin) and differ from the lowercase contacts keys used when ordering (registrant, tech, billing, admin). See Models.contactdetails[Registrant][firstname]=Jane.
Request
curl -s "$ENDPOINT/domains/example.com/contact" \
-H "username: $EMAIL" \
-H "token: $TOKEN" \
--data "contactdetails[Registrant][firstname]=Jane" \
--data "contactdetails[Registrant][lastname]=Doe" \
--data "contactdetails[Registrant][fullname]=Jane Doe" \
--data "contactdetails[Registrant][companyname]=Hostraha" \
--data "contactdetails[Registrant][email][email protected]" \
--data "contactdetails[Registrant][address1]=123 Example Street" \
--data "contactdetails[Registrant][city]=Nairobi" \
--data "contactdetails[Registrant][state]=Nairobi" \
--data "contactdetails[Registrant][postcode]=00100" \
--data "contactdetails[Registrant][country]=KE" \
--data "contactdetails[Registrant][phonenumber]=+1.5555550100" \
--data "contactdetails[Technical][firstname]=Jane" \
--data "contactdetails[Technical][lastname]=Doe" \
--data "contactdetails[Technical][email][email protected]" \
--data "contactdetails[Billing][firstname]=Jane" \
--data "contactdetails[Billing][lastname]=Doe" \
--data "contactdetails[Billing][email][email protected]" \
--data "contactdetails[Admin][firstname]=Jane" \
--data "contactdetails[Admin][lastname]=Doe" \
--data "contactdetails[Admin][email][email protected]"
<?php
$apiKey = "your-api-key";
$email = "[email protected]";
$endpoint = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php";
$token = base64_encode(hash_hmac("sha256", $apiKey, "{$email}:" . gmdate("y-m-d H")));
$contact = [
"firstname" => "Jane",
"lastname" => "Doe",
"fullname" => "Jane Doe",
"companyname" => "Hostraha",
"email" => "[email protected]",
"address1" => "123 Example Street",
"city" => "Nairobi",
"state" => "Nairobi",
"postcode" => "00100",
"country" => "KE",
"phonenumber" => "+1.5555550100",
];
$fields = http_build_query([
"contactdetails" => [
"Registrant" => $contact,
"Technical" => $contact,
"Billing" => $contact,
"Admin" => $contact,
],
]);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "{$endpoint}/domains/example.com/contact");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, [
"username: {$email}",
"token: {$token}",
]);
echo curl_exec($curl);
curl_close($curl);
import base64, hashlib, hmac
from datetime import datetime, timezone
import requests
API_KEY = "your-api-key"
EMAIL = "[email protected]"
ENDPOINT = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
def token() -> str:
ts = datetime.now(timezone.utc).strftime("%y-%m-%d %H")
digest = hmac.new(f"{EMAIL}:{ts}".encode(), API_KEY.encode(), hashlib.sha256).hexdigest()
return base64.b64encode(digest.encode()).decode()
contact = {
"firstname": "Jane",
"lastname": "Doe",
"fullname": "Jane Doe",
"companyname": "Hostraha",
"email": "[email protected]",
"address1": "123 Example Street",
"city": "Nairobi",
"state": "Nairobi",
"postcode": "00100",
"country": "KE",
"phonenumber": "+1.5555550100",
}
data = {
f"contactdetails[{role}][{key}]": value
for role in ("Registrant", "Technical", "Billing", "Admin")
for key, value in contact.items()
}
resp = requests.post(f"{ENDPOINT}/domains/example.com/contact",
headers={"username": EMAIL, "token": token()},
data=data)
print(resp.json())
import crypto from "node:crypto";
const API_KEY = "your-api-key";
const EMAIL = "[email protected]";
const ENDPOINT = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php";
function token() {
const ts = new Date().toISOString().slice(2, 13).replace("T", " "); // "yy-mm-dd HH" UTC
const digest = crypto.createHmac("sha256", `${EMAIL}:${ts}`).update(API_KEY).digest("hex");
return Buffer.from(digest, "utf8").toString("base64");
}
const contact = {
firstname: "Jane",
lastname: "Doe",
fullname: "Jane Doe",
companyname: "Hostraha",
email: "[email protected]",
address1: "123 Example Street",
city: "Nairobi",
state: "Nairobi",
postcode: "00100",
country: "KE",
phonenumber: "+1.5555550100",
};
const body = new URLSearchParams();
for (const role of ["Registrant", "Technical", "Billing", "Admin"]) {
for (const [key, value] of Object.entries(contact)) {
body.append(`contactdetails[${role}][${key}]`, value);
}
}
const res = await fetch(`${ENDPOINT}/domains/example.com/contact`, {
method: "POST",
headers: { username: EMAIL, token: token() },
body,
});
console.log(await res.json());
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
)
const (
apiKey = "your-api-key"
email = "[email protected]"
endpoint = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
)
func token() string {
ts := time.Now().UTC().Format("06-01-02 15") // yy-mm-dd HH
mac := hmac.New(sha256.New, []byte(email+":"+ts))
mac.Write([]byte(apiKey))
return base64.StdEncoding.EncodeToString([]byte(hex.EncodeToString(mac.Sum(nil))))
}
func main() {
contact := map[string]string{
"firstname": "Jane",
"lastname": "Doe",
"fullname": "Jane Doe",
"companyname": "Hostraha",
"email": "[email protected]",
"address1": "123 Example Street",
"city": "Nairobi",
"state": "Nairobi",
"postcode": "00100",
"country": "KE",
"phonenumber": "+1.5555550100",
}
form := url.Values{}
for _, role := range []string{"Registrant", "Technical", "Billing", "Admin"} {
for key, value := range contact {
form.Set(fmt.Sprintf("contactdetails[%s][%s]", role, key), value)
}
}
req, _ := http.NewRequest("POST", endpoint+"/domains/example.com/contact", strings.NewReader(form.Encode()))
req.Header.Set("username", email)
req.Header.Set("token", token())
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Response
{"status":"success","message":"","success":"success"}
string
success when the contacts are saved.string
Mirrors
status; success on a successful save.string
Empty on success, or an error description on failure.