### Install Hostinger API SDK via Setuptools Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Installs the package using Setuptools. This method is an alternative to pip installation. ```sh python setup.py install --user ``` -------------------------------- ### Get VPS Post Install Scripts Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieves a paginated list of post-install scripts available for your account. Ensure your BEARER_TOKEN environment variable is set for authentication. ```python import hostinger_api from hostinger_api.models.vps_get_post_install_scripts_v1200_response import VPSGetPostInstallScriptsV1200Response from hostinger_api.rest import ApiException from pprint import pprint import os # 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.VPSPostInstallScriptsApi(api_client) page = 1 # int | Page number (optional) try: # Get post-install scripts api_response = api_instance.get_post_install_scripts_v1(page=page) print("The response of VPSPostInstallScriptsApi->get_post_install_scripts_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSPostInstallScriptsApi->get_post_install_scripts_v1: %s\n" % e) ``` -------------------------------- ### Setup Purchased Virtual Machine Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Completes the setup process for a newly purchased virtual machine. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/setup ### Description Setup purchased virtual machine ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/setup ### Parameters #### Path Parameters - **virtualMachineId** (string) - Required - The ID of the virtual machine to setup. ``` -------------------------------- ### Get Post Install Scripts Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieves a list of all post-install scripts associated with your account. ```APIDOC ## GET /api/vps/v1/post-install-scripts ### Description Get post-install scripts ### Method GET ### Endpoint /api/vps/v1/post-install-scripts ### Response #### Success Response (200) - **List[VPSV1PostInstallScriptPostInstallScriptResource]** - A list containing details of all post-install scripts. #### Response Example ```json { "example": "response body" } ``` ### Authorization [apiToken](../README.md#apiToken) ### HTTP request headers - **Accept**: application/json ### HTTP response details | Status code | Description | |-------------|-------------| | **200** | Success response | | **401** | Unauthenticated response | | **500** | Error response | ``` -------------------------------- ### Start Project Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSDockerManagerApi.md Starts a specified Docker project on the virtual machine. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/docker/{projectName}/start ### Description Start project ### Method POST ### Endpoint /api/v1/vps/virtual-machines/{virtualMachineId}/docker/{projectName}/start ### Parameters #### Path Parameters - **virtualMachineId** (integer) - Required - The ID of the virtual machine. - **projectName** (string) - Required - The name of the project to start. ``` -------------------------------- ### Get Post Install Script Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieves the details of a specific post-install script using its unique identifier. ```APIDOC ## GET /api/vps/v1/post-install-scripts/{postInstallScriptId} ### Description Get post-install script ### Method GET ### Endpoint /api/vps/v1/post-install-scripts/{postInstallScriptId} ### Parameters #### Path Parameters - **postInstallScriptId** (integer) - Required - The ID of the post-install script to retrieve. ### Response #### Success Response (200) - **VPSV1PostInstallScriptPostInstallScriptResource** - Description of the retrieved post-install script details. #### Response Example ```json { "example": "response body" } ``` ### Authorization [apiToken](../README.md#apiToken) ### HTTP request headers - **Accept**: application/json ### HTTP response details | Status code | Description | |-------------|-------------| | **200** | Success response | | **401** | Unauthenticated response | | **404** | Not Found response | | **500** | Error response | ``` -------------------------------- ### Start Virtual Machine Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Starts a virtual machine that is currently stopped. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/start ### Description Start virtual machine ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/start ### Parameters #### Path Parameters - **virtualMachineId** (string) - Required - The ID of the virtual machine to start. ``` -------------------------------- ### Create Post Install Script Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Creates a new post-install script for a VPS. This script will be saved and executed automatically after the VPS installation is complete. The output will be logged, and the maximum script size is 48KB. ```APIDOC ## POST /api/vps/v1/post-install-scripts ### Description Create post-install script Add a new post-install script to your account, which can then be used after virtual machine installation. The script contents will be saved to the file `/post_install` with executable attribute set and will be executed once virtual machine is installed. The output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB. Use this endpoint to create automation scripts for VPS setup tasks. ### Method POST ### Endpoint /api/vps/v1/post-install-scripts ### Parameters #### Request Body - **vpsv1_post_install_script_store_request** (VPSV1PostInstallScriptStoreRequest) - Required - Description of the request body ### Request Example ```python import hostinger_api from hostinger_api.models.vpsv1_post_install_script_post_install_script_resource import VPSV1PostInstallScriptPostInstallScriptResource from hostinger_api.models.vpsv1_post_install_script_store_request import VPSV1PostInstallScriptStoreRequest 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.VPSPostInstallScriptsApi(api_client) vpsv1_post_install_script_store_request = hostinger_api.VPSV1PostInstallScriptStoreRequest() # VPSV1PostInstallScriptStoreRequest | try: # Create post-install script api_response = api_instance.create_post_install_script_v1(vpsv1_post_install_script_store_request) print("The response of VPSPostInstallScriptsApi->create_post_install_script_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSPostInstallScriptsApi->create_post_install_script_v1: %s\n" % e) ``` ### Response #### Success Response (200) - **VPSV1PostInstallScriptPostInstallScriptResource** - Description of the success response #### Response Example ```json { "example": "response body" } ``` ### Authorization [apiToken](../README.md#apiToken) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | |-------------|-------------| | **200** | Success response | | **422** | Validation error response | | **401** | Unauthenticated response | | **500** | Error response | ``` -------------------------------- ### Get Post Install Scripts Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieves a list of post-install scripts associated with your account. This can be used to view available automation scripts for VPS deployment. ```APIDOC ## GET /v1/vps/post-install-scripts ### Description Retrieve post-install scripts associated with your account. Use this endpoint to view available automation scripts for VPS deployment. ### Method GET ### Endpoint /v1/vps/post-install-scripts ### Parameters #### Query Parameters - **page** (int) - Optional - Page number ### Response #### Success Response (200) - **VPSGetPostInstallScriptsV1200Response** - Success response #### Error Response - **401** - Unauthenticated response - **500** - Error response ``` -------------------------------- ### Archive Creation Example (Shell) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingNodeJSApi.md Example command to create a zip archive for Node.js deployment. It's crucial to exclude 'node_modules/' and any build output directories to stay within the 50MB limit and ensure the build process functions correctly. ```shell zip -r archive.zip . --exclude "node_modules/*" --exclude "dist/*" ``` -------------------------------- ### VPSDockerManagerApi - Start Project Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Starts a specific Docker project on a VPS. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/docker/{projectName}/start ### Description Start project ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/docker/{projectName}/start ``` -------------------------------- ### Create VPS Post Install Script V1 Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Use this endpoint to add a new post-install script to your account. The script will be saved and executed after the virtual machine is installed. Maximum script size is 48KB. ```python import hostinger_api from hostinger_api.models.vpsv1_post_install_script_post_install_script_resource import VPSV1PostInstallScriptPostInstallScriptResource from hostinger_api.models.vpsv1_post_install_script_store_request import VPSV1PostInstallScriptStoreRequest 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.VPSPostInstallScriptsApi(api_client) vpsv1_post_install_script_store_request = hostinger_api.VPSV1PostInstallScriptStoreRequest() # VPSV1PostInstallScriptStoreRequest | try: # Create post-install script api_response = api_instance.create_post_install_script_v1(vpsv1_post_install_script_store_request) print("The response of VPSPostInstallScriptsApi->create_post_install_script_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSPostInstallScriptsApi->create_post_install_script_v1: %s\n" % e) ``` -------------------------------- ### Install WordPress using Hostinger API Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingWordpressApi.md Use this Python code to install WordPress on an existing website. Ensure the website exists and check for existing WordPress installations before proceeding. The operation is asynchronous; poll for status updates. ```python import hostinger_api from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource from hostinger_api.models.hosting_v1_wordpress_install_wordpress_request import HostingV1WordpressInstallWordpressRequest 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.HostingWordpressApi(api_client) username = 'u123456789' # str | hosting_v1_wordpress_install_wordpress_request = hostinger_api.HostingV1WordpressInstallWordpressRequest() # HostingV1WordpressInstallWordpressRequest | try: # Install WordPress api_response = api_instance.install_word_press_v1(username, hosting_v1_wordpress_install_wordpress_request) print("The response of HostingWordpressApi->install_word_press_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling HostingWordpressApi->install_word_press_v1: %s\n" % e) ``` -------------------------------- ### Get VPS Post Install Script by ID Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieve a specific post-install script using its ID. Requires Bearer authentication. Ensure the BEARER_TOKEN environment variable is set. ```python import hostinger_api from hostinger_api.models.vpsv1_post_install_script_post_install_script_resource import VPSV1PostInstallScriptPostInstallScriptResource from hostinger_api.rest import ApiException from pprint import pprint import os # 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.VPSPostInstallScriptsApi(api_client) post_install_script_id = 9568314 # int | Post-install script ID try: # Get post-install script api_response = api_instance.get_post_install_script_v1(post_install_script_id) print("The response of VPSPostInstallScriptsApi->get_post_install_script_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSPostInstallScriptsApi->get_post_install_script_v1: %s\n" % e) ``` -------------------------------- ### Install WordPress Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingWordpressApi.md Installs WordPress on an existing website. The website must exist prior to calling this endpoint. It is recommended to check if WordPress is already installed on the target domain/path before proceeding. This operation is asynchronous. ```APIDOC ## POST /api/hosting/v1/accounts/{username}/wordpress/installations ### Description Install WordPress on an existing website. The website must already exist before calling this endpoint. It is recommended to check if WordPress is already installed on the target domain/path before proceeding. This operation is asynchronous. ### Method POST ### Endpoint /api/hosting/v1/accounts/{username}/wordpress/installations ### Parameters #### Path Parameters - **username** (str) - Required - The username associated with the hosting account. #### Request Body - **hosting_v1_wordpress_install_wordpress_request** (HostingV1WordpressInstallWordpressRequest) - Required - The request body for installing WordPress. ### Response #### Success Response (200) - **CommonSuccessEmptyResource** - Indicates a successful queuing of the installation job. #### Error Response - **422** - Validation error response. - **401** - Unauthenticated response. - **500** - Error response. ``` -------------------------------- ### Get Post Install Script Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSPostInstallScriptsApi.md Retrieves a specific post-install script by its ID. Use this endpoint to view automation script details. ```APIDOC ## GET /vps/v1/post-install-scripts/{post_install_script_id} ### Description Retrieves a specific post-install script by its ID. Use this endpoint to view automation script details. ### Method GET ### Endpoint /vps/v1/post-install-scripts/{post_install_script_id} ### Parameters #### Path Parameters - **post_install_script_id** (int) - Required - The ID of the post-install script to retrieve. ### Request Example ```python import hostinger_api import os from hostinger_api.rest import ApiException from pprint import pprint configuration = hostinger_api.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with hostinger_api.ApiClient(configuration) as api_client: api_instance = hostinger_api.VPSPostInstallScriptsApi(api_client) post_install_script_id = 9568314 try: api_response = api_instance.get_post_install_script_v1(post_install_script_id) pprint(api_response) except ApiException as e: print("Exception when calling VPSPostInstallScriptsApi->get_post_install_script_v1: %s\n" % e) ``` ### Response #### Success Response (200) - **VPSV1PostInstallScriptPostInstallScriptResource** - Details of the post-install script. #### Response Example ```json { "id": 9568314, "name": "Example Script", "content": "echo \"Hello, World!\"", "type": "shell", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ### Authorization Bearer Token (apiToken) ``` -------------------------------- ### List WordPress Installations (Python) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingWordpressApi.md Use this endpoint to discover existing WordPress installations and to poll for installation status. Filter by username and domain to narrow results. Requires Bearer authentication. ```python import hostinger_api from hostinger_api.models.hosting_v1_wordpress_wordpress_installation_resource import HostingV1WordpressWordpressInstallationResource 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.HostingWordpressApi(api_client) username = 'cl_user123' # str | Filter by specific username (optional) domain = 'example.com' # str | Filter by domain name (exact match) (optional) ownership = 'owned' # str | Filter by ownership type. Defaults to "owned". Use "all" to include both owned and managed installations. (optional) try: # List WordPress installations api_response = api_instance.list_word_press_installations_v1(username=username, domain=domain, ownership=ownership) print("The response of HostingWordpressApi->list_word_press_installations_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling HostingWordpressApi->list_word_press_installations_v1: %s\n" % e) ``` -------------------------------- ### Install Hostinger API Python SDK via pip Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Installs the hostinger_api package using pip. Ensure your virtual environment is activated before running this command. ```sh pip install hostinger_api ``` -------------------------------- ### start_virtual_machine_v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Starts a specified virtual machine. This operation uses a POST request. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/start ### Description Start virtual machine ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/start ``` -------------------------------- ### Install Monarx Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSMalwareScannerApi.md Installs the Monarx malware scanner on a specified virtual machine. This action initiates the installation process for the security scanner. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/monarx ### Description Install Monarx malware scanner on a specified virtual machine. ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/monarx ### Parameters #### Path Parameters - **virtualMachineId** (int) - Required - The ID of the virtual machine. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **Success Response** - Indicates successful installation. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Install Monarx on VPS Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSMalwareScannerApi.md Use this endpoint to enable malware protection on VPS instances by installing Monarx. Requires Bearer authentication. ```python import hostinger_api from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource from hostinger_api.rest import ApiException from pprint import pprint import os # 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.VPSMalwareScannerApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID try: # Install Monarx api_response = api_instance.install_monarx_v1(virtual_machine_id) print("The response of VPSMalwareScannerApi->install_monarx_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSMalwareScannerApi->install_monarx_v1: %s\n" % e) ``` -------------------------------- ### start_project_v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSDockerManagerApi.md Starts all services in a Docker Compose project that are currently stopped. This operation brings up containers in the correct dependency order as defined in the compose file. Use this to resume a project that was previously stopped or to start services after a system reboot. ```APIDOC ## start_project_v1 ### Description Starts all services in a Docker Compose project that are currently stopped. This operation brings up containers in the correct dependency order as defined in the compose file. Use this to resume a project that was previously stopped or to start services after a system reboot. ### Method POST ### Endpoint /v1/vps/{virtual_machine_id}/docker/projects/{project_name}/start ### Parameters #### Path Parameters - **virtual_machine_id** (int) - Required - Virtual Machine ID - **project_name** (str) - Required - Docker Compose project name using alphanumeric characters, dashes, and underscores only ### Request Example ```python { "example": "request body" } ``` ### Response #### Success Response (200) - **VPSV1ActionActionResource** (object) - Success response #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### setup_purchased_virtual_machine_v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Sets up a newly purchased virtual machine. This is a POST request. ```APIDOC ## POST /api/vps/v1/virtual-machines/{virtualMachineId}/setup ### Description Setup purchased virtual machine ### Method POST ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/setup ``` -------------------------------- ### Setup Purchased Virtual Machine v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Use this endpoint to configure and initialize purchased VPS instances. Requires Bearer authentication. ```python import hostinger_api from hostinger_api.models.vpsv1_virtual_machine_setup_request import VPSV1VirtualMachineSetupRequest from hostinger_api.models.vpsv1_virtual_machine_virtual_machine_resource import VPSV1VirtualMachineVirtualMachineResource from hostinger_api.rest import ApiException from pprint import pprint import os # 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.VPSVirtualMachineApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID vpsv1_virtual_machine_setup_request = hostinger_api.VPSV1VirtualMachineSetupRequest() # VPSV1VirtualMachineSetupRequest | try: # Setup purchased virtual machine api_response = api_instance.setup_purchased_virtual_machine_v1(virtual_machine_id, vpsv1_virtual_machine_setup_request) print("The response of VPSVirtualMachineApi->setup_purchased_virtual_machine_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSVirtualMachineApi->setup_purchased_virtual_machine_v1: %s\n" % e) ``` -------------------------------- ### Get Scan Metrics Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSMalwareScannerApi.md Retrieves scan metrics for the Monarx malware scanner installed on a specified virtual machine. This is useful for monitoring security status and assessing scanner effectiveness. ```APIDOC ## GET /api/vps/v1/virtual-machines/{virtualMachineId}/monarx ### Description Get scan metrics for the Monarx malware scanner installed on a specified virtual machine. ### Method GET ### Endpoint /api/vps/v1/virtual-machines/{virtualMachineId}/monarx ### Parameters #### Path Parameters - **virtualMachineId** (int) - Required - The ID of the virtual machine. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **VPSV1MalwareMetricsResource** - Object containing scan metrics. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get WHOIS Profile Usage (Python) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/DomainsWHOISApi.md Retrieve a list of domains where a specific WHOIS contact profile is utilized. Requires Bearer token authentication. Ensure the `hostinger_api` library is installed and the BEARER_TOKEN environment variable is set. ```python import hostinger_api from hostinger_api.rest import ApiException from pprint import pprint import os # 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.DomainsWHOISApi(api_client) whois_id = 564651 # int | WHOIS ID try: # Get WHOIS profile usage api_response = api_instance.get_whois_profile_usage_v1(whois_id) print("The response of DomainsWHOISApi->get_whois_profile_usage_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling DomainsWHOISApi->get_whois_profile_usage_v1: %s\n" % e) ``` -------------------------------- ### Create Virtual Environment and Activate Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Sets up a new virtual environment for the project and activates it. This is an optional but recommended step for managing project dependencies. ```sh python3 -m venv venv source venv/bin/activate ``` -------------------------------- ### Get VPS Actions Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSActionsApi.md Retrieve actions performed on a specified virtual machine. Actions are operations or events that have been executed on the virtual machine, such as starting, stopping, or modifying the machine. This endpoint allows you to view the history of these actions, providing details about each action, such as the action name, timestamp, and status. ```APIDOC ## get_actions_v1 ### Description Retrieve actions performed on a specified virtual machine. ### Method GET ### Endpoint /vps/actions ### Parameters #### Query Parameters - **virtual_machine_id** (int) - Required - The ID of the virtual machine. - **page** (int) - Optional - The page number for pagination. ### Request Example ```python import hostinger_api import os from hostinger_api.models.vps_get_actions_v1200_response import VPSGetActionsV1200Response 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.VPSActionsApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID page = 1 # int | Page number (optional) try: # Get actions api_response = api_instance.get_actions_v1(virtual_machine_id, page=page) print("The response of VPSActionsApi->get_actions_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSActionsApi->get_actions_v1: %s\n" % e) ``` ### Response #### Success Response (200) - **VPSGetActionsV1200Response** - Details of the actions performed on the virtual machine. #### Response Example ```json { "actions": [ { "id": "action_id_1", "name": "start", "status": "completed", "timestamp": "2023-10-27T10:00:00Z" }, { "id": "action_id_2", "name": "stop", "status": "completed", "timestamp": "2023-10-27T10:05:00Z" } ], "pagination": { "current_page": 1, "total_pages": 5 } } ``` ``` -------------------------------- ### Purchase New Virtual Machine Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Allows users to purchase and set up a new virtual machine instance. If the automatic setup fails, manual completion via hPanel is required. The default payment method is used if none is specified. ```APIDOC ## POST /vps/v1/purchase ### Description Purchase and setup a new virtual machine. ### Method POST ### Endpoint /vps/v1/purchase ### Parameters #### Request Body - **vpsv1_virtual_machine_purchase_request** (VPSV1VirtualMachinePurchaseRequest) - Required - Details of the virtual machine to purchase. ### Request Example ```python import hostinger_api from hostinger_api.models.vpsv1_virtual_machine_purchase_request import VPSV1VirtualMachinePurchaseRequest # Assuming configuration and api_client are already set up vpsv1_virtual_machine_purchase_request = hostinger_api.VPSV1VirtualMachinePurchaseRequest() api_response = api_instance.purchase_new_virtual_machine_v1(vpsv1_virtual_machine_purchase_request) ``` ### Response #### Success Response (200) - **BillingV1OrderVirtualMachineOrderResource** - Details of the purchased virtual machine. #### Response Example ```json { "example": "BillingV1OrderVirtualMachineOrderResource object" } ``` ### Error Handling - **422**: Validation error response. - **401**: Unauthenticated response. - **500**: Server error response. ``` -------------------------------- ### Hosting WordPress API Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Endpoints for managing WordPress installations, including installing and listing installations. ```APIDOC ## POST /api/hosting/v1/accounts/{username}/wordpress/installations ### Description Install WordPress. ### Method POST ### Endpoint /api/hosting/v1/accounts/{username}/wordpress/installations ``` ```APIDOC ## GET /api/hosting/v1/wordpress/installations ### Description List WordPress installations. ### Method GET ### Endpoint /api/hosting/v1/wordpress/installations ``` -------------------------------- ### List WordPress Installations Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingWordpressApi.md Lists all WordPress installations accessible to the authenticated client. This can be used to discover existing installations or to poll for installation status. Filters can be applied by username, domain, and ownership type. ```APIDOC ## list_word_press_installations_v1 ### Description List WordPress installations accessible to the authenticated client. Use this endpoint to discover existing WordPress installations and to poll for installation status after calling the install endpoint. When a newly requested installation appears in this list, WordPress is ready. Filter by username and domain to narrow results to a specific website. Each installation includes a `valid` flag and, when invalid, a `validationError` describing why. ### Method GET ### Endpoint /v1/hosting/wordpress ### Parameters #### Query Parameters - **username** (str) - Optional - Filter by specific username - **domain** (str) - Optional - Filter by domain name (exact match) - **ownership** (str) - Optional - Filter by ownership type. Defaults to "owned". Use "all" to include both owned and managed installations. ### Response #### Success Response (200) - **List[HostingV1WordpressWordpressInstallationResource]** - A list of WordPress installation resources. ### Response Example ```json [ { "id": "123e4567-e89b-12d3-a456-426614174000", "username": "cl_user123", "domain": "example.com", "path": "/public_html", "valid": true, "validationError": null, "createdAt": "2023-01-01T12:00:00Z", "updatedAt": "2023-01-01T12:00:00Z" } ] ``` ### Authorization Bearer Authentication (apiToken) ``` -------------------------------- ### List WordPress Installations Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HostingWordpressApi.md Retrieves a list of all WordPress installations associated with a hosting account. This can be filtered by username and domain to check installation status and progress. ```APIDOC ## GET /api/hosting/v1/wordpress/installations ### Description List WordPress installations. This endpoint retrieves a list of WordPress installations. It can be filtered by username and domain to track installation progress or check existing installations. ### Method GET ### Endpoint /api/hosting/v1/wordpress/installations ### Parameters #### Query Parameters - **username** (str) - Optional - Filters installations by username. - **domain** (str) - Optional - Filters installations by domain. ### Response #### Success Response (200) - **List[WordPressInstallation]** - A list of WordPress installation objects. #### Error Response - **401** - Unauthenticated response. - **500** - Error response. ``` -------------------------------- ### Start Virtual Machine (Python) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Use this endpoint to power on stopped VPS instances. If the virtual machine is already running, the request will still be processed without any effect. Requires Bearer authentication. ```python import hostinger_api from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource 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.VPSVirtualMachineApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID try: # Start virtual machine api_response = api_instance.start_virtual_machine_v1(virtual_machine_id) print("The response of VPSVirtualMachineApi->start_virtual_machine_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSVirtualMachineApi->start_virtual_machine_v1: %s\n" % e) ``` -------------------------------- ### Create Physical Product using Hostinger SDK Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/EcommerceProductsApi.md Use this method to create a published physical product with a single variant. Ensure Bearer Authentication is configured with your API token. ```python import hostinger_api from hostinger_api.models.ecommerce_v1_product_create_physical_product_request import EcommerceV1ProductCreatePhysicalProductRequest from hostinger_api.models.ecommerce_v1_product_product_creation_resource import EcommerceV1ProductProductCreationResource from hostinger_api.rest import ApiException from pprint import pprint import os # 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.EcommerceProductsApi(api_client) store_id = 'store_01J8Z5F8W9K8M4A7B3C2D1E0FG' # str | The ID of the store to create the product in. ecommerce_v1_product_create_physical_product_request = hostinger_api.EcommerceV1ProductCreatePhysicalProductRequest() # EcommerceV1ProductCreatePhysicalProductRequest | try: # Create physical product api_response = api_instance.create_physical_product_v1(store_id, ecommerce_v1_product_create_physical_product_request) print("The response of EcommerceProductsApi->create_physical_product_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling EcommerceProductsApi->create_physical_product_v1: %s\n" % e) ``` -------------------------------- ### Get Available VPS OS Templates (Python) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSOSTemplatesApi.md Retrieve a list of all available OS templates for VPS instances. Requires Bearer authentication. ```python import hostinger_api from hostinger_api.models.vpsv1_template_template_resource import VPSV1TemplateTemplateResource 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.VPSOSTemplatesApi(api_client) try: # Get templates api_response = api_instance.get_templates_v1() print("The response of VPSOSTemplatesApi->get_templates_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSOSTemplatesApi->get_templates_v1: %s\n" % e) ``` -------------------------------- ### Create Website V1 - Python SDK Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/HorizonsWebsitesApi.md Use this method to create a new Hostinger Horizons website. It requires Bearer authentication and returns website details upon successful creation. The generation process is asynchronous. ```python import hostinger_api from hostinger_api.models.horizons_v1_websites_create_website_request import HorizonsV1WebsitesCreateWebsiteRequest from hostinger_api.models.horizons_v1_websites_created_website_resource import HorizonsV1WebsitesCreatedWebsiteResource 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.HorizonsWebsitesApi(api_client) horizons_v1_websites_create_website_request = hostinger_api.HorizonsV1WebsitesCreateWebsiteRequest() # HorizonsV1WebsitesCreateWebsiteRequest | try: # Create website api_response = api_instance.create_website_v1(horizons_v1_websites_create_website_request) print("The response of HorizonsWebsitesApi->create_website_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling HorizonsWebsitesApi->create_website_v1: %s\n" % e) ``` -------------------------------- ### Instantiate and Convert DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE.md Demonstrates how to create an instance of the model from a JSON string, convert it to JSON, convert it to a dictionary, and create an instance from a dictionary. Ensure the JSON string is valid. ```python from hostinger_api.models.domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype import DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE # TODO update the JSON string below json = "{}" # create an instance of DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE from a JSON string domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype_instance = DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE.from_json(json) # print the JSON string representation of the object print(DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE.to_json()) # convert the object into a dict domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype_dict = domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype_instance.to_dict() # create an instance of DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE from a dict domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype_from_dict = DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLDVERIFICATIONTYPE.from_dict(domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintldverificationtype_dict) ``` -------------------------------- ### Install Monarx v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSMalwareScannerApi.md Installs the Monarx malware scanner on a specified virtual machine. This enhances VPS security by protecting against malicious software. ```APIDOC ## install_monarx_v1 ### Description Installs the Monarx malware scanner on a specified virtual machine. ### Method POST ### Endpoint /v1/vps/{virtual_machine_id}/malware-scanner/monarx ### Parameters #### Path Parameters - **virtual_machine_id** (int) - Required - The ID of the virtual machine. ### Request Example ```python import hostinger_api from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource 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.VPSMalwareScannerApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID try: # Install Monarx api_response = api_instance.install_monarx_v1(virtual_machine_id) print("The response of VPSMalwareScannerApi->install_monarx_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSMalwareScannerApi->install_monarx_v1: %s\n" % e) ``` ### Response #### Success Response (200) - **VPSV1ActionActionResource** - Details about the action performed. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### restart_virtual_machine_v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSVirtualMachineApi.md Restarts a specified virtual machine by fully stopping and starting it. If the virtual machine was stopped, it will be started. Use this endpoint to reboot VPS instances. ```APIDOC ## restart_virtual_machine_v1 ### Description Restarts a specified virtual machine by fully stopping and starting it. If the virtual machine was stopped, it will be started. Use this endpoint to reboot VPS instances. ### Method POST ### Endpoint /v1/vps/{virtual_machine_id}/restart ### Parameters #### Path Parameters - **virtual_machine_id** (int) - Required - Virtual Machine ID ### Request Example ```python { "virtual_machine_id": 1268054 } ``` ### Response #### Success Response (200) - **VPSV1ActionActionResource** (object) - Details about the action performed. #### Response Example ```json { "action": { "id": "some_action_id", "status": "processing" } } ``` ``` -------------------------------- ### Instantiate and Convert DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD.md Demonstrates how to create an instance of DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD from a JSON string, convert it to a dictionary, and then create a new instance from that dictionary. Requires the model to be imported. ```python from hostinger_api.models.domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld import DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD # TODO update the JSON string below json = "{}" # create an instance of DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD from a JSON string domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld_instance = DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD.from_json(json) # print the JSON string representation of the object print(DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD.to_json()) # convert the object into a dict domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld_dict = domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld_instance.to_dict() # create an instance of DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD from a dict domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld_from_dict = DomainAccessVerifierV2VerificationsActiveVerificationsCollectionDataVERIFIEDDOMAINTLD.from_dict(domain_access_verifier_v2_verifications_active_verifications_collection_data_verifieddomaintld_dict) ``` -------------------------------- ### Create VPS Snapshot (Python) Source: https://github.com/hostinger/api-python-sdk/blob/main/docs/VPSSnapshotsApi.md Use this method to create a snapshot of a specified virtual machine. Note that creating a new snapshot will overwrite the existing one. This is useful for backup and recovery purposes. ```python import hostinger_api from hostinger_api.models.vpsv1_action_action_resource import VPSV1ActionActionResource 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.VPSSnapshotsApi(api_client) virtual_machine_id = 1268054 # int | Virtual Machine ID try: # Create snapshot api_response = api_instance.create_snapshot_v1(virtual_machine_id) print("The response of VPSSnapshotsApi->create_snapshot_v1:\n") pprint(api_response) except Exception as e: print("Exception when calling VPSSnapshotsApi->create_snapshot_v1: %s\n" % e) ``` -------------------------------- ### create_website_v1 Source: https://github.com/hostinger/api-python-sdk/blob/main/README.md Create a new website. ```APIDOC ## POST /api/horizons/v1/websites ### Description Create website. ### Method POST ### Endpoint /api/horizons/v1/websites ```