Skip to main content
Version: v1.0+

Database Management

The Application API Database Management endpoints allow administrators to manage databases for servers. These endpoints provide operations for creating, viewing, and managing MySQL databases associated with servers.

Administrative Access Required

These endpoints require administrative privileges and an Application API key with appropriate permissions.

List Server Databases

Retrieve a list of all databases for a specific server.

GET /api/application/servers/{server}/databases

Parameters

ParameterTypeLocationRequiredDescription
serverstringpathYesThe server's UUID or ID

Query Parameters

ParameterTypeDescriptionDefault
pageintegerPage number for pagination1
per_pageintegerResults per page (1-100)50
includestringInclude related resources (host, password)-
GET /api/application/servers/{server}/databases
curl -X GET "https://panel.example.com/api/application/servers/{server}/databases" \
-H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json"

Response

{
"object": "list",
"data": [
{
"object": "server_database",
"attributes": {
"id": 1,
"server": 1,
"host": 1,
"database": "s1_example",
"username": "u1_example",
"remote": "%",
"max_connections": 0,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00"
}
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 50,
"current_page": 1,
"total_pages": 1
}
}
}

Get Server Database

Retrieve details for a specific database.

GET /api/application/servers/{server}/databases/{database}

Parameters

ParameterTypeLocationRequiredDescription
serverstringpathYesThe server's UUID or ID
databaseintegerpathYesThe database ID
GET /api/application/servers/{server}/databases/{database}
curl -X GET "https://panel.example.com/api/application/servers/{server}/databases/{database}" \
-H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json"

Response

{
"object": "server_database",
"attributes": {
"id": 1,
"server": 1,
"host": 1,
"database": "s1_example",
"username": "u1_example",
"remote": "%",
"max_connections": 0,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00",
"relationships": {
"password": {
"object": "database_password",
"attributes": {
"password": "example_password"
}
},
"host": {
"object": "database_host",
"attributes": {
"id": 1,
"name": "localhost",
"host": "127.0.0.1",
"port": 3306,
"username": "root",
"node": 1,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00"
}
}
}
}
}

Create Server Database

Create a new database for a server.

POST /api/application/servers/{server}/databases

Parameters

ParameterTypeLocationRequiredDescription
serverstringpathYesThe server's UUID or ID

Request Body

FieldTypeRequiredDescription
databasestringYesDatabase name (will be prefixed with server ID)
remotestringYesRemote connection address (use % for any)
hostintegerYesDatabase host ID
POST /api/application/servers/{server}/databases
curl -X POST "https://panel.example.com/api/application/servers/{server}/databases" \
-H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"database": "my_database",
"remote": "%",
"host": 1
}'

Response

{
"object": "server_database",
"attributes": {
"id": 2,
"server": 1,
"host": 1,
"database": "s1_my_database",
"username": "u1_randomuser",
"remote": "%",
"max_connections": 0,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00",
"relationships": {
"password": {
"object": "database_password",
"attributes": {
"password": "generated_password"
}
}
}
}
}

Reset Database Password

Reset the password for a server database.

POST /api/application/servers/{server}/databases/{database}/reset-password

Parameters

ParameterTypeLocationRequiredDescription
serverstringpathYesThe server's UUID or ID
databaseintegerpathYesThe database ID
POST /api/application/servers/{server}/databases/{database}/reset-password
curl -X POST "https://panel.example.com/api/application/servers/{server}/databases/{database}/reset-password" \
-H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json"

Response

{
"object": "server_database",
"attributes": {
"id": 1,
"server": 1,
"host": 1,
"database": "s1_example",
"username": "u1_example",
"remote": "%",
"max_connections": 0,
"created_at": "2024-01-01T00:00:00+00:00",
"updated_at": "2024-01-01T00:00:00+00:00",
"relationships": {
"password": {
"object": "database_password",
"attributes": {
"password": "new_generated_password"
}
}
}
}
}

Delete Server Database

Delete a database from a server.

DELETE /api/application/servers/{server}/databases/{database}

Parameters

ParameterTypeLocationRequiredDescription
serverstringpathYesThe server's UUID or ID
databaseintegerpathYesThe database ID
DELETE /api/application/servers/{server}/databases/{database}
curl -X DELETE "https://panel.example.com/api/application/servers/{server}/databases/{database}" \
-H "Authorization: Bearer YOUR_APPLICATION_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json"

Response

Returns 204 No Content on successful deletion.

Error Responses

All database management endpoints may return the following errors:

Status CodeErrorDescription
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
403ForbiddenInsufficient permissions
404Not FoundServer or database not found
409ConflictDatabase name already exists
422Unprocessable EntityValidation errors
500Internal Server ErrorServer error

Error Response Format

{
"errors": [
{
"code": "ValidationException",
"status": "422",
"detail": "The database name has already been taken."
}
]
}