# query_wp_database

> Run one read-only SQL statement against a WordPress site's own database and return the rows.

- Tier: R
- Required scope: read:database + read:hosting
- Annotations: readOnlyHint, idempotentHint
- Docs: https://api.inleed.com/tools/query-wp-database

## Description

Run one read-only SQL statement against a WordPress site's own database and return the rows. Only `select`, `show`, `describe` and `explain` are accepted — one statement, no `;` except a trailing one, no `into outfile`; anything else is refused with `validation_failed` before it reaches the site, and there is no tool that runs SQL writes. Returns `{prefix, columns, rows, rowCount, truncated}`. `prefix` is this install's table prefix (e.g.

## Input schema

- `input` — string (required). A domain, email address, website URL, numeric service id, or hosting-account username the customer actually owns. Resolved to the owning account automatically; the resolved target is echoed back in the response.
- `sql` — string (required). One read-only statement: select, show, describe or explain (max 5000 characters, no second statement). Use the prefix from a previous result for table names, e.g.
- `path` — string. Optional subfolder of a WordPress install not at the domain root (e.g. blog).

## Example call

```json
{
  "name": "query_wp_database",
  "arguments": {
    "input": "example.se",
    "sql": "example.se"
  }
}
```

