{"id":340,"date":"2025-04-14T11:27:04","date_gmt":"2025-04-14T11:27:04","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2025\/04\/14\/11080244-introduction-to-hostinger-api-sdks\/"},"modified":"2025-04-14T11:27:04","modified_gmt":"2025-04-14T11:27:04","slug":"11080244-introduction-to-hostinger-api-sdks","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/11080244-introduction-to-hostinger-api-sdks\/","title":{"rendered":"Introduction to Hostinger API SDKs"},"content":{"rendered":"<p class=\"no-margin\">Hostinger provides official SDKs to simplify interaction with our API, making it easier and faster for developers to integrate Hostinger services into their applications. Currently, we offer SDKs in the following languages:<\/p><ul>\n<li>\n<p class=\"no-margin\"><a href=\"https:\/\/github.com\/hostinger\/api-php-sdk\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">PHP SDK<\/a><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><a href=\"https:\/\/github.com\/hostinger\/api-python-sdk\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Python SDK<\/a><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><a href=\"https:\/\/github.com\/hostinger\/api-typescript-sdk\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">TypeScript SDK<\/a><\/p>\n<\/li>\n<\/ul><h2 id=\"h_26c0f5bae4\">Getting Started<\/h2><h3 id=\"h_157196013a\">PHP SDK<\/h3><p class=\"no-margin\">To install the bindings via <a href=\"https:\/\/getcomposer.org\/\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">Composer<\/a>, add the following to <code>composer.json<\/code>:<\/p><pre><code>{<br>  \"repositories\": [<br>    {<br>      \"type\": \"vcs\",<br>      \"url\": \"https:\/\/github.com\/hostinger\/api-php-sdk.git\"<br>    }<br>  ],<br>  \"require\": {<br>    \"hostinger\/api-php-sdk\": \"*\"<br>  }<br>}<\/code><\/pre><p class=\"no-margin\">Then run <code>composer install<\/code>.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Example usage:<\/p><pre><code>&lt;?php<br>require_once(__DIR__ . '\/vendor\/autoload.php');<br><br><br><br>\/\/ Configure Bearer authorization: apiToken<br>$config = Hostinger\\Configuration::getDefaultConfiguration()-&gt;setAccessToken('YOUR_ACCESS_TOKEN');<br><br><br>$apiInstance = new Hostinger\\Api\\BillingCatalogApi(<br>    \/\/ If you want use custom http client, pass your client which implements `GuzzleHttp\\ClientInterface`.<br>    \/\/ This is optional, `GuzzleHttp\\Client` will be used as default.<br>    client: new GuzzleHttp\\Client(),<br>    config: $config<br>);<br><br>try {<br>    $result = $apiInstance-&gt;getCatalogItemListV1();<br>    print_r($result);<br>} catch (Exception $e) {<br>    echo 'Exception when calling BillingCatalogApi-&gt;getCatalogItemListV1: ', $e-&gt;getMessage(), PHP_EOL;<br>}<br><\/code><\/pre><p class=\"no-margin\">\n<\/p><h3 id=\"h_d1d881a24b\">Python SDK<\/h3><p class=\"no-margin\">Install via pip:<\/p><pre><code>pip install hostinger_api<\/code><\/pre><p class=\"no-margin\">Example usage:<\/p><pre><code>import hostinger_api<br>from hostinger_api.rest import ApiException<br>from pprint import pprint<br><br><br># Configure Bearer authorization: apiToken<br>configuration = hostinger_api.Configuration(<br>    access_token = os.environ[\"BEARER_TOKEN\"]<br>)<br><br><br># Enter a context with an instance of the API client<br>with hostinger_api.ApiClient(configuration) as api_client:<br>    # Create an instance of the API class<br>    api_instance = hostinger_api.BillingCatalogApi(api_client)<br><br>    try:<br>        # Get catalog item list<br>        api_response = api_instance.get_catalog_item_list_v1()<br>        print(\"The response of BillingCatalogApi-&gt;get_catalog_item_list_v1:\\n\")<br>        pprint(api_response)<br>    except ApiException as e:<br>        print(\"Exception when calling BillingCatalogApi-&gt;get_catalog_item_list_v1: %s\\n\" % e)<br><\/code><\/pre><p class=\"no-margin\">\n<\/p><h3 id=\"h_2c7cee8f61\">TypeScript SDK<\/h3><p class=\"no-margin\">Install via npm:<\/p><pre><code>npm install hostinger-api-sdk@0.0.4 --save<\/code><\/pre><p class=\"no-margin\">Example usage:<\/p><pre><code>import { Client } from 'hostinger-api-sdk';<br><br>const client = new Client('your-api-token');<br><br>client.get('\/v1\/user').then(response =&gt; {<br>  console.log(response);<br>});<\/code><\/pre><p class=\"no-margin\">\n<\/p><h2 id=\"h_ca2f78b67f\">Authentication<\/h2><p class=\"no-margin\">All SDKs require an API token to authenticate your requests. You can obtain your API token from your Hostinger dashboard under <a href=\"https:\/\/hpanel.hostinger.com\/profile\/api\" target=\"_blank\" class=\"intercom-content-link\" rel=\"noopener\">the API in Account settings<\/a>.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Explore our SDKs&rsquo; functionalities and advanced features by checking out their respective GitHub repositories linked above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Get to know Hostinger API PHP, Python, and TypeScript SDKs<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[295],"tags":[],"class_list":["post-340","post","type-post","status-publish","format-standard","hentry","category-api"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/11080244-introduction-to-hostinger-api-sdks\/","default":1}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}