All URIs are relative to https://developers.hostinger.com, except if the operation defines another base path.
| Method | HTTP request | Description |
|---|---|---|
| changeDatabasePasswordV1() | PATCH /api/hosting/v1/accounts/{username}/databases/{name}/change-password | Change database password |
| createAccountDatabaseV1() | POST /api/hosting/v1/accounts/{username}/databases | Create account database |
| createDatabaseRemoteConnectionV1() | POST /api/hosting/v1/accounts/{username}/databases/{name}/remote-connections | Create database remote connection |
| deleteAccountDatabaseV1() | DELETE /api/hosting/v1/accounts/{username}/databases/{name} | Delete account database |
| deleteDatabaseRemoteConnectionV1() | DELETE /api/hosting/v1/accounts/{username}/databases/{name}/remote-connections | Delete database remote connection |
| getPhpMyAdminLinkV1() | GET /api/hosting/v1/accounts/{username}/databases/{name}/phpmyadmin-link | Get phpMyAdmin link |
| listAccountDatabasesV1() | GET /api/hosting/v1/accounts/{username}/databases | List account databases |
| listDatabaseRemoteConnectionsV1() | GET /api/hosting/v1/accounts/{username}/databases/remote-connections | List database remote connections |
| repairDatabaseV1() | PATCH /api/hosting/v1/accounts/{username}/databases/{name}/repair | Repair database |
| setupWebsiteDatabaseV1() | POST /api/hosting/v1/accounts/{username}/websites/{domain}/databases/setup | Setup website database |
changeDatabasePasswordV1($username, $name, $hostingV1DatabasesChangeDatabasePasswordRequest): \Hostinger\Model\CommonSuccessEmptyResourceChange database password
Changes the password for the specified database user. The database name must be the full name returned by the list databases endpoint. The password must also be updated in any website configuration that uses this database.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
$hostingV1DatabasesChangeDatabasePasswordRequest = new \Hostinger\Model\HostingV1DatabasesChangeDatabasePasswordRequest(); // \Hostinger\Model\HostingV1DatabasesChangeDatabasePasswordRequest
try {
$result = $apiInstance->changeDatabasePasswordV1($username, $name, $hostingV1DatabasesChangeDatabasePasswordRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->changeDatabasePasswordV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. | |
| hostingV1DatabasesChangeDatabasePasswordRequest | \Hostinger\Model\HostingV1DatabasesChangeDatabasePasswordRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
createAccountDatabaseV1($username, $hostingV1DatabasesCreateDatabaseRequest): \Hostinger\Model\CommonSuccessEmptyResourceCreate account database
Creates a database with a database user and password for the specified account. The database name and user are automatically prefixed with the account username when needed.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$hostingV1DatabasesCreateDatabaseRequest = new \Hostinger\Model\HostingV1DatabasesCreateDatabaseRequest(); // \Hostinger\Model\HostingV1DatabasesCreateDatabaseRequest
try {
$result = $apiInstance->createAccountDatabaseV1($username, $hostingV1DatabasesCreateDatabaseRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->createAccountDatabaseV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| hostingV1DatabasesCreateDatabaseRequest | \Hostinger\Model\HostingV1DatabasesCreateDatabaseRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
createDatabaseRemoteConnectionV1($username, $name, $hostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest): \Hostinger\Model\CommonSuccessEmptyResourceCreate database remote connection
Allows a remote host to connect to the specified database. Provide an IPv4/IPv6 address, or "%" to allow any host. The database name must be the full name returned by the list databases endpoint. Database creation is synchronous, so a 404 here means no database with that name exists under the username, not that it is still being created.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
$hostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest = new \Hostinger\Model\HostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest(); // \Hostinger\Model\HostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest
try {
$result = $apiInstance->createDatabaseRemoteConnectionV1($username, $name, $hostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->createDatabaseRemoteConnectionV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. | |
| hostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest | \Hostinger\Model\HostingV1DatabasesRemoteConnectionsCreateRemoteConnectionRequest |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deleteAccountDatabaseV1($username, $name): \Hostinger\Model\CommonSuccessEmptyResourceDelete account database
Permanently deletes a database and its remote connections. The database name must be the full name returned by the list databases endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
try {
$result = $apiInstance->deleteAccountDatabaseV1($username, $name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->deleteAccountDatabaseV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deleteDatabaseRemoteConnectionV1($username, $name, $ip): \Hostinger\Model\CommonSuccessEmptyResourceDelete database remote connection
Permanently removes a remote-access rule, revoking the given host's remote access to the database. Identify the rule with the required ip query parameter (the IPv4/IPv6 address, or "%", exactly as returned by the list remote connections endpoint). The database name must be the full name returned by the list databases endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
$ip = 192.0.2.10; // string | Remote host to revoke: the IPv4/IPv6 address, or \"%\", exactly as returned by the list remote connections endpoint.
try {
$result = $apiInstance->deleteDatabaseRemoteConnectionV1($username, $name, $ip);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->deleteDatabaseRemoteConnectionV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. | |
| ip | string | Remote host to revoke: the IPv4/IPv6 address, or "%", exactly as returned by the list remote connections endpoint. |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getPhpMyAdminLinkV1($username, $name): \Hostinger\Model\HostingV1DatabasesPhpMyAdminLinkResourceGet phpMyAdmin link
Returns a direct sign-on link to phpMyAdmin for the specified database. Use this when a visual database interface is needed for SQL queries, imports, exports, or table management. The database name must be the full name returned by the list databases endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
try {
$result = $apiInstance->getPhpMyAdminLinkV1($username, $name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->getPhpMyAdminLinkV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. |
\Hostinger\Model\HostingV1DatabasesPhpMyAdminLinkResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
listAccountDatabasesV1($username, $page, $perPage, $domain, $isAssigned, $search): \Hostinger\Model\HostingListAccountDatabasesV1200ResponseList account databases
Returns a paginated list of databases for the specified account. Use the domain and is_assigned filters to find databases assigned to a specific domain.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$page = 1; // int | Page number
$perPage = 25; // int | Number of items per page
$domain = example.com; // string | Filter by domain name (case-insensitive substring match)
$isAssigned = true; // bool | When used with domain, return only databases assigned to that domain.
$search = test_db; // string | Search databases by name, user, or creation date.
try {
$result = $apiInstance->listAccountDatabasesV1($username, $page, $perPage, $domain, $isAssigned, $search);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->listAccountDatabasesV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| page | int | Page number | [optional] |
| perPage | int | Number of items per page | [optional] [default to 25] |
| domain | string | Filter by domain name (case-insensitive substring match) | [optional] |
| isAssigned | bool | When used with domain, return only databases assigned to that domain. | [optional] |
| search | string | Search databases by name, user, or creation date. | [optional] |
\Hostinger\Model\HostingListAccountDatabasesV1200Response
[Back to top] [Back to API list] [Back to Model list] [Back to README]
listDatabaseRemoteConnectionsV1($username, $domain): \Hostinger\Model\HostingV1DatabasesRemoteConnectionsRemoteConnectionResource[]List database remote connections
Returns the remote-access rules for the specified account: the remote hosts (IPv4/IPv6 addresses, or "%" for any host) allowed to connect to the account databases. Use the domain filter to only return rules for databases assigned to a specific domain.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$domain = example.com; // string | Filter remote connections by the domain the database is assigned to. Rules for databases not assigned to any domain are always included.
try {
$result = $apiInstance->listDatabaseRemoteConnectionsV1($username, $domain);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->listDatabaseRemoteConnectionsV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| domain | string | Filter remote connections by the domain the database is assigned to. Rules for databases not assigned to any domain are always included. | [optional] |
\Hostinger\Model\HostingV1DatabasesRemoteConnectionsRemoteConnectionResource[]
[Back to top] [Back to API list] [Back to Model list] [Back to README]
repairDatabaseV1($username, $name): \Hostinger\Model\CommonSuccessEmptyResourceRepair database
Repairs corrupted database tables asynchronously. Use when database errors, crashes, or corruption are reported. The database name must be the full name returned by the list databases endpoint.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$name = u123456789_test_db; // string | Full database name as returned by the list databases endpoint.
try {
$result = $apiInstance->repairDatabaseV1($username, $name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->repairDatabaseV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| name | string | Full database name as returned by the list databases endpoint. |
\Hostinger\Model\CommonSuccessEmptyResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]
setupWebsiteDatabaseV1($username, $domain, $hostingV1DatabasesSetupDatabaseRequest): \Hostinger\Model\HostingV1DatabasesWebsiteDatabaseResourceSetup website database
Creates a new MySQL database for the website and writes its connection details into the website's environment variables, then restarts the application. The platform generates the password (and the database name and user, unless supplied). The password is never returned; the application reads it from the environment. Written variables: DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD and DATABASE_URL (mysql://user:password@host:port/name, user and password percent-encoded). Existing variables are kept. If the website already has any variable with one of these names the call fails with 422 and nothing is created; the Replace Node.js environment variables endpoint removes them. After this call the variables are ordinary environment variables: the Replace Node.js environment variables endpoint changes or removes them like any other. A restart is enough for apps that read environment variables at process start, such as Express or NestJS. Frameworks that bake variables into the build output (Next.js, NEXT_PUBLIC_*) see the new values only after a fresh build (Start Node.js build endpoint). A password in the request is ignored; the platform always generates it. The optional name and user are identifiers, not secrets.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: apiToken
$config = Hostinger\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Hostinger\Api\HostingDatabasesApi(config: $config);
$username = u123456789; // string
$domain = mydomain.tld; // string | Domain name
$hostingV1DatabasesSetupDatabaseRequest = new \Hostinger\Model\HostingV1DatabasesSetupDatabaseRequest(); // \Hostinger\Model\HostingV1DatabasesSetupDatabaseRequest
try {
$result = $apiInstance->setupWebsiteDatabaseV1($username, $domain, $hostingV1DatabasesSetupDatabaseRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling HostingDatabasesApi->setupWebsiteDatabaseV1: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| username | string | ||
| domain | string | Domain name | |
| hostingV1DatabasesSetupDatabaseRequest | \Hostinger\Model\HostingV1DatabasesSetupDatabaseRequest | [optional] |
\Hostinger\Model\HostingV1DatabasesWebsiteDatabaseResource
[Back to top] [Back to API list] [Back to Model list] [Back to README]