# get_site_database

Source: https://modulify.ai/docs/api/database/get-site-database

Checks whether a site has a database, whether it is running and which engine it runs.

- Title: Check the site database
- Scope: `data:read`
- Access: Read only
- Endpoint: `POST /v1/get_site_database`

The engine comes back in the database `type` field, and it decides the SQL dialect `execute_sql` has to be written in, so read it before writing a statement by hand. `isAvailable` says whether the database is running right now, and a site with no database comes back with `database` set to null. Check this first when a data tool cannot reach the database.

The connection string, host, port, user and password are never returned here, and `create_site_database` does not return them either. The stored `DATABASE_URL` and `DATABASE_TOKEN` come back only from `get_secret`, behind the `credentials:reveal` scope, and the tool tells the client never to go after them unless you asked for that exact value. See [Which database your site has](https://modulify.ai/docs/data/databases#which-database-your-site-has).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/get_site_database`, sending the inputs below as a JSON object. The token needs the `data:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/get_site_database \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [get_site_database tool](https://modulify.ai/docs/mcp/database/get-site-database).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.