# Databases endpoints (Client API: game servers)

> 13 FeatherPanel Client API: game servers endpoints from user/server/databases.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/user/server/databases/

Defined in [`backend/app/routes/user/server/databases.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php). Authentication used here: **Server access**. Read [Authentication](https://featherpanel.com/docs/api/authentication/) for how to send credentials and [Rate limits and errors](https://featherpanel.com/docs/api/rate-limits-and-errors/) for the response envelope.

Paths, methods, permissions and rate limits come from the route file. Summaries, parameters and response codes come from the OpenAPI annotations on the controllers; endpoints without annotations show only what the route file declares.

## Endpoints

### GET `/api/user/servers/{uuidShort}/databases`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-databases`)
- Route name: `session-server-databases`
- Controller: [`ServerDatabaseController::getServerDatabases`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L27)

**Get server databases** Retrieve all databases for a specific server that the user owns or has subuser access to, with pagination and search functionality.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `page` | query | integer | no | Page number for pagination |
| `per_page` | query | integer | no | Number of records per page |
| `search` | query | string | no | Search term to filter databases by name, username, or host |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `data` | ServerDatabase\[\] |  |
| `pagination` | DatabasePagination |  |

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/databases" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Server databases retrieved successfully · `400` Bad request - Missing or invalid UUID short · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server not found · `500` Internal server error - Failed to retrieve databases

### POST `/api/user/servers/{uuidShort}/databases`

