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 |
| list_websites_v1 | GET /api/hosting/v1/websites | List websites |
CommonSuccessEmptyResource create_website_v1(hosting_v1_websites_create_website_request)
Create website
Create a new website for the authenticated client.
Provide the domain name and associated order ID to create a new website. The datacenter_code parameter is required when creating the first website on a new hosting plan - this will set up and configure new hosting account in the selected datacenter.
Subsequent websites will be hosted on the same datacenter automatically.
Website creation takes up to a few minutes to complete. Check the websites list endpoint to see when your new website becomes available.
- 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 | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CommonSuccessEmptyResource delete_website_v1(domain, hosting_v1_websites_delete_website_request)
Delete website
Permanently deletes a website and all of its data. This action is destructive and cannot be undone. Always ask the user for explicit confirmation before calling this endpoint.
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.
The confirm field must be boolean true, otherwise the request is rejected.
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.models.hosting_v1_websites_delete_website_request import HostingV1WebsitesDeleteWebsiteRequest
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
hosting_v1_websites_delete_website_request = hostinger_api.HostingV1WebsitesDeleteWebsiteRequest() # HostingV1WebsitesDeleteWebsiteRequest |
try:
# Delete website
api_response = api_instance.delete_website_v1(domain, hosting_v1_websites_delete_website_request)
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 | |
| hosting_v1_websites_delete_website_request | HostingV1WebsitesDeleteWebsiteRequest |
- Content-Type: application/json
- 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]
HostingListWebsitesV1200Response list_websites_v1(page=page, per_page=per_page, username=username, order_id=order_id, is_enabled=is_enabled, domain=domain)
List websites
Retrieve a paginated list of websites (main and addon types) 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.
Use the available query parameters to filter results by username, order ID, enabled status, or domain name for more targeted results.
- 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 (exact match) (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)
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 (exact match) | [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]