Domain Reseller API Reference

Programmatically manage domains with our comprehensive reseller API

Introduction

The Domains Reseller API allows you to connect and interact with our system using your own system. Using the API, you are able to perform actions such as:

  • Register a domain under your account
  • Transfer a domain from another company to your account
  • Renew a domain under your account
  • Release a domain that has a registrar lock for a domain registered under your account
  • Modify Contact Details of a domain registered under your account
  • Get the EPP Code of a domain registered under your account
  • Get/Save DNS Records of a domain under your account
  • Get, Modify or delete the Nameservers of a domain under your account
  • Enable or disable the registrar lock of a domain
  • Get/Save Email Forwarding
  • ID Protection
  • Domain Cron Synchronization

In requests, Domains Reseller accepts query parameters and the API response is sent in JSON data format.

Endpoint

Base URL
https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php

Authentication

The Domain Reseller API uses a custom authentication method with username and token:

ParameterDescription
UsernameThis is the email address of your client account with us
TokenToken is an API Key transformed into SHA256 hash using your email address and the current time encoded with base64

Getting Your API Key

To obtain your API credentials, follow these steps:

1

Access Your Reseller Area

Log into your Hostraha client area and navigate to:

DomainsReseller Area
2

Go to Settings Section

In the Reseller Area, click on the Settings tab to access your API credentials.

3

Copy Your Credentials

You'll find your API details including:

  • Username: Your reseller account email address
  • API Key: Your unique API key for authentication
  • Endpoint URL: The API endpoint for making requests
Need Help? If you don't have access to the Reseller Area or need to activate reseller privileges, please contact our support team or check theReseller Area Guide for detailed instructions.

Token Generation Formula

Token Generation
base64_encode(hash_hmac("sha256", "<api-key>", "<email>:<gmdate("y-m-d H")>"))

Sample Request

Here's a complete example of how to make a request to renew a domain using PHP:

PHP Example - Domain Renewal
<?php
$endpoint   = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php";
$action     = "/order/domains/renew";
$params     = [
    "domain"    => "example.com",
    "regperiod" => "3",
    "addons"    => [
        "dnsmanagement"     => 0,
        "emailforwarding"   => 1,
        "idprotection"      => 1,
    ]
];
$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);

echo $response;
?>

JavaScript/Node.js Example

JavaScript Example
const crypto = require('crypto');

// Function to generate token
function generateToken(apiKey, email) {
    const currentTime = new Date().toISOString().slice(0, 13).replace(/[-T]/g, '-').replace(':', ' ');
    const data = `${email}:${currentTime}`;
    const hash = crypto.createHmac('sha256', apiKey).update(data).digest('base64');
    return hash;
}

// API request function
async function renewDomain(email, apiKey, domain, regperiod = 1) {
    const endpoint = 'https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php';
    const action = '/order/domains/renew';
    
    const params = new URLSearchParams({
        domain: domain,
        regperiod: regperiod.toString(),
        'addons[dnsmanagement]': '0',
        'addons[emailforwarding]': '1',
        'addons[idprotection]': '1'
    });
    
    const token = generateToken(apiKey, email);
    
    try {
        const response = await fetch(`${endpoint}${action}`, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
                'username': email,
                'token': token
            },
            body: params.toString()
        });
        
        const result = await response.json();
        return result;
    } catch (error) {
        console.error('Error renewing domain:', error);
        throw error;
    }
}

// Usage example
renewDomain('email@example.com', 'YOUR_API_KEY', 'example.com', 3)
    .then(result => console.log('Domain renewal result:', result))
    .catch(error => console.error('Error:', error));

Python Example

Python Example
import requests
import hashlib
import hmac
import base64
from datetime import datetime

def generate_token(api_key, email):
    """Generate authentication token for Domain Reseller API"""
    current_time = datetime.utcnow().strftime('%y-%m-%d %H')
    data = f"{email}:{current_time}"
    
    # Create HMAC-SHA256 hash
    signature = hmac.new(
        api_key.encode('utf-8'),
        data.encode('utf-8'),
        hashlib.sha256
    ).digest()
    
    # Encode to base64
    token = base64.b64encode(signature).decode('utf-8')
    return token

def renew_domain(email, api_key, domain, regperiod=1):
    """Renew a domain using the Domain Reseller API"""
    endpoint = "https://portal.hostraha.com/modules/addons/DomainsReseller/api/index.php"
    action = "/order/domains/renew"
    
    # Generate authentication token
    token = generate_token(api_key, email)
    
    # Prepare request data
    data = {
        'domain': domain,
        'regperiod': str(regperiod),
        'addons[dnsmanagement]': '0',
        'addons[emailforwarding]': '1',
        'addons[idprotection]': '1'
    }
    
    headers = {
        'username': email,
        'token': token,
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    
    try:
        response = requests.post(f"{endpoint}{action}", data=data, headers=headers)
        response.raise_for_status()
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Error renewing domain: {e}")
        raise

# Usage example
if __name__ == "__main__":
    email = "email@example.com"
    api_key = "YOUR_API_KEY"
    domain = "example.com"
    
    try:
        result = renew_domain(email, api_key, domain, regperiod=3)
        print("Domain renewal result:", result)
    except Exception as e:
        print("Error:", e)

Available API Actions

The Domain Reseller API supports various actions for domain management. Each action is accessed by appending the action path to the base endpoint.

Domain Registration

POST
/order/domains/register
Register a new domain

Domain Transfer

POST
/order/domains/transfer
Transfer a domain from another registrar

Domain Renewal

POST
/order/domains/renew
Renew an existing domain
POST
/domains/release
Release a domain with registrar lock
POST
/domains/contacts/update
Modify contact details of a domain
GET
/domains/epp-code
Get the EPP code of a domain

DNS Management

GET
/domains/dns/records
Get DNS records of a domain
POST
/domains/dns/records
Save DNS records of a domain

Nameserver Management

GET
/domains/nameservers
Get nameservers of a domain
POST
/domains/nameservers
Modify nameservers of a domain
DELETE
/domains/nameservers
Delete nameservers of a domain

Domain Protection & Services

POST
/domains/registrar-lock
Enable or disable registrar lock
GET
/domains/email-forwarding
Get email forwarding settings
POST
/domains/email-forwarding
Save email forwarding settings
POST
/domains/id-protection
Manage ID protection for a domain
POST
/domains/sync
Domain cron synchronization
Documentation: For a complete list of all available API actions and their parameters, please contact our support team or visit the detailed API reference documentation.

Ready to Integrate Domain Management?

Contact our team to get your API credentials and start building with our Domain Reseller API