# Database Servers (Admin)

<a id="get-api-v1-databases"></a>
#### `GET /api/v1/databases`

*List every database on the server (admin)*

Server-wide listing including orphan databases (no `{user}_` prefix match). Used by the operator's orphan-cleanup tool. Response data is a list of `{name, owner, size_mb, ...}` rows.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `object` | Successful Response |

**Response example (200):**

```json
{}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/databases
```

---

<a id="delete-api-v1-databases-db-name"></a>
#### `DELETE /api/v1/databases/{db_name}`

*Drop any database (admin)*

Admin orphan-cleanup. Refuses to drop internal system schemas.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `db_name` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `MessageResponse` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "message": "string",
  "status": "success"
}
```

**cURL example:**

```bash
curl -X DELETE \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/databases/{db_name}
```

---

<a id="get-api-v1-databases-db-name-phpmyadmin-url"></a>
#### `GET /api/v1/databases/{db_name}/phpmyadmin-url`

*Mint phpMyAdmin SSO URL for any database (admin)*

Admin-scope variant — works for orphan databases too. Returns 200 with `error_code=PMA_NOT_INSTALLED` when phpMyAdmin is absent. Handle both shapes client-side.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `db_name` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `object` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/databases/{db_name}/phpmyadmin-url
```

---
