Get a domain serving a Hostinger website over HTTPS. The one rule that matters most: records that already work — email (MX), SPF, DKIM and verification TXT records — must survive every DNS change.
Calling the operations
- Read the
inputSchemathatsearchreturns before the first call of each operation. If a name below is rejected as unknown,searchfor what the step does (e.g. "dns records"). - Batch reads with
multi-execute; values pass between steps as$steps.<i>.<path>. Batches chain operations from one server only — the Hostinger Connector runshosting,agency-hosting,domainsanddnsas separate servers. Whensearchcannot find an operation, ask the user to enable that product group in the Connector. - Every write here changes what the public sees. State the change and get a yes before each one.
1. Gather the facts (read-only)
- Website.
hosting_websites_listwithdomain(Shared and Cloud; substring match, so take the exact entry) andagency-hosting_websites_list-planwithdomain(Agency). Keepusernameandorder_id, ordetails.uidanddetails.ipv4. When the domain has no website yet, find the site the user means — often a*.hostingersite.comone — or the order to create it on (hosting_orders_list,agency-hosting_orders_list). - Registration.
domains_portfolio_getsucceeds only for domains registered at Hostinger; itsname_serversshow who runs DNS. Hostinger's own nameservers end indns-parking.com. - Live DNS, to know what must be kept:
dig +short NS DOMAIN; dig +short A DOMAIN; dig +short CNAME www.DOMAIN
dig +short MX DOMAIN; dig +short TXT DOMAIN; dig +short CAA DOMAIN
2. Attach the domain to hosting
Shared and Cloud:
- New website on the domain. For a domain outside this account run
hosting_domains_verify-ownershipfirst. Whenis_accessibleis false, give the user theTXTrecord it returns to add next to the existing ones, then verify again (propagation takes up to ~10 minutes). Create withhosting_websites_create(domainwithoutwww.,order_id), then pollhosting_websites_list-setupswithdomainevery 10–15 s untilstatus: completed. - Moving a site off its free subdomain. Shared and Cloud websites cannot be renamed through the API. Either create a website on the real domain and redeploy the project there (the
deploy-to-hostingskill) — required for WordPress, which keeps its URL in the database — or, for static sites, park the domain on the existing site withhosting_domains_create-website-parked. - Alias (a second domain showing the same site):
hosting_domains_create-website-parked. - Subdomain (
shop.example.com):hosting_domains_create-website-subdomain.wwwbelongs to the main domain — do not create it as a subdomain.
Agency Plan:
agency-hosting_domains_link-to-websiteadds a domain to the site.agency-hosting_domains_change-websitereplaces the primary domain, for example the free subdomain. The old name stops serving at once — confirm first.
3. Point DNS at Hostinger
DNS already at Hostinger (nameservers end in dns-parking.com): creating the website normally writes the records. Read the zone with dns_records_list; when @ and www already point at the site, change nothing. Before any edit, note the newest dns_snapshots_list entry — dns_snapshots_restore rolls back to it.
dns_records_update defaults to overwrite: true, which deletes every existing record with the same name and type. Adding a TXT at @ that way wipes SPF and verification records. Send overwrite: false when adding; use true only to replace one record set on purpose, and run dns_records_validate on the same payload first.
DNS elsewhere (registered at Hostinger with other nameservers, or registered elsewhere). Two options — let the user choose:
- Switch nameservers to Hostinger. Hostinger then manages every record. First copy each record the current DNS serves beyond the website —
MX,TXT, serviceCNAMEs — into the Hostinger zone withdns_records_update(overwrite: false); otherwise email breaks when the nameservers flip. Hostinger's nameserver pairs differ between domains (ns1/ns2.dns-parking.com,solar/lunar.dns-parking.comand others), so use the pair hPanel shows for this domain, never a guessed one. For Hostinger-registered domains apply it withdomains_portfolio_update-nameservers; otherwise the user changes it at their registrar. - Keep the current DNS provider and change only the web records:
Afor@andCNAME(orA) forwww. Agency sites point atdetails.ipv4. Shared and Cloud sites point at the targets in the Hostinger zone for the domain (dns_records_list) or, when that zone does not exist, the IP hPanel shows for the website. The user makes this change at their DNS provider.
4. SSL and HTTPS
Start only once dig shows the domain resolving to Hostinger — the certificate authority checks the domain against the server.
- Shared and Cloud:
hosting_ssl_status. When it is notactive, callhosting_ssl_installand poll the status untilactive(orfailedwithlast_error), thenhosting_ssl_toggle-https-redirectwithis_enabled: true(it returns 422 until a certificate exists). - Agency:
agency-hosting_ssl_install-websitefor each domain, then pollagency-hosting_ssl_website-status. A domain allows three setups per seven days and one request a minute — install once DNS is right and never loop. - A
CAArecord at the apex that does not allowletsencrypt.orgblocks issuance; the user adds0 issue "letsencrypt.org"beside the existing ones.
5. Verify
dig +short A DOMAIN; dig +short A www.DOMAIN
curl -sSI https://DOMAIN/ | grep -i -E "^(HTTP|platform|location)"
curl -sSI http://DOMAIN/ | grep -i -E "^(HTTP|location)"
dig +short MX DOMAIN
Done when both names resolve to Hostinger, HTTPS answers with platform: hostinger, HTTP redirects to HTTPS, and MX still matches step 1. Nameserver changes can take up to 24–48 hours to reach every resolver; when records are still old, report what is pending and the command to re-check instead of polling for hours.