Skip to content

Latest commit

 

History

History
572 lines (377 loc) · 21.7 KB

File metadata and controls

572 lines (377 loc) · 21.7 KB

Hostinger\DomainsPortfolioApi

All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.

Method HTTP request Description
claimFreeDomainV1() POST /api/domains/v1/portfolio/claim Claim free domain
completeDomainSetupV1() POST /api/domains/v1/portfolio/{domain}/setup Complete domain setup
disableDomainLockV1() DELETE /api/domains/v1/portfolio/{domain}/domain-lock Disable domain lock
disablePrivacyProtectionV1() DELETE /api/domains/v1/portfolio/{domain}/privacy-protection Disable privacy protection
enableDomainLockV1() PUT /api/domains/v1/portfolio/{domain}/domain-lock Enable domain lock
enablePrivacyProtectionV1() PUT /api/domains/v1/portfolio/{domain}/privacy-protection Enable privacy protection
getDomainAuthorizationCodeV1() GET /api/domains/v1/portfolio/{domain}/auth-code Get domain authorization code
getDomainDetailsV1() GET /api/domains/v1/portfolio/{domain} Get domain details
getDomainListV1() GET /api/domains/v1/portfolio Get domain list
getDomainRenewalInformationV1() GET /api/domains/v1/portfolio/{domain}/renewal Get domain renewal information
purchaseNewDomainV1() POST /api/domains/v1/portfolio Purchase new domain
updateDomainNameserversV1() PUT /api/domains/v1/portfolio/{domain}/nameservers Update domain nameservers

claimFreeDomainV1()

claimFreeDomainV1($domainsV1PortfolioClaimRequest): \Hostinger\Model\DomainsV1PortfolioClaimResource

Claim free domain

Claim a free domain available on your account and register it. Unlike purchasing a domain, this consumes a free domain you already have, so no payment method is required. A successful response means the domain is registered. If registration fails, login to hPanel and check domain registration status. If no WHOIS information is provided, default contact information for that TLD will be used. Before making request, ensure WHOIS information for desired TLD exists in your account. Some TLDs require additional_details to be provided and these will be validated before claiming. Requests which cannot be fulfilled are rejected with an error code in the response body, for example 2037 when no free domain is available. Use this endpoint to register a domain using a free domain from your account.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domainsV1PortfolioClaimRequest = new \Hostinger\Model\DomainsV1PortfolioClaimRequest(); // \Hostinger\Model\DomainsV1PortfolioClaimRequest