- Auth: Server access
- Default rate limit: 5 / minute (`user-server-databases`)
- Route name: `session-server-databases-create`
- Controller: [`ServerDatabaseController::createServerDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L51)

**Create database** Create a new database for a server. Checks database limits and creates database on the specified host.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |

Request body: [`DatabaseCreateRequest`](https://featherpanel.com/docs/api/schemas/#schema-databasecreaterequest) (application/json) · Response data: [`DatabaseCreateResponse`](https://featherpanel.com/docs/api/schemas/#schema-databasecreateresponse)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `database_host_id` | integer | yes | Database host ID |
| `database_name` | string | yes | Database name (without server prefix) |
| `remote` | string | no | Remote access pattern |
| `max_connections` | integer | no | Maximum connections |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | Created database ID |
| `database_name` | string | Generated database name |
| `username` | string | Generated username |
| `password` | string | Generated password |
| `message` | string | Success message |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/databases" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"database_host_id":0,"database_name":"","remote":"","max_connections":0}'
```

Plugin events: [`featherpanel:user:server:database:created`](https://featherpanel.com/docs/plugins/events/server/#server-database-created)

Responses: `200` Database created successfully · `400` Bad request - Missing UUID, database limit reached, or invalid request body · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server or database host not found · `500` Internal server error - Failed to create database

### DELETE `/api/user/servers/{uuidShort}/databases/bulk-delete`

- Auth: Server access
- Default rate limit: 5 / minute (`user-server-databases`)
- Route name: `session-server-databases-bulk-delete`
- Controller: [`ServerDatabaseController::bulkDeleteServerDatabases`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L75)

**Bulk delete server databases** Delete multiple databases at once. Pass an array of database IDs, or set all=true to delete every database for the server.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | integer\[\] | no | Database IDs to delete |
| `all` | boolean | no | When true, delete all databases for the server |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `deleted_count` | integer |  |
| `failed_count` | integer |  |
| `failed` | object\[\] |  |

```bash
curl -X DELETE "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/bulk-delete" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"ids":[],"all":false}'
```

Plugin events: [`featherpanel:user:server:database:deleted`](https://featherpanel.com/docs/plugins/events/server/#server-database-deleted)

Responses: `200` Bulk delete completed · `400` Bad request - Invalid or missing parameters · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server or node not found · `500` Internal server error

### GET `/api/user/servers/{uuidShort}/databases/hosts`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-databases`)
- Route name: `session-server-databases-hosts`
- Controller: [`ServerDatabaseController::getAvailableDatabaseHosts`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L99)

**Get available database hosts** Retrieve all available database hosts that can be used for creating databases.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/hosts" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Database hosts retrieved successfully · `400` Bad request - Missing or invalid UUID short · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server not found · `500` Internal server error - Failed to retrieve database hosts

### GET `/api/user/servers/{uuidShort}/databases/{databaseId}`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-databases`)
- Route name: `session-server-databases-show`
- Controller: [`ServerDatabaseController::getServerDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L123)

**Get specific database** Retrieve details of a specific database for a server that the user owns or has subuser access to.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

Response data: [`ServerDatabase`](https://featherpanel.com/docs/api/schemas/#schema-serverdatabase)

| Response `data` field | Type | Description |
| --- | --- | --- |
| `id` | integer | Database ID |
| `server_id` | integer | Server ID |
| `database_host_id` | integer | Database host ID |
| `database` | string | Database name |
| `username` | string | Database username |
| `password` | string | Database password |
| `remote` | string | Remote access pattern |
| `max_connections` | integer | Maximum connections |
| `database_host_name` | string | Database host name |
| `database_host` | string | Database host address |
| `database_port` | integer | Database host port |
| `database_type` | string | Database type |
| `created_at` | string (date-time) | Creation timestamp |
| `updated_at` | string (date-time) | Last update timestamp |

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Database details retrieved successfully · `400` Bad request - Missing or invalid parameters · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server or database not found · `500` Internal server error - Failed to retrieve database

### PATCH `/api/user/servers/{uuidShort}/databases/{databaseId}`

- Auth: Server access
- Default rate limit: 10 / minute (`user-server-databases`)
- Route name: `session-server-databases-update`
- Controller: [`ServerDatabaseController::updateServerDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L152)

**Update database** Update database settings including remote access pattern and maximum connections.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

Request body: [`DatabaseUpdateRequest`](https://featherpanel.com/docs/api/schemas/#schema-databaseupdaterequest) (application/json)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `remote` | string | no | Remote access pattern |
| `max_connections` | integer | no | Maximum connections |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

```bash
curl -X PATCH "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"remote":"","max_connections":0}'
```

Plugin events: [`featherpanel:user:server:database:updated`](https://featherpanel.com/docs/plugins/events/server/#server-database-updated)

Responses: `200` Database updated successfully · `400` Bad request - Missing parameters or invalid request body · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server or database not found · `500` Internal server error - Failed to update database

### DELETE `/api/user/servers/{uuidShort}/databases/{databaseId}`

- Auth: Server access
- Route name: `session-server-databases-delete`
- Controller: [`ServerDatabaseController::deleteServerDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L181)

**Delete database** Permanently delete a database from a server. This action cannot be undone.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

```bash
curl -X DELETE "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:user:server:database:deleted`](https://featherpanel.com/docs/plugins/events/server/#server-database-deleted)

Responses: `200` Database deleted successfully · `400` Bad request - Missing parameters · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server, database, or database host not found · `500` Internal server error - Failed to delete database

### POST `/api/user/servers/{uuidShort}/databases/hosts/{databaseHostId}/test`

- Auth: Server access
- Default rate limit: 5 / minute (`user-server-databases`)
- Route name: `session-server-databases-test-host`
- Controller: [`ServerDatabaseController::testDatabaseHostConnection`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L208)

**Test database host connection** Test the connection to a specific database host to verify connectivity and performance.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseHostId` | path | integer | yes | Database host ID to test |

Response data: [`ConnectionTestResponse`](https://featherpanel.com/docs/api/schemas/#schema-connectiontestresponse)

| Response `data` field | Type | Description |
| --- | --- | --- |
| `database_host_id` | integer | Database host ID |
| `healthy` | boolean | Connection health status |
| `message` | string | Connection test message |
| `response_time` | number | Response time in milliseconds |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/hosts/$DATABASE_HOST_ID/test" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Connection test completed · `400` Bad request - Missing or invalid parameters · `401` Unauthorized - User not authenticated · `404` Not found - Server or database host not found · `500` Internal server error - Failed to test connection

### GET `/api/user/servers/{uuidShort}/databases/{databaseId}/export`

- Auth: Server access
- Default rate limit: 5 / minute (`user-server-databases`)
- Route name: `session-server-databases-export`
- Controller: [`ServerDatabaseController::exportDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L237)

**Export database as SQL dump** Generate a SQL dump of the database including CREATE TABLE statements and INSERT data. Requires database.view\_password permission. Only supported for MySQL/MariaDB databases.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `sql` | string | SQL dump content |
| `filename` | string | Suggested filename |
| `table_count` | integer | Number of tables exported |
| `exported_at` | string | Export timestamp |

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID/export" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` SQL dump generated successfully · `400` Bad request - Unsupported database type · `401` Unauthorized · `403` Forbidden - Requires database.view\_password permission · `404` Server or database not found · `500` Internal server error - Failed to generate dump

### POST `/api/user/servers/{uuidShort}/databases/{databaseId}/import`

- Auth: Server access
- Default rate limit: 5 / minute (`user-server-databases`)
- Route name: `session-server-databases-import`
- Controller: [`ServerDatabaseController::importDatabase`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L262)

**Import SQL dump into database** Execute a SQL dump against the database. Requires database.view\_password permission. Statements are executed sequentially; execution stops on the first error by default.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `sql` | string | no | SQL content to import |
| `ignore_errors` | boolean | no | Continue on errors (default: false) |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `executed_statements` | integer | Number of statements executed |
| `errors` | string\[\] | List of errors encountered |
| `success` | boolean | Whether all statements succeeded |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID/import" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"sql":"","ignore_errors":false}'
```

Responses: `200` SQL import completed · `400` Bad request - Missing SQL or unsupported database type · `401` Unauthorized · `403` Forbidden - Requires database.view\_password permission · `404` Server or database not found · `500` Internal server error

### POST `/api/user/servers/{uuidShort}/databases/{databaseId}/query`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-databases`)
- Route name: `session-server-databases-query`
- Controller: [`ServerDatabaseController::runQuery`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L287)

**Run a SQL query** Execute a SQL query against the database and return results. Requires database.view\_password permission. SELECT queries return rows (max 500); DML queries return affected row count.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | no | SQL query to execute |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `type` | string | Query type |
| `columns` | string\[\] | Column names (for SELECT) |
| `rows` | mixed\[\]\[\] | Result rows as arrays (for SELECT) |
| `row_count` | integer | Number of rows returned (for SELECT) |
| `affected_rows` | integer | Number of rows affected (for DML) |
| `truncated` | boolean | Whether the result was truncated to 500 rows |
| `execution_time_ms` | number | Query execution time in milliseconds |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID/query" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"query":""}'
```

Responses: `200` Query executed successfully · `400` Bad request - Missing or empty query · `401` Unauthorized · `403` Forbidden - Requires database.view\_password permission · `404` Server or database not found · `422` Query execution error · `500` Internal server error

### GET `/api/user/servers/{uuidShort}/databases/phpmyadmin/check`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-databases`)
- Route name: `session-server-databases-phpmyadmin-check`
- Controller: [`ServerDatabaseController::checkPhpMyAdminInstalled`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L312)

**Check phpMyAdmin installation** Check if phpMyAdmin module is installed and available.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `installed` | boolean | Whether phpMyAdmin is installed |

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/phpmyadmin/check" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` phpMyAdmin installation status

### POST `/api/user/servers/{uuidShort}/databases/{databaseId}/phpmyadmin/token`

- Auth: Server access
- Default rate limit: 10 / minute (`user-server-databases`)
- Route name: `session-server-databases-phpmyadmin-token`
- Controller: [`ServerDatabaseController::generatePhpMyAdminToken`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerDatabaseController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/databases.php#L336)

**Generate phpMyAdmin signon token** Mint a single-use phpMyAdmin signon token (credentials stay server-side; URL carries only the opaque token).

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | string | yes | Server short UUID |
| `databaseId` | path | integer | yes | Database ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `url` | string | phpMyAdmin URL with single-use token query param only |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/databases/$DATABASE_ID/phpmyadmin/token" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Responses: `200` Token generated successfully · `400` Bad request - Missing parameters · `401` Unauthorized - User not authenticated · `403` Forbidden - Access denied to server · `404` Not found - Server, database, or phpMyAdmin not found
