All URIs are relative to https://developers.hostinger.com
| Method | HTTP request | Description |
|---|---|---|
| create_website_v1 | POST /api/hosting/v1/websites | Create website |
| delete_website_v1 | DELETE /api/hosting/v1/websites/{domain} | Delete website |
| deploy_static_site_archive_v1 | POST /api/hosting/v1/accounts/{username}/websites/{domain}/deploy | Deploy static site archive |
| generate_website_images_v1 | POST /api/hosting/v1/accounts/{username}/websites/{domain}/content/images/generate | Generate website images |
| get_website_image_generation_result_v1 | GET /api/hosting/v1/accounts/{username}/websites/{domain}/content/generations/{generation_id} | Get website image generation result |
| list_website_setups_v1 | GET /api/hosting/v1/onboardings | List website setups |
| list_websites_v1 | GET /api/hosting/v1/websites | List websites |
| start_website_setup_v1 | POST /api/hosting/v1/orders/{order_id}/onboardings | Start website setup |
CommonSuccessEmptyResource create_website_v1(hosting_v1_websites_create_website_request)
Create website
Deprecated: use POST /api/hosting/v1/orders/{order_id}/onboardings (start website setup)
instead. It takes the same domain and datacenter_code, can also install WordPress, and
returns the created setup.
Create a new website for the authenticated client.
You must choose which hosting order to create this website on. Pass that
order as order_id together with the domain name. List orders to see
available IDs; the website is provisioned on that order's hosting plan.
Only Web and Cloud hosting orders are accepted. To create a website on an Agency
Plan order, use POST /api/agency-hosting/v1/orders/{order_id}/websites/setups.
When the order has no hosting account yet, a new hosting account is set up first, in the
datacenter given by datacenter_code or the order's default datacenter when it is omitted.
Subsequent websites will be hosted on the same datacenter automatically.
Website creation is asynchronous and takes up to a few minutes. Poll the list website
setups endpoint with the domain filter every 10 to 15 seconds and wait for status: completed before uploading files, deploying or creating databases. While the setup is
running, endpoints that operate on the website may respond with 404 or 409.
is_enabled on the websites list reflects suspension, not readiness.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.models.hosting_v1_websites_create_website_request import HostingV1WebsitesCreateWebsiteRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
hosting_v1_websites_create_website_request = hostinger_api.HostingV1WebsitesCreateWebsiteRequest() # HostingV1WebsitesCreateWebsiteRequest |
try:
# Create website
api_response = api_instance.create_website_v1(hosting_v1_websites_create_website_request)
print("The response of HostingWebsitesApi->create_website_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->create_website_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| hosting_v1_websites_create_website_request | HostingV1WebsitesCreateWebsiteRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success empty response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 409 | Conflict response. `Retry-After`, when present, is the number of seconds to wait before retrying. | * Retry-After - Seconds to wait before retrying the request |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CommonSuccessEmptyResource delete_website_v1(domain)
Delete website
This endpoint permanently removes a website and all of its data. This action cannot be undone. Before calling it, make sure the user understands the consequences and explicitly confirms that they want to proceed.
All website files, databases and related configuration will be removed. The hosting plan itself is kept, so a new website can be created on it afterwards.
Supported websites: main and addon domain websites on web hosting plans, and Website Builder websites. Parked domains and subdomains cannot be deleted with this endpoint. The domain must be the exact website domain, not a preview domain or an alias.
Returns 404 when the domain does not exist or does not belong to the authenticated client.
Website removal is processed asynchronously and can take a few minutes to complete. The response returns before the removal finishes.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
domain = 'mydomain.tld' # str | Domain name
try:
# Delete website
api_response = api_instance.delete_website_v1(domain)
print("The response of HostingWebsitesApi->delete_website_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->delete_website_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| domain | str | Domain name |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success empty response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CommonSuccessEmptyResource deploy_static_site_archive_v1(username, domain, hosting_v1_websites_deploy_archive_request)
Deploy static site archive
Deploy a static application from an archive file.
WARNING: this overwrites the website's existing contents and cannot be undone — verify this is intended before calling this endpoint.
This endpoint allows you to deploy a static application from an archive file that has been uploaded to the website's directory.
This only works for static sites (pre-built HTML/CSS/JS with no build step). For
Node.js applications, use Create NodeJS build from archive instead, or
Start Node.js build if the archive is already uploaded. For WordPress sites,
use Import WordPress website.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.models.hosting_v1_websites_deploy_archive_request import HostingV1WebsitesDeployArchiveRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
username = 'u123456789' # str |
domain = 'mydomain.tld' # str | Domain name
hosting_v1_websites_deploy_archive_request = hostinger_api.HostingV1WebsitesDeployArchiveRequest() # HostingV1WebsitesDeployArchiveRequest |
try:
# Deploy static site archive
api_response = api_instance.deploy_static_site_archive_v1(username, domain, hosting_v1_websites_deploy_archive_request)
print("The response of HostingWebsitesApi->deploy_static_site_archive_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->deploy_static_site_archive_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| username | str | ||
| domain | str | Domain name | |
| hosting_v1_websites_deploy_archive_request | HostingV1WebsitesDeployArchiveRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
HostingV1ContentGenerationResource generate_website_images_v1(username, domain, hosting_v1_content_generate_images_request)
Generate website images
Start generating one or more images from a prompt and an image type with the Hostinger AI image generator, for any website of the hosting account, whatever its type. WordPress does not need to be installed on the website. Use it to get original images for a website you are building.
The generation runs asynchronously: the response is returned right away with
status: in-progress and a generation_id. Poll
GET /api/hosting/v1/accounts/{username}/websites/{domain}/content/generations/{generation_id}
every few seconds until status is completed or failed.
A completed generation returns temporary image URLs together with the time they expire;
download the images before then. Images are returned at exactly the requested size.
Logos are transparent images cropped to the mark and ignore the requested size. The
result gives the real width and height of each image.
Only one image generation can run per website at a time. A request sent while one is
running returns 409 and starts nothing. The 409 does not include the ID of the running
generation: if you have its generation_id, keep polling it; if you do not, wait for it
to finish (up to a few minutes) and then send the request again. Do not retry a 409 right
away. To get several images of the same kind, set num_of_images instead of sending
several requests.
Starting a generation is limited to 10 requests per minute; above that the endpoint returns 429. Polling the result does not count towards this limit.
Provide the hosting account username and the website domain in the path. Both can be
obtained from GET /api/hosting/v1/websites (the username and domain fields). A domain
that is not a website of that account returns 404.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.hosting_v1_content_generate_images_request import HostingV1ContentGenerateImagesRequest
from hostinger_api.models.hosting_v1_content_generation_resource import HostingV1ContentGenerationResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
username = 'u123456789' # str |
domain = 'mydomain.tld' # str | Domain name
hosting_v1_content_generate_images_request = hostinger_api.HostingV1ContentGenerateImagesRequest() # HostingV1ContentGenerateImagesRequest |
try:
# Generate website images
api_response = api_instance.generate_website_images_v1(username, domain, hosting_v1_content_generate_images_request)
print("The response of HostingWebsitesApi->generate_website_images_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->generate_website_images_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| username | str | ||
| domain | str | Domain name | |
| hosting_v1_content_generate_images_request | HostingV1ContentGenerateImagesRequest |
HostingV1ContentGenerationResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 202 | Accepted response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 404 | Error response | - |
| 409 | Conflict response. `Retry-After`, when present, is the number of seconds to wait before retrying. | * Retry-After - Seconds to wait before retrying the request |
| 429 | Error response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
HostingV1ContentGenerationResource get_website_image_generation_result_v1(username, domain, generation_id)
Get website image generation result
Get the state and result of an AI image generation started for a website of the hosting account with POST /api/hosting/v1/accounts/{username}/websites/{domain}/content/images/generate. It works for any website of the account, with or without WordPress.
While the generation is still running only status: in-progress is returned and result
is null; poll every few seconds. Once completed, result holds temporary image URLs
together with the time they expire, so download the images before then. Each image comes
with its real width and height; only a logo's differ from the requested size. A failed
generation has no result; start a new one. Unknown or expired generation IDs return
404: a result is kept for about 10 minutes after the generation finishes. Polling is not
subject to the 10 requests per minute limit of starting a generation.
Use the same hosting account username and website domain the generation was started with.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.hosting_v1_content_generation_resource import HostingV1ContentGenerationResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
username = 'u123456789' # str |
domain = 'mydomain.tld' # str | Domain name
generation_id = '9d4f8a1e-2b3c-4d5e-8f6a-7b8c9d0e1f2a' # str | Generation ID returned when the generation was started
try:
# Get website image generation result
api_response = api_instance.get_website_image_generation_result_v1(username, domain, generation_id)
print("The response of HostingWebsitesApi->get_website_image_generation_result_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->get_website_image_generation_result_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| username | str | ||
| domain | str | Domain name | |
| generation_id | str | Generation ID returned when the generation was started |
HostingV1ContentGenerationResource
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 404 | Error response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List[HostingV1OnboardingsOnboardingResource] list_website_setups_v1(order_id=order_id, subscription_id=subscription_id, domain=domain)
List website setups
Returns the website setups started in the last 24 hours for the hosting accounts
accessible to the authenticated client, newest first. Narrow the list with the
order_id, subscription_id or domain filters.
Meant for polling right after creating a website or starting a website setup: the
website shows up in the websites list before its server-side setup has finished, and
while the setup is running endpoints that operate on that website may respond with
404 or 409. Poll this endpoint with the domain filter every 10 to 15 seconds and
wait for status: completed before uploading files, deploying or creating databases.
failed means the setup stopped before finishing or has not reported progress for
over an hour, and error.message then explains why when the reason is known (null
otherwise). Setups older than 24 hours are not listed.
type is the website type the setup was started with (wordpress, headless_empty,
headless_wordpress, headless_ecommerce, headless_pocketbase), or null for an empty
website.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.hosting_v1_onboardings_onboarding_resource import HostingV1OnboardingsOnboardingResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
order_id = 123 # int | Order ID (optional)
subscription_id = 'sub_abc123' # str | Filter by hosting order subscription ID (optional)
domain = 'example.com' # str | Filter by domain name (exact match) (optional)
try:
# List website setups
api_response = api_instance.list_website_setups_v1(order_id=order_id, subscription_id=subscription_id, domain=domain)
print("The response of HostingWebsitesApi->list_website_setups_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->list_website_setups_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| order_id | int | Order ID | [optional] |
| subscription_id | str | Filter by hosting order subscription ID | [optional] |
| domain | str | Filter by domain name (exact match) | [optional] |
List[HostingV1OnboardingsOnboardingResource]
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
HostingListWebsitesV1200Response list_websites_v1(page=page, per_page=per_page, username=username, order_id=order_id, is_enabled=is_enabled, domain=domain, website_types=website_types)
List websites
Retrieve a paginated list of websites (CloudLinux, Builder, and Horizons) accessible to the authenticated client.
This endpoint returns websites from your hosting accounts as well as websites from other client hosting accounts that have shared access with you.
Each website includes a website_type field describing the type of
website detected on the underlying platform (wordpress, builder,
horizons, nodejs, or other). Some fields, such as
vhost_type, username, and root_directory, only apply to
CloudLinux websites and are null for other platforms.
Use website_types to list only websites of a given detected type, e.g. only
WordPress websites (website_types=wordpress) or only Node.js websites
(website_types=nodejs). Combine with the other available query parameters to
filter by username, order ID, enabled status, or domain name for more targeted
results.
A website appears in this list before its server-side setup has finished, and
is_enabled reflects suspension, not readiness. To know when a newly created website
is ready for file, deploy or database operations, poll the list website setups
endpoint instead.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.hosting_list_websites_v1200_response import HostingListWebsitesV1200Response
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
page = 1 # int | Page number (optional)
per_page = 25 # int | Number of items per page (optional) (default to 25)
username = 'cl_user123' # str | Filter by specific username (optional)
order_id = 123 # int | Order ID (optional)
is_enabled = true # bool | Filter by enabled status (optional)
domain = 'example.com' # str | Filter by domain name (case-insensitive substring match) (optional)
website_types = ['[\"wordpress\",\"nodejs\"]'] # List[str] | Filter by detected website type, e.g. wordpress,nodejs. Accepts a comma-separated list. (optional)
try:
# List websites
api_response = api_instance.list_websites_v1(page=page, per_page=per_page, username=username, order_id=order_id, is_enabled=is_enabled, domain=domain, website_types=website_types)
print("The response of HostingWebsitesApi->list_websites_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->list_websites_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| page | int | Page number | [optional] |
| per_page | int | Number of items per page | [optional] [default to 25] |
| username | str | Filter by specific username | [optional] |
| order_id | int | Order ID | [optional] |
| is_enabled | bool | Filter by enabled status | [optional] |
| domain | str | Filter by domain name (case-insensitive substring match) | [optional] |
| website_types | List[str] | Filter by detected website type, e.g. wordpress,nodejs. Accepts a comma-separated list. | [optional] |
HostingListWebsitesV1200Response
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
HostingV1OnboardingsOnboardingResource start_website_setup_v1(order_id, hosting_v1_onboardings_start_onboarding_request)
Start website setup
Starts a website setup on a Web or Cloud hosting order and returns the created setup
right away; the website itself is provisioned asynchronously. Poll the list website
setups endpoint (hosting_websites_list-setups) with the domain filter every 10 to 15
seconds and wait for status: completed before uploading files, deploying or creating
databases.
Omit type for an empty website. type: wordpress installs WordPress in the website
root with the admin user, email and password from wordpress, the domain as the site
title, and en_US when wordpress.language is omitted. The headless types
(headless_empty, headless_wordpress, headless_ecommerce, headless_pocketbase)
create a headless website; headless_wordpress additionally installs WordPress into the
cms directory of the website root with generated credentials. headless_pocketbase
marks the website as a headless PocketBase website but installs nothing: create its
PocketBase backend with Create PocketBase backend
(POST /api/hosting/v1/accounts/{username}/websites/{domain}/pocketbase) once the setup
is completed. headless_empty installs nothing either: WordPress can be added later
through POST /api/hosting/v1/accounts/{username}/wordpress/installations
(wordpress_installations_install) with type: headless, or a PocketBase backend through
the same PocketBase endpoint.
Omit domain to set the website up on a generated temporary free subdomain; the created
setup returns it as domain. REST clients that need to know the free subdomain before the
call, so a timed-out call can be looked up and retried on the same domain, can generate
one through POST /api/hosting/v1/domains/free-subdomains and send it as domain. It is
accepted for 24 hours, only from the client that generated it.
When the order has no hosting account yet, the setup creates one first, in the datacenter
given by datacenter_code or the order's default datacenter when it is omitted.
Returns 404 when the order does not exist or is not accessible to the authenticated
client, and 409 with a Retry-After header while a setup for the same domain is still
running.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.hosting_v1_onboardings_onboarding_resource import HostingV1OnboardingsOnboardingResource
from hostinger_api.models.hosting_v1_onboardings_start_onboarding_request import HostingV1OnboardingsStartOnboardingRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.HostingWebsitesApi(api_client)
order_id = 12345 # int | Hosting order ID. List orders to find available IDs.
hosting_v1_onboardings_start_onboarding_request = hostinger_api.HostingV1OnboardingsStartOnboardingRequest() # HostingV1OnboardingsStartOnboardingRequest |
try:
# Start website setup
api_response = api_instance.start_website_setup_v1(order_id, hosting_v1_onboardings_start_onboarding_request)
print("The response of HostingWebsitesApi->start_website_setup_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HostingWebsitesApi->start_website_setup_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| order_id | int | Hosting order ID. List orders to find available IDs. | |
| hosting_v1_onboardings_start_onboarding_request | HostingV1OnboardingsStartOnboardingRequest |
HostingV1OnboardingsOnboardingResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Created response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 404 | Error response | - |
| 409 | Conflict response. `Retry-After`, when present, is the number of seconds to wait before retrying. | * Retry-After - Seconds to wait before retrying the request |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]