try {
    $result = $apiInstance->claimFreeDomainV1($domainsV1PortfolioClaimRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->claimFreeDomainV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domainsV1PortfolioClaimRequest \Hostinger\Model\DomainsV1PortfolioClaimRequest

Return type

\Hostinger\Model\DomainsV1PortfolioClaimResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

completeDomainSetupV1()

completeDomainSetupV1($domain, $domainsV1PortfolioSetupRequest): \Hostinger\Model\CommonSuccessEmptyResource

Complete domain setup

Register a domain you have already paid for but which has not been set up yet. Use this endpoint when an order completed without registering the domain, for example when Purchase new domain returned 202 Accepted and the domain was added to your account without being registered, or when an earlier setup attempt failed. No new order is placed and no payment is taken: the subscription you already own is used, for the period you already paid for. A domain is left awaiting setup when the details needed to register it were missing or invalid as the order completed. Domains ordered elsewhere can be awaiting setup for the same reason. Complete the missing information, then call this endpoint. If the order itself has not completed yet, the domain is not on your account, wait until it appears in Get domain list. If domain_contacts is omitted, the default WHOIS profile of that TLD is used for all four roles. The profile must exist and be complete for the TLD, an incomplete profile is the most common reason a domain is left awaiting setup. Create one with Create WHOIS profile. Some TLDs require additional_details. These are validated before setup, so a missing or invalid value is rejected without any registration being attempted. The domain is set up with the default nameservers and without privacy protection. Use Update domain nameservers and Enable privacy protection afterwards to change either. A successful response means the setup request was accepted, not that the domain is already registered. Poll Get domain list for the outcome, the domain appears in Get domain details only once it is registered. Use this endpoint to finish registering a domain that is awaiting setup on your account.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$domainsV1PortfolioSetupRequest = new \Hostinger\Model\DomainsV1PortfolioSetupRequest(); // \Hostinger\Model\DomainsV1PortfolioSetupRequest

try {
    $result = $apiInstance->completeDomainSetupV1($domain, $domainsV1PortfolioSetupRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->completeDomainSetupV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name
domainsV1PortfolioSetupRequest \Hostinger\Model\DomainsV1PortfolioSetupRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disableDomainLockV1()

disableDomainLockV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Disable domain lock

Disable domain lock for the domain. Domain lock needs to be disabled before transferring the domain to another registrar. Use this endpoint to prepare domains for transfer to other registrars.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->disableDomainLockV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->disableDomainLockV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disablePrivacyProtectionV1()

disablePrivacyProtectionV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Disable privacy protection

Disable privacy protection for the domain. When privacy protection is disabled, domain owner's personal information is visible in public WHOIS database. Use this endpoint to make domain owner's information publicly visible.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->disablePrivacyProtectionV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->disablePrivacyProtectionV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enableDomainLockV1()

enableDomainLockV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Enable domain lock

Enable domain lock for the domain. When domain lock is enabled, the domain cannot be transferred to another registrar without first disabling the lock. Use this endpoint to secure domains against unauthorized transfers.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->enableDomainLockV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->enableDomainLockV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enablePrivacyProtectionV1()

enablePrivacyProtectionV1($domain): \Hostinger\Model\CommonSuccessEmptyResource

Enable privacy protection

Enable privacy protection for the domain. When privacy protection is enabled, domain owner's personal information is hidden from public WHOIS database. Use this endpoint to protect domain owner's personal information from public view.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->enablePrivacyProtectionV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->enablePrivacyProtectionV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainAuthorizationCodeV1()

getDomainAuthorizationCodeV1($domain): \Hostinger\Model\DomainsV1PortfolioAuthCodeAuthCodeResource

Get domain authorization code

Retrieve the authorization (EPP) code for a specified domain so it can be transferred away from Hostinger to another registrar. Requesting a new code invalidates any code retrieved previously. Use this endpoint to obtain the code required to transfer a domain to another registrar.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainAuthorizationCodeV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainAuthorizationCodeV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1PortfolioAuthCodeAuthCodeResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainDetailsV1()

getDomainDetailsV1($domain): \Hostinger\Model\DomainsV1DomainDomainExtendedResource

Get domain details

Retrieve detailed information for specified domain. Use this endpoint to view comprehensive domain configuration and status.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainDetailsV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainDetailsV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1DomainDomainExtendedResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainListV1()

getDomainListV1(): \Hostinger\Model\DomainsV1DomainDomainResource[]

Get domain list

Retrieve all domains associated with your account. Use this endpoint to view user's domain portfolio.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);

try {
    $result = $apiInstance->getDomainListV1();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainListV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Hostinger\Model\DomainsV1DomainDomainResource[]

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDomainRenewalInformationV1()

getDomainRenewalInformationV1($domain): \Hostinger\Model\DomainsV1PortfolioRenewalRenewalInformationResource

Get domain renewal information

Retrieve renewal information for a specified domain, including its status and current expiration date. Use this endpoint to build renewal automation and expiry monitoring for a single domain.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name

try {
    $result = $apiInstance->getDomainRenewalInformationV1($domain);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->getDomainRenewalInformationV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name

Return type

\Hostinger\Model\DomainsV1PortfolioRenewalRenewalInformationResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

purchaseNewDomainV1()

purchaseNewDomainV1($domainsV1PortfolioPurchaseRequest): \Hostinger\Model\BillingV1OrderOrderResource

Purchase new domain

Purchase and register a new domain name. If registration fails, login to hPanel and check domain registration status. If no payment method is provided, your default payment method will be used automatically. If the response is 202 Accepted, the payment is still being processed and the domain was not registered. Once the order completes, register the domain from hPanel. If no WHOIS information is provided, default contact information for that TLD will be used. Before making request, ensure WHOIS information for desired TLD exists in your account. Some TLDs require additional_details to be provided and these will be validated before completing purchase. Use this endpoint to register new domains for users.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domainsV1PortfolioPurchaseRequest = new \Hostinger\Model\DomainsV1PortfolioPurchaseRequest(); // \Hostinger\Model\DomainsV1PortfolioPurchaseRequest

try {
    $result = $apiInstance->purchaseNewDomainV1($domainsV1PortfolioPurchaseRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->purchaseNewDomainV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domainsV1PortfolioPurchaseRequest \Hostinger\Model\DomainsV1PortfolioPurchaseRequest

Return type

\Hostinger\Model\BillingV1OrderOrderResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateDomainNameserversV1()

updateDomainNameserversV1($domain, $domainsV1PortfolioUpdateNameserversRequest): \Hostinger\Model\CommonSuccessEmptyResource

Update domain nameservers

Set nameservers for a specified domain. Be aware, that improper nameserver configuration can lead to the domain being unresolvable or unavailable. Use this endpoint to configure custom DNS hosting for domains.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Hostinger\Api\DomainsPortfolioApi(config: $config);
$domain = mydomain.tld; // string | Domain name
$domainsV1PortfolioUpdateNameserversRequest = new \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest(); // \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest

try {
    $result = $apiInstance->updateDomainNameserversV1($domain, $domainsV1PortfolioUpdateNameserversRequest);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DomainsPortfolioApi->updateDomainNameserversV1: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
domain string Domain name
domainsV1PortfolioUpdateNameserversRequest \Hostinger\Model\DomainsV1PortfolioUpdateNameserversRequest

Return type

\Hostinger\Model\CommonSuccessEmptyResource

[Back to top] [Back to API list] [Back to Model list] [Back to README]